-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: Removed manipulation for custom traceparent header #37121
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
Changes from all commits
a132f6a
0c7f7fb
62fb259
4b4b6f2
134dcf1
3aeba4a
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 |
|---|---|---|
|
|
@@ -7,5 +7,6 @@ public class MDCConstants { | |
| public static final String THREAD = "thread"; | ||
| public static final String OBSERVATION = "micrometer.observation"; | ||
| public static final String TRACE_ID = "traceId"; | ||
| public static final String TRACE_PARENT = "traceparent"; | ||
|
Contributor
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. 💡 Codebase verification Potential issue with trace context propagation in RTSCaller The
🔗 Analysis chainLGTM! The constant follows W3C trace context specification. The addition of Let's verify the usage of this constant across the codebase: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the usage of TRACE_PARENT constant and any remaining custom traceparent header manipulations
# Test 1: Find all references to the new constant
echo "=== References to TRACE_PARENT constant ==="
rg "TRACE_PARENT" -A 2
# Test 2: Check for any remaining custom traceparent header manipulations
echo -e "\n=== Check for custom traceparent manipulations ==="
rg -i "traceparent.*header" -g '!*.{md,txt}'
Length of output: 1508 Script: #!/bin/bash
# Let's verify if there are any other occurrences of traceparent being used directly as a string
# or any other header manipulations related to trace context
# Check for string literal "traceparent" usage
echo "=== Direct traceparent string usage ==="
rg -i '"traceparent"' --type java --type typescript --type javascript -A 2
# Check for trace context related header manipulations
echo -e "\n=== Trace context header manipulations ==="
rg -i '(trace|span).*header' --type java --type typescript --type javascript -A 2
# Check RTSCaller.java implementation to understand the trace context usage
echo -e "\n=== RTSCaller.java implementation ==="
cat app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/RTSCaller.java
Length of output: 4799 |
||
| public static final String SPAN_ID = "spanId"; | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,16 +3,10 @@ | |
| import io.micrometer.observation.Observation; | ||
| import io.micrometer.observation.ObservationPredicate; | ||
| import io.micrometer.observation.ObservationView; | ||
| import io.micrometer.tracing.Span; | ||
| import io.micrometer.tracing.exporter.SpanExportingPredicate; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.http.server.reactive.observation.ServerRequestObservationContext; | ||
|
|
||
| import static com.appsmith.external.constants.spans.BaseSpan.APPSMITH_SPAN_PREFIX; | ||
| import static com.appsmith.external.constants.spans.BaseSpan.AUTHENTICATE; | ||
| import static com.appsmith.external.constants.spans.BaseSpan.AUTHORIZE; | ||
|
|
||
| /** | ||
| * This configuration file creates beans that are required to filter just Appsmith specific spans | ||
| */ | ||
|
|
@@ -42,19 +36,4 @@ ObservationPredicate noActuatorServerObservations() { | |
| } | ||
| }; | ||
| } | ||
|
|
||
| @Bean | ||
| SpanExportingPredicate onlyAppsmithSpans() { | ||
|
Contributor
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. @nidhi-nair now this has been removed. we will allow all spans? won't there be too many and cause clutter?
Contributor
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. I'd like to see if this is still true post spring upgrade since the DP is not showing as many spans anymore. We can revisit this if we see a spike perhaps? This allows us to fill the gaps in the trace lineage.
Contributor
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. yes makes sense |
||
| return (finishedSpan) -> { | ||
| if ((finishedSpan.getKind() != null && finishedSpan.getKind().equals(Span.Kind.SERVER)) | ||
| || finishedSpan.getName().startsWith(APPSMITH_SPAN_PREFIX) | ||
| || finishedSpan.getName().startsWith(AUTHENTICATE) | ||
| || finishedSpan.getName().startsWith(AUTHORIZE)) { | ||
| // A span is either an http server request root or Appsmith specific or login related or signup related | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } | ||
| }; | ||
| } | ||
| } | ||
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.
🛠️ Refactor suggestion
Consider making the service name configurable.
The hardcoded service name "appsmith-client" is added to observability configuration. While this aligns with standardizing trace propagation, consider making it configurable via environment variables for flexibility in different deployment scenarios.
Apply this diff to make the service name configurable:
Add the corresponding type definition to the INJECTED_CONFIGS interface: