Considerations
Configuration Options
fractionToKeep
fractionToKeep
fractionToKeep
float : Controls what fraction of traces should be kept when none of the head sampling rules evaluate to true.- This field is optional, and defaults to
1(all traces are kept) - Valid range:
0to1(inclusive) 0means no traces will be recorded unless they matched a specific rule to keep1(default) means all traces will be recorded- Values between
0and1will sample that fraction of traces (e.g.,0.1keeps 10% of traces)
If
fractionToKeep is not specified, it defaults to 1, meaning all traces will be recorded unless they match a specific head sampling rule (like health checks).Basic Example
The following example demonstrates how to configure a fallback fraction to sample 10% of traces that don’t match any specific head sampling rules.1
Create a YAML file with the following content:
head-sampling-fallback.yaml
2
Apply the rule to the cluster:
Example: Apply to a Single Workload
The following example demonstrates how to apply the fallback fraction rule to a specific workload:head-sampling-fallback-workload.yaml
- Apply the fallback fraction rule only to specifc Deployment by it’s name and namespace
- Keep only 10% of traces that don’t match any specific head sampling rules for this workload
Notes
- This feature is currently supported in agents that support head sampling:
nodejs-communityandnodejs-enterprise. - When multiple rules specify
headSamplingFallbackFraction, the maximum value is used. - The fallback fraction only applies to traces that don’t match any specific head sampling rules (like health check rules).