This feature is in beta. It may be subject to changes and improvements based on user feedback.

Considerations

Before enabling latency sampler, please note the following:

  • Supports only traces.
  • Multiple endpoint_filters can be configured within the same action.
  • Adding this action causes a 30-second delay in sending the data.
  • Traces with durations exceeding 30 seconds might not be sampled correctly.

Use Cases

Cost Reduction

  • In large-scale systems, collecting every trace can be expensive. Latency policies allows you to focus on the most critical traces, reducing the overall volume of data sent for analysis. This helps you optimize your costs.

System Optimization

  • Removing short traces allows you to concentrate on the more important and interesting long traces, optimizing your system for efficiency without being overwhelmed by the volume of trace data.

Configuration Options

The duration is determined by looking at the earliest start time and latest end time of a trace. Configuring minimum_latency_threshold for a specified service and http_route will sample any request with a duration exceeding this threshold for that particular service and http_route combination.

Otherwise, the trace will be dropped. It is recommended to still keep a portion of these traces using the fallback_sampling_ratio setting. This allows you to retain a specified percentage of traces that fall below the threshold.

Basic Example

The following example demonstrates how to sample all traces with a latency greater than 1000ms for the frontend service and /buy http route. Additionally, it retains 20% of the traces that fall below the 1000ms threshold.

1

Create a YAML file with the following content:

latency-sampler.yaml
apiVersion: actions.odigos.io/v1alpha1
kind: LatencySampler
metadata:
  name: example-latencysampler
  namespace: odigos-system
spec:
  actionName: "example-latencysampler-action"
  endpoints_filters:
  - service_name: "frontend"
    http_route: "/buy"
    fallback_sampling_ratio: 20
    minimum_latency_threshold: 1000
  signals:
  - TRACES
2

Apply the action to the cluster:

kubectl apply -f latency-sampler.yaml