Skip to content

feat(traceloop-sdk): harden LoggerWrapper + add SpanPostprocessCallbackProcessor - #8

Closed
sayonfortify wants to merge 1 commit into
fr-v0.52.6.xfrom
feat/logging-correlation-vendor
Closed

feat(traceloop-sdk): harden LoggerWrapper + add SpanPostprocessCallbackProcessor#8
sayonfortify wants to merge 1 commit into
fr-v0.52.6.xfrom
feat/logging-correlation-vendor

Conversation

@sayonfortify

Copy link
Copy Markdown

…essor

  • I have added tests that cover my changes.
  • If adding a new instrumentation or changing an existing one, I've added screenshots from some observability platform showing the change. (N/A — not a new instrumentation)
  • PR name follows conventional commits format: feat(instrumentation): ... or fix(instrumentation): ....
  • (If applicable) I have updated the documentation accordingly.

Changes

traceloop/sdk/logging/logging.py

  • Replace destructive logging.basicConfig() with non-destructive _attach_root_logging_handler() — preserves existing app logging handlers/levels
  • Add LoggingInstrumentor idempotency guard (is_instrumented_by_opentelemetry)
  • Add get_logging_provider() class method on LoggerWrapper
  • Add is_fortifyroot_logging_handler() helper for marker-based handler cleanup

traceloop/sdk/tracing/tracing.py

  • Replace monkey-patching on_end with proper _SpanPostprocessCallbackProcessor (implements SpanProcessor)
  • Wire callback processor via add_span_processor() in all 3 init paths (list, single, default)

Why

These changes enable reliable span-end hooks for synthetic log emission in the FortifyRoot SDK, without breaking existing app logging configurations.

Testing

Tests are in fortifyroot-sdk-py (consumer repo) — validated with 262 passing tests + live Postman API verification.

@sayonfortify
sayonfortify deleted the feat/logging-correlation-vendor branch March 24, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants