Replies: 2 comments
-
I don't think so. The otel-collector-contrib repo does not seem support filtering spans and I think there is really only a desire to filter entire traces. open-telemetry/opentelemetry-collector#2310 It looks like you'll need a custom span processor. Another option may be, if you're interested, is submitting a PR to redis auto-instrumentation to filter specific queries. I imagine they it would be similar to how the Rack auto-instrumentation filters by path. |
Beta Was this translation helpful? Give feedback.
-
open-telemetry/opentelemetry-collector-contrib#6341 added support for filtering spans, which would be perfect for what you want here. It was approved, but auto-closed as stale before it was merged 😞 . You can filter these spans at source either with a custom span processor, as @arielvalentin suggests, or with a custom sampler. E.g. class DropPingSampler
DROP_IT = OpenTelemetry::SDK::Trace::Samplers::ALWAYS_OFF
def initialize(delegate)
@delegate = delegate
end
def description
'DropPingSampler'
end
def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:)
delegate = if name == 'PING' && attributes&.dig('db.system') == 'redis'
DROP_IT
else
@delegate
end
delegate.should_sample?(trace_id: trace_id, parent_context: parent_context, links: links, name: name, kind: kind, attributes: attributes)
end
end |
Beta Was this translation helpful? Give feedback.
-
Hello,
We are using the ruby opentelemetry gems for ruby
opentelemetry-instrumentation-redis (~> 0.21.1)
We have some PING traces that are a bit noisy. Is there any way to drop or filter these traces out before they are exported by the collector?
Beta Was this translation helpful? Give feedback.
All reactions