Skip to content

Commit

Permalink
Integration Exception Tracking
Browse files Browse the repository at this point in the history
Add count
  • Loading branch information
ygree committed Jan 6, 2025
1 parent c409143 commit 1a2ac4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ddtrace/internal/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def _report_telemetry_log(self, record):
# TODO redact absolute file paths and unknown packages
if record.levelno >= logging.ERROR or stack_trace is not None:
# Report only an error or an exception with a stack trace
telemetry.telemetry_writer.add_log(level, record.msg, tags=tags, stack_trace=stack_trace)
telemetry.telemetry_writer.add_log(level, record.msg, tags=tags, stack_trace=stack_trace, count=key_bucket.skipped + 1)


class _TelemetryConfig:
Expand Down
6 changes: 4 additions & 2 deletions ddtrace/internal/telemetry/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ def add_configurations(self, configuration_list):
"value": value,
}

def add_log(self, level, message, stack_trace="", tags=None):
# type: (TELEMETRY_LOG_LEVEL, str, str, Optional[Dict]) -> None
def add_log(self, level, message, stack_trace="", tags=None, count=1):
# type: (TELEMETRY_LOG_LEVEL, str, str, Optional[Dict], int) -> None
"""
Queues log. This event is meant to send library logs to Datadog’s backend through the Telemetry intake.
This will make support cycles easier and ensure we know about potentially silent issues in libraries.
Expand All @@ -499,6 +499,8 @@ def add_log(self, level, message, stack_trace="", tags=None):
data["tags"] = ",".join(["%s:%s" % (k, str(v).lower()) for k, v in tags.items()])
if stack_trace:
data["stack_trace"] = stack_trace
if count > 1:
data["count"] = count
self._logs.add(data)

def add_gauge_metric(self, namespace, name, value, tags=None):
Expand Down

0 comments on commit 1a2ac4f

Please sign in to comment.