-
Notifications
You must be signed in to change notification settings - Fork 16
fix(rc): improve trace sampling rules parsing #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,4 +184,41 @@ CONFIG_MANAGER_TEST("remote configuration handling") { | |
| const auto reverted_tracing_status = config_manager.report_traces(); | ||
| CHECK(old_tracing_status == reverted_tracing_status); | ||
| } | ||
|
|
||
| SECTION("handling of `tracing_sampling_rules`") { | ||
| SECTION("valid input") { | ||
| config_update.content = R"({ | ||
| "lib_config": { | ||
| "library_language": "all", | ||
| "library_version": "latest", | ||
| "service_name": "testsvc", | ||
| "env": "test", | ||
| "tracing_sampling_rules": [ | ||
| { | ||
| "service": "foo", | ||
| "resource": "GET /hello", | ||
| "sample_rate": 0.1, | ||
| "provenance": "customer", | ||
| "name": "test", | ||
| "tags": [ | ||
| { "key": "tag1", "value_glob": "value1" } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "service_target": { | ||
| "service": "testsvc", | ||
| "env": "test" | ||
| } | ||
| })"; | ||
|
|
||
| const auto old_sampler_cfg = | ||
| config_manager.trace_sampler()->config_json(); | ||
| const auto err = config_manager.on_update(config_update); | ||
| const auto new_sampler_cfg = | ||
| config_manager.trace_sampler()->config_json(); | ||
|
Comment on lines
+215
to
+219
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we check that the right values have been set as well ? Currently if an error happened, it might tell that old_sampler_cfg != new_sampler_cfg but maybe the values are not the right ones
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is your question related to the trace sampler values? If so,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may not understand everything clearly but from my understanding it is not because there was a change that the right values were set
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding from your take is that, it would be preferable to check the rules in the JSON payload are equals to the rules in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we can check that there is indeed a rule for the resource get /hello with the right value/tags, it ensures the correctness of the apply. That may be what you are doing in #234 though
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Currently we are not validating the correctness because the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, perfect. Ping me if you need an additional hand. |
||
|
|
||
| CHECK(old_sampler_cfg != new_sampler_cfg); | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: as we specify for property it might be easier to read to specify here as well