Skip to content
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

Fixing: NullPointerException occurring and it's discarding the records while tracing for Loom deployment #3300

Merged

Conversation

debasishbsws
Copy link
Member

Problem

Current Loom Dispatcher was not working properly and there is no events retrieving on that side.

The Problem we find is that when we are using loom modules the ConsumerTracer (which is using vertx opentelemetry), is a NullPointerException occurring and it's discarding the records.

"stack_trace":"java.lang.NullPointerException": 
Cannot invoke "io.vertx.core.Context.getLocal(Object)" because "vertxCtx" is null
   at io.vertx.tracing.opentelemetry.VertxContextStorageProvider$VertxContextStorage.attach(VertxContextStorageProvider.java:27)
   at io.vertx.tracing.opentelemetry.OpenTelemetryTracer.receiveRequest(OpenTelemetryTracer.java:70)
   at io.vertx.tracing.opentelemetry.OpenTelemetryTracer.receiveRequest(OpenTelemetryTracer.java:31)
   at dev.knative.eventing.kafka.broker.core.tracing.kafka.ConsumerTracer.prepareMessageReceived(ConsumerTracer.java:88)
   at dev.knative.eventing.kafka.broker.dispatcher.impl.RecordDispatcherImpl.getStartedSpan(RecordDispatcherImpl.java:485)

Proposed Changes

As for the Solution we have here is we handle the records inside the current Vertx Context. So that when for the tracing we try to get the currentContext we get the context instead of null

// This needs to be done manually in order to work properly with both ordered and unordered delivery.
Context context = Vertx.currentContext();
final ConsumerTracer.StartedSpan span = getStartedSpan(recordContext, context);

/cc @pierDipi @matzew

Release Note

Signed-off-by: debasishbsws <debasishbsws.dev@gmail.com>
@knative-prow knative-prow bot requested review from matzew and pierDipi August 22, 2023 17:22
@knative-prow knative-prow bot added area/data-plane size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 22, 2023
@debasishbsws debasishbsws changed the title Fixing: NullPointerException occurring and it's discarding the records while tracing. Fixing: NullPointerException occurring and it's discarding the records while tracing for Loom deployment Aug 22, 2023
@Cali0707
Copy link
Member

/cc @Cali0707

@knative-prow knative-prow bot requested a review from Cali0707 August 22, 2023 17:24
@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #3300 (3b92a3b) into main (c6e8f3c) will decrease coverage by 0.01%.
The diff coverage is 44.44%.

@@             Coverage Diff              @@
##               main    #3300      +/-   ##
============================================
- Coverage     61.69%   61.68%   -0.01%     
- Complexity      767      768       +1     
============================================
  Files           182      182              
  Lines         12298    12304       +6     
  Branches        268      268              
============================================
+ Hits           7587     7590       +3     
- Misses         4118     4120       +2     
- Partials        593      594       +1     
Flag Coverage Δ
java-unittests 70.96% <44.44%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...patcher/impl/consumer/OrderedConsumerVerticle.java 67.27% <44.44%> (+0.91%) ⬆️
...tcher/impl/consumer/UnorderedConsumerVerticle.java 67.92% <44.44%> (-4.08%) ⬇️

Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@debasishbsws

/home/prow/go/src/knative.dev/eventing-kafka-broker is out of date. Please run hack/update-codegen.sh

Signed-off-by: debasishbsws <debasishbsws.dev@gmail.com>
@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 22, 2023
Copy link
Contributor

@matzew matzew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

/retest

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2023
@knative-prow
Copy link

knative-prow bot commented Aug 23, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: debasishbsws, matzew

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 23, 2023
@knative-prow knative-prow bot merged commit 8c81822 into knative-extensions:main Aug 23, 2023
29 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/data-plane lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants