Skip to content

Commit

Permalink
Merge branch '2.19' into backport-11460-to-2.19
Browse files Browse the repository at this point in the history
  • Loading branch information
taegyunkim authored Jan 10, 2025
2 parents 5b8da6a + 8d79908 commit 1df7aae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions ddtrace/internal/telemetry/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,17 @@ def send_event(self, request: Dict) -> Optional[httplib.HTTPResponse]:
conn.request("POST", self._endpoint, rb_json, headers)
resp = get_connection_response(conn)
if resp.status < 300:
log.debug("sent %d in %.5fs to %s. response: %s", len(rb_json), sw.elapsed(), self.url, resp.status)
log.debug(
"Instrumentation Telemetry sent %d in %.5fs to %s. response: %s",
len(rb_json),
sw.elapsed(),
self.url,
resp.status,
)
else:
log.debug("failed to send telemetry to %s. response: %s", self.url, resp.status)
except Exception:
log.debug("failed to send telemetry to %s.", self.url, exc_info=True)
log.debug("Failed to send Instrumentation Telemetry to %s. response: %s", self.url, resp.status)
except Exception as e:
log.debug("Failed to send Instrumentation Telemetry to %s. Error: %s", self.url, str(e))
finally:
if conn is not None:
conn.close()
Expand Down
2 changes: 1 addition & 1 deletion tests/telemetry/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ def test_send_failing_request(mock_status, telemetry_writer):
telemetry_writer.periodic(force_flush=True)
# asserts unsuccessful status code was logged
log.debug.assert_called_with(
"failed to send telemetry to %s. response: %s",
"Failed to send Instrumentation Telemetry to %s. response: %s",
telemetry_writer._client.url,
mock_status,
)
Expand Down

0 comments on commit 1df7aae

Please sign in to comment.