chore(tracing): Use upstream tracing batch exporter#4279
Open
Conversation
6f4dcae to
432f06b
Compare
0a11e90 to
dd0d5d9
Compare
The proxy used its own custom trace exporter for some time. It was built before the upstream OpenTelemetry libraries were available, and they have outlived their usefulness. This replaces the custom exporter with a batch exporter configured to export to the same endpoint with the same service configuration. In the future, this exporter can be installed as a global default trace processor, which would decouple it from the service layer where the proxy generates spans for requests. Signed-off-by: Scott Fleener <scott@buoyant.io>
208b6b9 to
2708010
Compare
unleashed
reviewed
Nov 19, 2025
| let resource = sdk::Resource::builder() | ||
| .with_attribute(KeyValue::new( | ||
| semconv::attribute::PROCESS_PID, | ||
| std::process::id() as i64, |
Member
There was a problem hiding this comment.
Unlikely to happen anytime soon, but easy to future-proof potential pid space growth.
Suggested change
| std::process::id() as i64, | |
| i64::from(std::process::id()), |
Comment on lines
+53
to
+54
| .with_max_queue_size(1000) | ||
| .with_scheduled_delay(Duration::from_secs(5)) |
Member
There was a problem hiding this comment.
Should these hardcoded numbers be defined as constants?
Comment on lines
+231
to
+246
| resource_span_resource | ||
| .attributes | ||
| .iter() | ||
| .any(|attr| attr.key == "telemetry.sdk.name"); | ||
| resource_span_resource | ||
| .attributes | ||
| .iter() | ||
| .any(|attr| attr.key == "telemetry.sdk.version"); | ||
| resource_span_resource | ||
| .attributes | ||
| .iter() | ||
| .any(|attr| attr.key == "telemetry.sdk.language"); | ||
| resource_span_resource | ||
| .attributes | ||
| .iter() | ||
| .any(|attr| attr.key == "service.name"); |
Member
There was a problem hiding this comment.
These are not asserting anything?
Member
There was a problem hiding this comment.
presumably we'll want something like this? (only one assertion is added below, but we'd want the the same for the other three.)
Suggested change
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "telemetry.sdk.name"); | |
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "telemetry.sdk.version"); | |
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "telemetry.sdk.language"); | |
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "service.name"); | |
| assert!( | |
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "telemetry.sdk.name") | |
| .is_some() | |
| ); | |
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "telemetry.sdk.version"); | |
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "telemetry.sdk.language"); | |
| resource_span_resource | |
| .attributes | |
| .iter() | |
| .any(|attr| attr.key == "service.name"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The proxy used its own custom trace exporter for some time. It was built before the upstream OpenTelemetry libraries were available, and they have outlived their usefulness.
This replaces the custom exporter with a batch exporter configured to export to the same endpoint with the same service configuration.
In the future, this exporter can be installed as a global default trace processor, which would decouple it from the service layer where the proxy generates spans for requests.