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.
- Significantly reduce collected trace volume by focusing on services that matter most.
Configuration Options
The ServiceNameSampler action is configured using theodigos.io/v1alpha1.Action
CRD with the samplers
configuration section.
actionName
actionName
actionName
string
: A human-readable name for the action.- Optional
- Odigos does not use or assume any meaning from this field
notes
notes
notes
string
: Free-form notes to describe the purpose or intent of this sampler.- Optional
- Odigos does not use or assume any meaning from this field
disabled
disabled
disabled
boolean
: Temporarily disables this sampler without deleting its configuration.- Optional, defaults to
false
signals *
signals *
signals
string[]
: The signal types this action will operate on.- Required
- Only
TRACES
is supported.
samplers *
samplers *
samplers
object
: Configuration for sampling actions.- This field is required for this action type
serviceNameSampler *
serviceNameSampler *
serviceNameSampler
object
: Configuration for the ServiceNameSampler.- This field is required for this action type
services_name_filters *
services_name_filters *
services_name_filters
object[]
: An array of objects representing the filters for the services.- This field is required
service_name *
service_name *
service_name
string
: Specifies the service name to search within the trace (Across all available spans).- This field is required
sampling_ratio *
sampling_ratio *
sampling_ratio
float
: Specifies the sample rate for all traces that contains service_name
.- This field is required
fallback_sampling_ratio *
fallback_sampling_ratio *
fallback_sampling_ratio
float
: Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.- This field is required
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 containcoupon-service
and 0% of all other traces using the new Action CRD:
1
Create a YAML file with the following content:
service-name-sampler.yaml
2
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
advanced-service-name-sampler.yaml