Service Name Sampler
This action is a Service Action that samples traces based on the presence of specified services within a trace.
This feature is in beta. It may be subject to changes and improvements based on user feedback.
Considerations
Before enabling the Service Name Sampler, please consider the following:
- Only supports traces.
- Sampling is trace-wide: either all spans in a trace are kept, or all are dropped.
- The sampler introduces a delay of up to 30 seconds before traces are exported.
- Traces with durations longer than 30 seconds might not be sampled correctly.
Use Cases
Targeted Trace Collection
- Collect only traces involving specific microservices, such as
auth-service
, for debugging or focused observability.
Cost Reduction
- Significantly reduce collected trace volume by focusing on services that matter most.
Configuration Options
A trace is sampled if it contains at least one span from a service listed in services_name_filters
and passes the sampling_ratio
check. Traces without any listed services may still be sampled based on the corresponding fallback_sampling_ratio
.
Basic Example
This example samples 100% of traces that contain coupon-service
and 0% of all other traces:
Create a YAML file with the following content:
Apply the sampler:
Advanced Example
This example collects:
- 100% of traces with
payment-service
- 50% of traces with
auth-service
- 10% of traces that include neither of the above
This setup ensures you always keep critical traces and still retain a sample of the rest for broader context.