Skip to content

Commit 8ef14a9

Browse files
def-claude
andauthored
ore: fix OpenTelemetryRateLimitingFilter suppressing every event (#36227)
The filter's `should_log` ran in both `Filter::enabled` and `Filter::event_enabled`. tracing-subscriber calls both per event for a per-layer filter: the first call inserted the callsite into `last_logged`, the second saw it within the backoff window and returned false — so every OpenTelemetry internal log was dropped, including the first. Make `enabled` non-mutating and keep the rate-limit decision in `event_enabled`. Introduced in #34850 (commit 6e16efb "rate limit opentelemetry internal logs"). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 92730d3 commit 8ef14a9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/ore/src/tracing.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,17 @@ impl<S> tracing_subscriber::layer::Filter<S> for OpenTelemetryRateLimitingFilter
865865
where
866866
S: tracing::Subscriber + for<'lookup> LookupSpan<'lookup>,
867867
{
868+
// NB: `enabled` must stay non-mutating. tracing-subscriber calls both `enabled`
869+
// and then `event_enabled` for every event; if `should_log` ran in both, the
870+
// first call would insert the callsite into `last_logged` and the second would
871+
// see it within the backoff window and suppress — dropping every OpenTelemetry
872+
// event, including the first.
868873
fn enabled(
869874
&self,
870-
metadata: &tracing::Metadata<'_>,
875+
_metadata: &tracing::Metadata<'_>,
871876
_ctx: &tracing_subscriber::layer::Context<'_, S>,
872877
) -> bool {
873-
self.should_log(metadata)
878+
true
874879
}
875880

876881
fn event_enabled(

0 commit comments

Comments
 (0)