Skip to content

Commit c7cd090

Browse files
authored
chore(telemetry): telemetry error logs are now constant (#13781)
The current goal is to limit at maximum the risk of sending any PII into telemetry. A proposition will soon be done to be able to send custom messages while still ensuring safety. In the meantime, only constant messages will be sent to telemetry. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent 4eccbc9 commit c7cd090

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

ddtrace/internal/telemetry/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ def emit(self, record: logging.LogRecord) -> None:
1616
if record.levelno >= logging.ERROR:
1717
# Capture start up errors
1818
full_file_name = os.path.join(record.pathname, record.filename)
19-
self.telemetry_writer.add_error(1, record.msg % record.args, full_file_name, record.lineno)
19+
self.telemetry_writer.add_error(1, record.msg, full_file_name, record.lineno)

tests/telemetry/test_telemetry.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,10 @@ def process_trace(self, trace):
176176
assert app_started_events[0]["payload"]["error"]["code"] == 1
177177
assert (
178178
"error applying processor <__main__.FailingFilture object at"
179-
in app_started_events[0]["payload"]["error"]["message"]
180-
)
181-
pattern = re.compile(
182-
".*ddtrace/_trace/processor/__init__.py/__init__.py:[0-9]+: "
183-
"error applying processor <__main__.FailingFilture object at 0x[0-9a-f]+>"
179+
not in app_started_events[0]["payload"]["error"]["message"]
184180
)
181+
assert "error applying processor %r" in app_started_events[0]["payload"]["error"]["message"]
182+
pattern = re.compile(".*ddtrace/_trace/processor/__init__.py/__init__.py:[0-9]+: " "error applying processor %r")
185183
assert pattern.match(app_started_events[0]["payload"]["error"]["message"]), app_started_events[0]["payload"][
186184
"error"
187185
]["message"]

0 commit comments

Comments
 (0)