-
Notifications
You must be signed in to change notification settings - Fork 14
fix: Makes the test agent report version 7.65.0 for client side stats #5823
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3526fd5
fix: Makes the test agent report version 7.65.0 for client side stats
bric3 58d460b
fix: PR Review: parameterize via a second method
bric3 3ceeb74
fix: PR Review: revert trace_stats_computation changes
bric3 561968e
Merge remote-tracking branch 'origin/main' into bdu/use-test-agent-ve…
bric3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ def _human_stats(stats: V06StatsAggr) -> str: | |
| return str(filtered_copy) | ||
|
|
||
|
|
||
| def enable_tracestats(sample_rate: float | None = None) -> pytest.MarkDecorator: | ||
| def enable_tracestats(sample_rate: float | None = None) -> tuple[pytest.MarkDecorator, pytest.MarkDecorator]: | ||
| env = { | ||
| "DD_TRACE_STATS_COMPUTATION_ENABLED": "1", # reference, dotnet, python, golang | ||
| "DD_TRACE_TRACER_METRICS_ENABLED": "true", # java | ||
|
|
@@ -32,20 +32,25 @@ def enable_tracestats(sample_rate: float | None = None) -> pytest.MarkDecorator: | |
| if sample_rate is not None: | ||
| assert 0 <= sample_rate <= 1.0 | ||
| env.update({"DD_TRACE_SAMPLE_RATE": str(sample_rate)}) | ||
| return parametrize("library_env", [env]) | ||
|
|
||
| # Java tracer requires agent version >= 7.65.0 for client-side stats | ||
| agent_env_config = {"TEST_AGENT_VERSION": "7.65.0"} | ||
|
|
||
| return (parametrize("library_env", [env]), parametrize("agent_env", [agent_env_config])) | ||
|
|
||
|
|
||
| @scenarios.parametric | ||
| @features.client_side_stats_supported | ||
| class Test_Library_Tracestats: | ||
| @enable_tracestats() | ||
| @enable_tracestats()[0] | ||
| @enable_tracestats()[1] | ||
| @missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet") | ||
| @missing_feature(context.library == "nodejs", reason="nodejs has not implemented stats computation yet") | ||
| @missing_feature(context.library == "php", reason="php has not implemented stats computation yet") | ||
| @missing_feature(context.library == "ruby", reason="ruby has not implemented stats computation yet") | ||
| @bug(context.library >= "[email protected]", reason="APMSP-2074") | ||
| def test_metrics_msgpack_serialization_TS001( | ||
| self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When spans are finished | ||
| Each trace has stats metrics computed for it serialized properly in msgpack format with required fields | ||
|
|
@@ -94,14 +99,15 @@ def test_metrics_msgpack_serialization_TS001( | |
| for key in ("Hostname", "Env", "Version", "Stats"): | ||
| assert key in decoded_request_body, f"{key} should be in stats request" | ||
|
|
||
| @enable_tracestats() | ||
| @enable_tracestats()[0] | ||
| @enable_tracestats()[1] | ||
| @missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet") | ||
| @missing_feature(context.library == "nodejs", reason="nodejs has not implemented stats computation yet") | ||
| @missing_feature(context.library == "php", reason="php has not implemented stats computation yet") | ||
| @missing_feature(context.library == "ruby", reason="ruby has not implemented stats computation yet") | ||
| @bug(context.library >= "[email protected]", reason="APMSP-2074") | ||
| def test_distinct_aggregationkeys_TS003( | ||
| self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When spans are created with a unique set of dimensions | ||
| Each span has stats computed for it and is in its own bucket | ||
|
|
@@ -182,14 +188,15 @@ def test_distinct_aggregationkeys_TS003( | |
| "There should be seven stats entries in the bucket. There is one baseline entry and 6 that are unique along each of 6 dimensions." | ||
| ) | ||
|
|
||
| @enable_tracestats()[0] | ||
| @enable_tracestats()[1] | ||
| @missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet") | ||
| @missing_feature(context.library == "nodejs", reason="nodejs has not implemented stats computation yet") | ||
| @missing_feature(context.library == "php", reason="php has not implemented stats computation yet") | ||
| @missing_feature(context.library == "ruby", reason="ruby has not implemented stats computation yet") | ||
| @enable_tracestats() | ||
| @bug(context.library >= "[email protected]", reason="APMSP-2074") | ||
| def test_measured_spans_TS004( | ||
| self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When spans are marked as measured | ||
| Each has stats computed for it | ||
|
|
@@ -227,13 +234,16 @@ def test_measured_spans_TS004( | |
| assert op2_stats["Hits"] == 1 | ||
| assert op2_stats["TopLevelHits"] == 0 | ||
|
|
||
| @enable_tracestats()[0] | ||
| @enable_tracestats()[1] | ||
| @missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet") | ||
| @missing_feature(context.library == "nodejs", reason="nodejs has not implemented stats computation yet") | ||
| @missing_feature(context.library == "php", reason="php has not implemented stats computation yet") | ||
| @missing_feature(context.library == "ruby", reason="ruby has not implemented stats computation yet") | ||
| @enable_tracestats() | ||
| @bug(context.library >= "[email protected]", reason="APMSP-2074") | ||
| def test_top_level_TS005(self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary): | ||
| def test_top_level_TS005( | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When top level (service entry) spans are created | ||
| Each top level span has trace stats computed for it. | ||
| """ | ||
|
|
@@ -279,14 +289,15 @@ def test_top_level_TS005(self, library_env: dict[str, str], test_agent: TestAgen | |
| assert web_stats["TopLevelHits"] == 1 | ||
| assert web_stats["Duration"] > 0 | ||
|
|
||
| @enable_tracestats()[0] | ||
| @enable_tracestats()[1] | ||
| @missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet") | ||
| @missing_feature(context.library == "nodejs", reason="nodejs has not implemented stats computation yet") | ||
| @missing_feature(context.library == "php", reason="php has not implemented stats computation yet") | ||
| @missing_feature(context.library == "ruby", reason="ruby has not implemented stats computation yet") | ||
| @enable_tracestats() | ||
| @bug(context.library >= "[email protected]", reason="APMSP-2074") | ||
| def test_successes_errors_recorded_separately_TS006( | ||
| self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When spans are marked as errors | ||
| The errors count is incremented appropriately and the stats are aggregated into the ErrorSummary | ||
|
|
@@ -336,14 +347,17 @@ def test_successes_errors_recorded_separately_TS006( | |
| assert stat["OkSummary"] is not None | ||
| assert stat["ErrorSummary"] is not None | ||
|
|
||
| @enable_tracestats(sample_rate=0.0)[0] | ||
| @enable_tracestats(sample_rate=0.0)[1] | ||
| @missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet") | ||
| @missing_feature(context.library == "java", reason="FIXME: Undefined behavior according the java tracer core team") | ||
| @missing_feature(context.library == "nodejs", reason="nodejs has not implemented stats computation yet") | ||
| @missing_feature(context.library == "php", reason="php has not implemented stats computation yet") | ||
| @missing_feature(context.library == "ruby", reason="ruby has not implemented stats computation yet") | ||
| @enable_tracestats(sample_rate=0.0) | ||
| @bug(context.library >= "[email protected]", reason="APMSP-2074") | ||
| def test_sample_rate_0_TS007(self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary): | ||
| def test_sample_rate_0_TS007( | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When the sample rate is 0 and trace stats is enabled | ||
| non-P0 traces should be dropped | ||
| trace stats should be produced | ||
|
|
@@ -363,10 +377,11 @@ def test_sample_rate_0_TS007(self, library_env: dict[str, str], test_agent: Test | |
| assert web_stats["TopLevelHits"] == 1 | ||
| assert web_stats["Hits"] == 1 | ||
|
|
||
| @enable_tracestats()[0] | ||
| @enable_tracestats()[1] | ||
| @missing_feature(reason="relative error test is broken") | ||
| @enable_tracestats() | ||
| def test_relative_error_TS008( | ||
| self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When trace stats are computed for traces | ||
| The stats should be accurate to within 1% of the real values | ||
|
|
@@ -410,14 +425,15 @@ def test_relative_error_TS008( | |
| rel=0.01, | ||
| ), f"Quantile mismatch for quantile {quantile!r}" | ||
|
|
||
| @enable_tracestats()[0] | ||
| @enable_tracestats()[1] | ||
| @missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet") | ||
| @missing_feature(context.library == "nodejs", reason="nodejs has not implemented stats computation yet") | ||
| @missing_feature(context.library == "php", reason="php has not implemented stats computation yet") | ||
| @missing_feature(context.library == "ruby", reason="ruby has not implemented stats computation yet") | ||
| @enable_tracestats() | ||
| @bug(context.library >= "[email protected]", reason="APMSP-2074") | ||
| def test_metrics_computed_after_span_finsh_TS009( | ||
| self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| self, library_env: dict[str, str], agent_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary | ||
| ): | ||
| """When trace stats are computed for traces | ||
| Metrics must be computed after spans are finished, otherwise components of the aggregation key may change after | ||
|
|
||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.