Skip to content

v4.5.1

Choose a tag to compare

@Kydoimos97 Kydoimos97 released this 03 Nov 16:52
· 39 commits to release since this release
52f159f

Thisupdate refactors the logging system to improve compatibility with Datadog by injecting trace and span IDs directly into log records and updating the JSON log format. It introduces a dedicated filter for Datadog trace injection, modernizes the JSON formatter to surface Datadog correlation fields at the top level, and updates the logger to automatically attach the new filter when Datadog tracing is enabled. Tests are updated to validate the new structure.

Datadog Trace Injection & Logging Integration

  • Added a new DatadogTraceInjectionFilter in WrenchCL/_Internal/Logging/DatadogTraceInjectionFilter.py that injects dd.trace_id and dd.span_id fields into every log record, using the Datadog tracer if available.
  • Updated cLogger.py to automatically attach the DatadogTraceInjectionFilter to all handlers when Datadog tracing is enabled, ensuring trace/span IDs are present in logs.

JSON Log Formatter Modernization

  • Refactored JSONLogFormatter in Formatters.py to surface service, env, version, dd.trace_id, and dd.span_id as top-level fields in the JSON output, making logs Datadog-friendly and preserving existing context/exception structure.
  • Improved context extraction logic in the formatter for more robust harvesting of user, organization, and service identifiers from context variables.

Testing Updates

  • Modified tests in test_logger_json_mode.py to assert the presence of top-level Datadog correlation fields (service, version, env, dd.trace_id, dd.span_id) instead of the previous nested structure.