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
filter
processor:
Configure the gateway to exclude spans with the name/_healthz
. Theerror_mode: ignore
directive ensures that any errors encountered during filtering are ignored, allowing the pipeline to continue running smoothly. Thetraces
section defines the filtering rules, specifically targeting spans named/_healthz
for exclusion.filter/health: # Defines a filter processor error_mode: ignore # Ignore errors traces: # Filtering rules for traces span: # Exclude spans named "/_healthz" - 'name == "/_healthz"'
Add the
filter
processor to thetraces
pipeline:
Include thefilter/health
processor in thetraces
pipeline. For optimal performance, place the filter as early as possible—right after thememory_limiter
and before thebatch
processor. Here’s how the configuration should look:traces: 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.