Skip to content

Commit 88ca1b7

Browse files
authored
feat(telemetry): remove redundant headers (#5649)
Remove redundant headers, when Telemetry writer send the metrics to the agent, it attaches those headers before send them to backend. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) are followed. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] PR description includes explicit acknowledgement/acceptance of the performance implications of this PR as reported in the benchmarks PR comment. ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment.
1 parent 44d7895 commit 88ca1b7

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

ddtrace/internal/telemetry/writer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, endpoint):
5959
self._endpoint = endpoint
6060
self._encoder = JSONEncoderV2()
6161
self._headers = {
62-
"Content-type": "application/json",
62+
"Content-Type": "application/json",
6363
"DD-Client-Library-Language": "python",
6464
"DD-Client-Library-Version": _pep440_to_semver(),
6565
}
@@ -96,9 +96,6 @@ def get_headers(self, request):
9696
headers["DD-Telemetry-Debug-Enabled"] = request["debug"]
9797
headers["DD-Telemetry-Request-Type"] = request["request_type"]
9898
headers["DD-Telemetry-API-Version"] = request["api_version"]
99-
headers["DD-Agent-Hostname"] = request["host"]["hostname"]
100-
if config.env:
101-
headers["DD-Agent-Env"] = config.env
10299
return headers
103100

104101

tests/telemetry/test_writer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def test_add_event(telemetry_writer, test_agent_session, mock_time):
3434
assert requests[0]["headers"]["DD-Telemetry-Request-Type"] == payload_type
3535
assert requests[0]["headers"]["DD-Telemetry-API-Version"] == "v1"
3636
assert requests[0]["headers"]["DD-Telemetry-Debug-Enabled"] == "False"
37-
assert requests[0]["headers"]["DD-Agent-Hostname"] == get_host_info()["hostname"]
3837
assert requests[0]["body"] == _get_request_body(payload, payload_type)
3938

4039

0 commit comments

Comments
 (0)