-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2980 from DataDog/zach.montoya/config-error-statu…
…ses/apmapi-349 [Tracing] Add feature/scenarios for tracing configuration consistency and implement tests for DD_TRACE_HTTP_SERVER_ERROR_STATUSES
- Loading branch information
Showing
14 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Unless explicitly stated otherwise all files in this repository are licensed under the the Apache License Version 2.0. | ||
# This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
# Copyright 2022 Datadog, Inc. | ||
|
||
from utils import weblog, interfaces, scenarios, features | ||
|
||
|
||
@scenarios.default | ||
@features.tracing_configuration_consistency | ||
class Test_Config_HttpServerErrorStatuses_Default: | ||
""" Verify behavior of http clients and distributed traces """ | ||
|
||
def setup_status_code_400(self): | ||
self.r = weblog.get("/status?code=400") | ||
|
||
def test_status_code_400(self): | ||
|
||
assert self.r.status_code == 400 | ||
|
||
interfaces.library.assert_trace_exists(self.r) | ||
spans = interfaces.agent.get_spans_list(self.r) | ||
assert len(spans) == 1, "Agent received the incorrect amount of spans" | ||
|
||
assert spans[0]["type"] == "web" | ||
assert spans[0]["meta"]["http.status_code"] == "400" | ||
assert "error" not in spans[0] or spans[0]["error"] == 0 | ||
|
||
def setup_status_code_500(self): | ||
self.r = weblog.get("/status?code=500") | ||
|
||
def test_status_code_500(self): | ||
assert self.r.status_code == 500 | ||
|
||
interfaces.library.assert_trace_exists(self.r) | ||
spans = interfaces.agent.get_spans_list(self.r) | ||
assert len(spans) == 1, "Agent received the incorrect amount of spans" | ||
|
||
assert spans[0]["meta"]["http.status_code"] == "500" | ||
assert spans[0]["error"] == 1 | ||
|
||
|
||
@scenarios.tracing_config_nondefault | ||
@features.tracing_configuration_consistency | ||
class Test_Config_HttpServerErrorStatuses_FeatureFlagCustom: | ||
""" Verify behavior of http clients and distributed traces """ | ||
|
||
def setup_status_code_200(self): | ||
self.r = weblog.get("/status?code=200") | ||
|
||
def test_status_code_200(self): | ||
assert self.r.status_code == 200 | ||
|
||
interfaces.library.assert_trace_exists(self.r) | ||
spans = interfaces.agent.get_spans_list(self.r) | ||
assert len(spans) == 1, "Agent received the incorrect amount of spans" | ||
|
||
assert spans[0]["type"] == "web" | ||
assert spans[0]["meta"]["http.status_code"] == "200" | ||
assert spans[0]["error"] == 1 | ||
|
||
def setup_status_code_202(self): | ||
self.r = weblog.get("/status?code=202") | ||
|
||
def test_status_code_202(self): | ||
assert self.r.status_code == 202 | ||
|
||
interfaces.library.assert_trace_exists(self.r) | ||
spans = interfaces.agent.get_spans_list(self.r) | ||
assert len(spans) == 1, "Agent received the incorrect amount of spans" | ||
|
||
assert spans[0]["type"] == "web" | ||
assert spans[0]["meta"]["http.status_code"] == "202" | ||
assert spans[0]["error"] == 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