forked from jaegertracing/jaeger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sampling] Fix merging of per-operation strategies into service strat…
…egies without them (jaegertracing#5277) ## Which problem is this PR solving? - Part 1 of [jaegertracing#5270] ## Description of the changes - See issue for description of the bug and of the two changed behaviors - Default `probabilistic` operation level strategies will now be returned if service strategy is of `ratelimiting` type - If the service itself has `probabilistic` strategy, its sampling rate takes priority for operation-level definition ## How was this change tested? - Via updated unit test - By building local all-in-one executable and using it as a otel instrumentation backend for simple java service https://github.com/kuujis/opentelemetry-java-5504 and using the below `sampling_strategies.json` from open-telemetry/opentelemetry-java#5504 ``` { "service_strategies": [ { "service": "foobar", "type": "ratelimiting", "param": 2 } ], "default_strategy": { "type": "probabilistic", "param": 0.2, "operation_strategies": [ { "operation": "metrics", "type": "probabilistic", "param": 0.0 } ] } } ``` ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com> Signed-off-by: Yuri Shkuro <github@ysh.us> Co-authored-by: Yuri Shkuro <github@ysh.us> Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
- Loading branch information
1 parent
7f99a88
commit a72dfc3
Showing
8 changed files
with
303 additions
and
123 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...store/static/fixtures/TestServiceNoPerOperationStrategiesDeprecatedBehavior_ServiceA.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"probabilisticSampling": { | ||
"samplingRate": 1 | ||
}, | ||
"operationSampling": { | ||
"defaultSamplingProbability": 1, | ||
"perOperationStrategies": [ | ||
{ | ||
"operation": "/health", | ||
"probabilisticSampling": { | ||
"samplingRate": 0.1 | ||
} | ||
} | ||
] | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...store/static/fixtures/TestServiceNoPerOperationStrategiesDeprecatedBehavior_ServiceB.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"strategyType": 1, | ||
"rateLimitingSampling": { | ||
"maxTracesPerSecond": 3 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.../sampling/strategystore/static/fixtures/TestServiceNoPerOperationStrategies_ServiceA.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"probabilisticSampling": { | ||
"samplingRate": 1 | ||
}, | ||
"operationSampling": { | ||
"defaultSamplingProbability": 1, | ||
"perOperationStrategies": [ | ||
{ | ||
"operation": "/health", | ||
"probabilisticSampling": { | ||
"samplingRate": 0.1 | ||
} | ||
} | ||
] | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
.../sampling/strategystore/static/fixtures/TestServiceNoPerOperationStrategies_ServiceB.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"strategyType": 1, | ||
"rateLimitingSampling": { | ||
"maxTracesPerSecond": 3 | ||
}, | ||
"operationSampling": { | ||
"defaultSamplingProbability": 0.2, | ||
"perOperationStrategies": [ | ||
{ | ||
"operation": "/health", | ||
"probabilisticSampling": { | ||
"samplingRate": 0.1 | ||
} | ||
} | ||
] | ||
} | ||
} |
50 changes: 25 additions & 25 deletions
50
plugin/sampling/strategystore/static/fixtures/service_no_per_operation.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
{ | ||
"service_strategies": [ | ||
{ | ||
"service": "ServiceA", | ||
"type": "probabilistic", | ||
"param": 1.0 | ||
}, | ||
{ | ||
"service": "ServiceB", | ||
"type": "ratelimiting", | ||
"param": 3 | ||
} | ||
], | ||
"default_strategy": { | ||
"type": "probabilistic", | ||
"param": 0.2, | ||
"operation_strategies": [ | ||
{ | ||
"operation": "/health", | ||
"type": "probabilistic", | ||
"param": 0.0 | ||
} | ||
] | ||
} | ||
} | ||
{ | ||
"service_strategies": [ | ||
{ | ||
"service": "ServiceA", | ||
"type": "probabilistic", | ||
"param": 1.0 | ||
}, | ||
{ | ||
"service": "ServiceB", | ||
"type": "ratelimiting", | ||
"param": 3 | ||
} | ||
], | ||
"default_strategy": { | ||
"type": "probabilistic", | ||
"param": 0.2, | ||
"operation_strategies": [ | ||
{ | ||
"operation": "/health", | ||
"type": "probabilistic", | ||
"param": 0.1 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.