Skip to content

Commit dfa0f40

Browse files
committed
Adds config and docs
1 parent 835e985 commit dfa0f40

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

processor/tailsamplingprocessor/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The following configuration options are required:
2929
Multiple policies exist today and it is straight forward to add more. These include:
3030
- `always_sample`: Sample all traces
3131
- `latency`: Sample based on the duration of the trace. The duration is determined by looking at the earliest start time and latest end time, without taking into consideration what happened in between.
32+
- `duration`: Sample based on the *bounded* duration of the trace. Otherwise identical to latency
3233
- `numeric_attribute`: Sample based on number attributes (resource and record)
3334
- `probabilistic`: Sample a percentage of traces. Read [a comparison with the Probabilistic Sampling Processor](#probabilistic-sampling-processor-compared-to-the-tail-sampling-processor-with-the-probabilistic-policy).
3435
- `status_code`: Sample based upon the status code (`OK`, `ERROR` or `UNSET`)
@@ -78,6 +79,11 @@ processors:
7879
type: latency,
7980
latency: {threshold_ms: 5000}
8081
},
82+
{
83+
name: test-policy-2a,
84+
type: duration,
85+
latency: {lower_bound_ms: 5000, upper_bound_ms: 10000}
86+
},
8187
{
8288
name: test-policy-3,
8389
type: numeric_attribute,

processor/tailsamplingprocessor/config.go

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const (
1717
AlwaysSample PolicyType = "always_sample"
1818
// Latency sample traces that are longer than a given threshold.
1919
Latency PolicyType = "latency"
20+
// Duration sample traces that are longer than a given threshold.
21+
Duration PolicyType = "duration"
2022
// NumericAttribute sample traces that have a given numeric attribute in a specified
2123
// range, e.g.: attribute "http.status_code" >= 399 and <= 999.
2224
NumericAttribute PolicyType = "numeric_attribute"
@@ -54,6 +56,8 @@ type sharedPolicyCfg struct {
5456
Type PolicyType `mapstructure:"type"`
5557
// Configs for latency filter sampling policy evaluator.
5658
LatencyCfg LatencyCfg `mapstructure:"latency"`
59+
// Configs for duration filter sampling policy evaluator.
60+
DurationCfg DurationCfg `mapstructure:"duration"`
5761
// Configs for numeric attribute filter sampling policy evaluator.
5862
NumericAttributeCfg NumericAttributeCfg `mapstructure:"numeric_attribute"`
5963
// Configs for probabilistic sampling policy evaluator.
@@ -130,6 +134,15 @@ type LatencyCfg struct {
130134
ThresholdMs int64 `mapstructure:"threshold_ms"`
131135
}
132136

137+
// DurationCfg holds the configurable settings to create a duration filter sampling policy
138+
// evaluator, which is essentially a latency sampler with two bounds
139+
type DurationCfg struct {
140+
// Lower bound in milliseconds.
141+
LowerDurationMs int64 `mapstructure:"lower_bound_ms"`
142+
// Upper bound in milliseconds.
143+
UpperDurationMs int64 `mapstructure:"upper_bound_ms"`
144+
}
145+
133146
// NumericAttributeCfg holds the configurable settings to create a numeric attribute filter
134147
// sampling policy evaluator.
135148
type NumericAttributeCfg struct {

0 commit comments

Comments
 (0)