-
-
Notifications
You must be signed in to change notification settings - Fork 469
Add HTTP server request headers from OpenTelemetry span attributes to sentry request in payload
#4102
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
Add HTTP server request headers from OpenTelemetry span attributes to sentry request in payload
#4102
Changes from 19 commits
8ef3825
d3cab7c
7c51a68
9a183ab
ecd6040
6e0b24d
3f10e3c
28cb76a
28a7e56
c59f801
0f77ec2
66d3b7b
0d96359
ba2cbb0
1d89f04
e1f7fec
d698a14
12aca6b
90fb3d9
3233b3c
00d488d
badf8ba
8bc3f0b
b2fef65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,9 @@ public final class SentrySpanExporter implements SpanExporter { | |
| InternalSemanticAttributes.PARENT_SAMPLED.getKey(), | ||
| ProcessIncubatingAttributes.PROCESS_COMMAND_ARGS.getKey() // can be very long | ||
| ); | ||
|
|
||
| private final @NotNull List<String> attributeToRemoveByPrefix = | ||
| Arrays.asList("http.request.header."); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we add response headers here as well?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this mean that they would get removed and not sent to Sentry?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default there's no response headers being sent with OTel but they can be enabled via OTel config. Until now, if enabled we send them. The same was true for request headers which we now filter out in this PR. This does however not affect other things like Sentry integrations sending headers or attributes we extracted into special places like
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha, thanks. If we filter the request headers due to Sentry's PII policies, then I'd say we should probably filter response headers by default as well. |
||
| private static final @NotNull Long SPAN_TIMEOUT = DateUtils.secondsToNanos(5 * 60); | ||
|
|
||
| public static final String TRACE_ORIGIN = "auto.opentelemetry"; | ||
|
|
@@ -338,7 +341,8 @@ private void transferSpanDetails( | |
| transferSpanDetails(sentrySpanMaybe, sentryTransaction); | ||
|
|
||
| scopesToUse.configureScope( | ||
| ScopeType.CURRENT, scope -> attributesExtractor.extract(span, sentryTransaction, scope)); | ||
| ScopeType.CURRENT, | ||
| scope -> attributesExtractor.extract(span, scope, scopesToUse.getOptions())); | ||
|
|
||
| return sentryTransaction; | ||
| } | ||
|
|
@@ -488,7 +492,17 @@ private SpanStatus mapOtelStatus( | |
| } | ||
|
|
||
| private boolean shouldRemoveAttribute(final @NotNull String key) { | ||
| return attributeKeysToRemove.contains(key); | ||
| if (attributeKeysToRemove.contains(key)) { | ||
| return true; | ||
| } | ||
|
|
||
| for (String prefix : attributeToRemoveByPrefix) { | ||
| if (key.startsWith(prefix)) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| private void setOtelInstrumentationInfo( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.