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:

1

Create a YAML file with the following content:

service-name-sampler.yaml
apiVersion: actions.odigos.io/v1alpha1
kind: ServiceNameSampler
metadata:
  name: coupon-service-sampler
  namespace: odigos-system
spec:
  actionName: "coupon-sampler"
  signals:
    - TRACES
  services_name_filters:
    - service_name: coupon-service
      sampling_ratio: 100
      fallback_sampling_ratio: 0
2

Apply the sampler:

kubectl apply -f service-name-sampler.yaml

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
apiVersion: actions.odigos.io/v1alpha1
kind: ServiceNameSampler
metadata:
  name: multi-service-sampler
  namespace: odigos-system
spec:
  actionName: "multi-service-focus"
  signals:
    - TRACES
  services_name_filters:
    - service_name: payment-service
      sampling_ratio: 100
      fallback_sampling_ratio: 10
    - service_name: auth-service
      sampling_ratio: 50
      fallback_sampling_ratio: 10

This setup ensures you always keep critical traces and still retain a sample of the rest for broader context.