Skip to content

Commit

Permalink
Instrument log lines with otel trace info (#965)
Browse files Browse the repository at this point in the history
Co-authored-by: Trevor Riles <trevor@reddit.com>
  • Loading branch information
trevorriles and Trevor Riles authored Aug 13, 2024
1 parent 6c5d467 commit cf0cbee
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 88 deletions.
2 changes: 2 additions & 0 deletions baseplate/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from opentelemetry import trace
from opentelemetry.context import Context
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.logging import LoggingInstrumentor
from opentelemetry.instrumentation.threading import ThreadingInstrumentor
from opentelemetry.propagators.composite import CompositePropagator
from opentelemetry.sdk.trace import Span
Expand Down Expand Up @@ -172,6 +173,7 @@ def read_config(config_file: TextIO, server_name: Optional[str], app_name: str)


def configure_logging(config: Configuration, debug: bool) -> None:
LoggingInstrumentor().instrument()
logging.captureWarnings(capture=True)

if debug:
Expand Down
Loading

0 comments on commit cf0cbee

Please sign in to comment.