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

fix(telemetry): don't include metric events in spans #5649

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changesets/fix_bnjjj_filter_metric_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Don't include metric events in spans ([PR #5649](https://github.com/apollographql/router/pull/5649))

Previously some internal metric events were included in traces and spans. This PR remove this noise.

By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/5649
5 changes: 5 additions & 0 deletions apollo-router/src/plugins/telemetry/otel/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use crate::plugins::telemetry::consts::OTEL_STATUS_CODE;
use crate::plugins::telemetry::consts::OTEL_STATUS_MESSAGE;
use crate::plugins::telemetry::consts::REQUEST_SPAN_NAME;
use crate::plugins::telemetry::consts::ROUTER_SPAN_NAME;
use crate::plugins::telemetry::formatters::filter_metric_events;
use crate::plugins::telemetry::reload::IsSampled;
use crate::plugins::telemetry::reload::SampledSpan;
use crate::plugins::telemetry::reload::SPAN_SAMPLING_RATE;
Expand Down Expand Up @@ -960,6 +961,10 @@ where
/// [`ERROR`]: tracing::Level::ERROR
/// [`Error`]: opentelemetry::trace::StatusCode::Error
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>) {
// Don't include deprecated metric events
if !filter_metric_events(event) {
return;
}
// Ignore events that are not in the context of a span
if let Some(span) = ctx.lookup_current() {
let mut extensions = span.extensions_mut();
Expand Down
Loading