feat(telemetry): add OTel standard logs as third signal#239
Draft
jeanscherf wants to merge 2 commits into
Draft
Conversation
Wire up a LoggerProvider alongside the existing metrics and traces so
stdlib logging calls automatically flow through OTel with the shared
resource attributes (service.name, region, subaccount, etc.).
- setup_log_provider() in _provider.py mirrors _setup_meter_provider():
LoggerProvider + BatchLogRecordProcessor + OTLP exporter (grpc/http)
- LoggingHandler from opentelemetry-instrumentation-logging installed on
root logger so all existing logging.getLogger() calls are captured
- auto_instrument() calls setup_log_provider() alongside trace setup,
keeping the one-call contract for apps
- user-guide.md: new Logging section with usage examples, structured
fields, level filtering, and trace correlation notes
- unit tests: mock-level coverage for exporter protocol, provider setup,
handler installation, and auto_instrument wiring
- e2e tests: real in-memory pipeline verifying body, severity, resource
attributes, extra={} fields, and trace/span correlation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LoggerProvideralongside existing metrics and traces using the shared resource attributes (service.name, region, subaccount, etc.)auto_instrument()now sets up all three OTel signals — no app boilerplate changes neededLoggingHandlerfromopentelemetry-instrumentation-logging(not the deprecated SDK one) installed on the root stdlib loggerChanges
_provider.py:setup_log_provider()+_create_log_exporter()— mirrors_setup_meter_provider()pattern, same grpc/http protocol switchauto_instrument.py: onesetup_log_provider()call wired in after trace setupuser-guide.md: new Logging section covering usage,extra={}structured fields, level filtering, trace correlationTests
_create_log_exporter,setup_log_provider, andauto_instrumentwiringextra={}fields, and trace/span correlation — all run in CI without any external dependenciesApp usage
No changes needed. After
auto_instrument(), all existinglogging.getLogger(...)calls ship logs to the OTel backend automatically: