Skip to content

Commit

Permalink
Adds config and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
garry-cairns committed Aug 26, 2023
1 parent 835e985 commit dfa0f40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions processor/tailsamplingprocessor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following configuration options are required:
Multiple policies exist today and it is straight forward to add more. These include:
- `always_sample`: Sample all traces
- `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.
- `duration`: Sample based on the *bounded* duration of the trace. Otherwise identical to latency
- `numeric_attribute`: Sample based on number attributes (resource and record)
- `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).
- `status_code`: Sample based upon the status code (`OK`, `ERROR` or `UNSET`)
Expand Down Expand Up @@ -78,6 +79,11 @@ processors:
type: latency,
latency: {threshold_ms: 5000}
},
{
name: test-policy-2a,
type: duration,
latency: {lower_bound_ms: 5000, upper_bound_ms: 10000}
},
{
name: test-policy-3,
type: numeric_attribute,
Expand Down
13 changes: 13 additions & 0 deletions processor/tailsamplingprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const (
AlwaysSample PolicyType = "always_sample"
// Latency sample traces that are longer than a given threshold.
Latency PolicyType = "latency"
// Duration sample traces that are longer than a given threshold.
Duration PolicyType = "duration"
// NumericAttribute sample traces that have a given numeric attribute in a specified
// range, e.g.: attribute "http.status_code" >= 399 and <= 999.
NumericAttribute PolicyType = "numeric_attribute"
Expand Down Expand Up @@ -54,6 +56,8 @@ type sharedPolicyCfg struct {
Type PolicyType `mapstructure:"type"`
// Configs for latency filter sampling policy evaluator.
LatencyCfg LatencyCfg `mapstructure:"latency"`
// Configs for duration filter sampling policy evaluator.
DurationCfg DurationCfg `mapstructure:"duration"`
// Configs for numeric attribute filter sampling policy evaluator.
NumericAttributeCfg NumericAttributeCfg `mapstructure:"numeric_attribute"`
// Configs for probabilistic sampling policy evaluator.
Expand Down Expand Up @@ -130,6 +134,15 @@ type LatencyCfg struct {
ThresholdMs int64 `mapstructure:"threshold_ms"`
}

// DurationCfg holds the configurable settings to create a duration filter sampling policy
// evaluator, which is essentially a latency sampler with two bounds
type DurationCfg struct {
// Lower bound in milliseconds.
LowerDurationMs int64 `mapstructure:"lower_bound_ms"`
// Upper bound in milliseconds.
UpperDurationMs int64 `mapstructure:"upper_bound_ms"`
}

// NumericAttributeCfg holds the configurable settings to create a numeric attribute filter
// sampling policy evaluator.
type NumericAttributeCfg struct {
Expand Down

0 comments on commit dfa0f40

Please sign in to comment.