open-telemetry / open-telemetry/opentelemetry-python-contrib

Logging Autoinstrumentation do not seem to emit logs

Open
#1,720 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Describe your environment

Hey!

I'm working right now on testing a few OTEL flows, however, i'm unable to get any emits to the collector/console from the logging autoinstrumentation (traces and metrics seems to be working fine).

I'm testing this on a bigger DJango App and a collector, whoever i'm right now with a Hello World App with the following env with no success

Env:

  • Python 3.9
  • opentelemetry-api==1.16.0
  • opentelemetry-distro==0.37b0
  • opentelemetry-exporter-otlp==1.16.0
  • opentelemetry-instrumentation==0.37b0
  • opentelemetry-instrumentation-logging==0.37b0
  • opentelemetry-sdk==1.16.0
  • opentelemetry-semantic-conventions==0.37b0
  • opentelemetry-util-http==0.37b0

Steps to reproduce

I'm running a simple code:

import logging


def log_hw():
    logging.info('Hello World')

if __name__ == '__main__':
    log_hw()

with the following command:

OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4317 \ OTEL_TRACES_EXPORTER=none \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORTER=console,otlp \ OTEL_PYTHON_LOG_EMITTER_PROVIDER=sdk \ OTEL_PYTHON_LOG_CORRELATION=true \ opentelemetry-instrument python main.py

What is the expected behavior?

Something on the collector/console

What is the actual behavior?
I only see the Log Message with otel format, but not the emit

2023-03-15 14:12:31,147 INFO [root] [main.py:7] [trace_id=0 span_id=0 resource.service.name=unknown_service] - Hello World

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the issue's Hello World example and the shown opentelemetry-instrument command, checking both console and collector output. Then inspect the opentelemetry-instrumentation-logging setup and the listed OTLP exporter configuration; done means the log is emitted to the configured console and collector, not only formatted by Python logging.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.