3. Dropping Spans
3.1 Configuration
Exercise
Switch to your Gateway terminal window and open the gateway.yaml file. Update the processors section with the following configuration:
Add a
filterprocessor:
Configure the gateway to exclude spans with the name/_healthz. Theerror_mode: ignoredirective ensures that any errors encountered during filtering are ignored, allowing the pipeline to continue running smoothly. Thetracessection defines the filtering rules, specifically targeting spans named/_healthzfor exclusion.yamlfilter/health: # Defines a filter processor error_mode: ignore # Ignore errors traces: # Filtering rules for traces span: # Exclude spans named "/_healthz" - 'name == "/_healthz"'Add the
filterprocessor to thetracespipeline:
Include thefilter/healthprocessor in thetracespipeline. For optimal performance, place the filter as early as possible—right after thememory_limiterand before thebatchprocessor. Here’s how the configuration should look:yamltraces: receivers: - otlp processors: - memory_limiter - filter/health # Filters data based on rules - resource/add_mode - batch exporters: - debug - file/traces
This setup ensures that health check related spans (/_healthz) are filtered out early in the pipeline, reducing unnecessary noise in your telemetry data.
