-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vertx 4.1 & Tracing rework #900
Vertx 4.1 & Tracing rework #900
Conversation
038acc6
to
d993c35
Compare
Codecov Report
@@ Coverage Diff @@
## main #900 +/- ##
============================================
- Coverage 76.07% 75.82% -0.25%
+ Complexity 441 419 -22
============================================
Files 78 74 -4
Lines 3013 2924 -89
Branches 133 124 -9
============================================
- Hits 2292 2217 -75
+ Misses 559 555 -4
+ Partials 162 152 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I'm gonna test locally, with the new amazing dev scripts 😍 , if tracing works properly |
/hold Tracing still doesn't work 😢 |
39384ce
to
0e5221b
Compare
...er/src/test/java/dev/knative/eventing/kafka/broker/receiver/ReceiverTracingVerticleTest.java
Show resolved
Hide resolved
Tracing fixed! From up to bottom, traces matches the tests Probably we should investigate why in the unordered case, the span is so long (sometimes it's not!), but I guess we can tackle it in a separate issue? I have the feeling this has something to do with the offset commit... Fix #929 |
We still need to wait for the new vert.x 4.1 release before merging this one, so i keep the hold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
/lgtm
/hold for the question, unhold if that's not possible.
.../dispatcher/src/main/java/dev/knative/eventing/kafka/broker/dispatcher/RecordDispatcher.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
A new simple test for tracing Updated THIRD-PARTY.txt Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
4cd8997
to
f18c47c
Compare
@@ -52,19 +50,18 @@ public CloudEventRequestToRecordMapper(final Vertx vertx) { | |||
} | |||
|
|||
if (logger.isDebugEnabled()) { | |||
final var span = TracingSpan.getCurrent(vertx); | |||
final var span = Span.fromContextOrNull(Context.current()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What current means here? Shouldn't we pull the span from the Vertx context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a utility to get the current span? The idea being isolating OTEL code in one module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What current means here? Shouldn't we pull the span from the Vertx context?
Nope, I've integrated the vert.x context with the otel context apis https://github.com/eclipse-vertx/vertx-tracing/blob/master/vertx-opentelemetry/src/main/java/io/vertx/tracing/opentelemetry/VertxContextStorageProvider.java, so to retrieve spans we don't need to access the vert.x context manually.
Can we use a utility to get the current span? The idea being isolating OTEL code in one module.
TBH I think we don't need to hide the otel apis, they are straightforward and using them directly sounds reasonable to me...
|
||
final var span = getCurrent(vertx); | ||
public static void decorateCurrentWithEvent(final CloudEvent event) { | ||
Span span = Span.fromContextOrNull(Context.current()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
getOffsetManager(deliveryOrder, consumer, eventsSentCounter::increment), | ||
ConsumerTracer.create( | ||
((VertxInternal) vertx).tracer(), | ||
new KafkaClientOptions() | ||
.setConfig(consumerConfigs) | ||
.setTracingPolicy(TracingPolicy.PROPAGATE) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why we need this tracer, vertx Kafka already creates a tracer when we create a Kafka client at line 200, and it does a similar thing of https://github.com/knative-sandbox/eventing-kafka-broker/pull/900/files#diff-384d435208823cfbd29027fa5bba51ebbc6c3671ffecb12f0af13405ed9c11b1R138.
Can you add a comment on why we set tracing policy to ignore when we create a consumer and we create our own tracer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it because it doesn't wait for our handler to finish before finishing the span and our handler is async?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment on why we set tracing policy to ignore when we create a consumer and we create our own tracer?
I was planning to clean up a bit that code in the next PR and explain why we do that and also "hide" that detail a bit, maybe behind an helper. In short, the reason is both the one you sad, which makes spans looks weird and sometimes even no-sense, and this one: #929
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried, there is not much I can hide, it will look weird anyway... I'll check out what can be done on vertx-kafka-client side to make this look better...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neverthless, I've made a PR to add some comments: #964
* Update reconciler-test dependency * Increase poll.timeout from 4 to 8 minutes Updating the dependency on reconciler-test brought some changes which decreased the default timeout to 2 minutes. However, in CI sometimes the timeout needs to be longer to properly delete resources after test. Setting this explicitly to 8 minutes. * Run make generate-release
Fixes #784
We're still missing eclipse-vertx/vertx-tracing#28, which is blocking us from using the new OpenTelemetry integration. We might also get rid of even more code if eclipse-vertx/vert.x#3903 gets resolved before 4.1
Proposed Changes
Release Note