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

adding warning to XRay extractor when traceId/spanId missing #4420

Merged
merged 2 commits into from May 5, 2022
Merged

adding warning to XRay extractor when traceId/spanId missing #4420

merged 2 commits into from May 5, 2022

Conversation

ghost
Copy link

@ghost ghost commented Apr 27, 2022

As agreed, fixes #4259

@codecov
Copy link

codecov bot commented Apr 27, 2022

Codecov Report

Merging #4420 (7d21a93) into main (626daa1) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               main    #4420      +/-   ##
============================================
- Coverage     90.01%   89.99%   -0.03%     
- Complexity     4846     4887      +41     
============================================
  Files           557      563       +6     
  Lines         15047    15164     +117     
  Branches       1451     1460       +9     
============================================
+ Hits          13545    13647     +102     
- Misses         1033     1045      +12     
- Partials        469      472       +3     
Impacted Files Coverage Δ
...opentelemetry/extension/aws/AwsXrayPropagator.java 91.36% <0.00%> (-1.34%) ⬇️
...entelemetry/exporter/jaeger/PostSpansResponse.java 0.00% <0.00%> (-100.00%) ⬇️
...exporter/jaeger/MarshalerCollectorServiceGrpc.java 85.71% <0.00%> (-4.77%) ⬇️
...ension/trace/jaeger/sampler/OkHttpGrpcService.java 75.30% <0.00%> (-3.71%) ⬇️
.../opentelemetry/exporter/prometheus/Serializer.java 86.01% <0.00%> (-0.43%) ⬇️
...ry/sdk/trace/internal/data/ExceptionEventData.java 100.00% <0.00%> (ø)
...etry/sdk/testing/assertj/HistogramPointAssert.java 85.18% <0.00%> (ø)
...emetry/sdk/testing/assertj/SummaryPointAssert.java 100.00% <0.00%> (ø)
...try/sdk/testing/assertj/ValueAtQuantileAssert.java 100.00% <0.00%> (ø)
...entelemetry/sdk/testing/assertj/LongSumAssert.java 100.00% <0.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 626daa1...7d21a93. Read the comment docs.

@@ -228,6 +228,10 @@ private static <C> Context getContextFromHeader(
return context;
}

if (spanId == null || traceId == null) {
logger.warning("Both traceId and spanId are required to extract a valid span context. ");
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems like it might spam the logs under some circumstances. Perhaps even the normal circumstances if you're running in the environment where this would happen at all. We should definitely not spam the logs in the hot path of people's code.

Copy link
Author

Choose a reason for hiding this comment

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

This is to address #4259 issue.

TLDR: currently users are creating issues expecting that traceId is sufficient (as per XRay behaviour) to createe otel context, which isn't the case. To avoid further confusion, the idea was to add this log warning. Do you have sth better in mind? Perhaps not warning but info level?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This log message will happen for every request from ELB unfortunately, and with no recourse since ELB actually needs to be updated. ThrottlingLogger may actually be good in addition to a lower log level, but do think we need to not log by default for something with no actionable item.

Copy link
Contributor

Choose a reason for hiding this comment

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

The existing implementation is in the SDK, so not available to propagator implementations. We'd need to put that into some part of the API, which is possible, but I'm not sure where it would live, exactly.

Copy link
Author

Choose a reason for hiding this comment

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

Switched to FINEST as suggested by @anuraaga
Whole change is really only for end user's convenience, so I believe FINEST is a good solution here.

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Let's use FINEST log for this - we generally don't enable logs by default when the app has no practical fix, eg since it doesn't have control over what header is sent. In this case since AWS is sending the header there is literally nothing a user can do so even FINE is too high IMO

@ghost ghost requested review from anuraaga and jkwatson May 5, 2022 08:04
@jkwatson jkwatson merged commit 57c858f into open-telemetry:main May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AwsXrayPropagator fails to extract SpanId for actual HTTP header
4 participants