Skip to content

Commit

Permalink
Instrument log lines with otel trace info
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Riles committed Aug 8, 2024
1 parent 6c5d467 commit e5a5540
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 89 deletions.
3 changes: 2 additions & 1 deletion 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 @@ -457,7 +458,7 @@ def load_and_run_shell() -> None:
args = parser.parse_args(sys.argv[1:])
with args.config_file:
config = read_config(args.config_file, server_name=None, app_name=args.app_name)
logging.basicConfig(level=logging.INFO)
LoggingInstrumentor(set_loggin_format=True, log_level=logging.INFO).instrument()

env: Dict[str, Any] = {}
env_banner = {
Expand Down
Loading

0 comments on commit e5a5540

Please sign in to comment.