This project embeds a simple extension in the opentelemetry javaagent that will drop spans based on the env variable OTEL_DROP_SPANS
.
Add the OTEL_DROP_SPANS
env variable and set the spans to drop using the ,
as a separator
Simply download the latest version instead of the javaagent, and you are good to go.
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: my-instrumentation
spec:
java:
env:
# Will drop spans towards health and metrics endpoints
- name: OTEL_DROP_SPANS
value: .*/health,.*/metrics
image: ghcr.io/vmaleze/opentelemetry-java-ignore-spans:2.8.0
- Extension version => 2.8.0
- OpenTelemetry java agent => 2.8.0
- OpenTelemetry SDK => 1.42.1