Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application does not emit logs on stderr when auto-instrumented #2793

Open
marcoboi opened this issue Aug 12, 2024 · 0 comments
Open

Application does not emit logs on stderr when auto-instrumented #2793

marcoboi opened this issue Aug 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@marcoboi
Copy link

Describe your environment

OS: (e.g, Ubuntu)
Python version: (e.g., Python 3.8.10)
Instrumentation image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.46b0

What happened?

I have a container running a simple application running on a k8s pod (code attached below).
The application emits the logs messages through stderr when running.

When instrumentation is attached to it, the logs are streamed to the backend, as expected.
Yet, the application stops emitting logs through stderr.

Application code

import logging
import random
import time

random.seed(time.time_ns())

app_name = f'app_{random.randint(1, 100)}'

logger = logging.getLogger(f"{app_name}_logger")

for i in range(3000):
    sleep_ms = 10 * random.randint(1, 100)
    logger.warning(f"Python app '{app_name}' sleeping for {sleep_ms} ms")
    time.sleep(sleep_ms / 1000)

Dockerfile

FROM python:3.9.6

WORKDIR /usr/app
RUN python -m venv /usr/app/venv
ENV PATH="/usr/app/venv/bin:$PATH"

COPY ./requirements.txt .
RUN pip install -r requirements.txt

COPY ./app .

CMD ["python", "-u", "./app.py"]

Steps to Reproduce

Build app, deploy on k8s.

Expected Result

Logs should be streamed through stderr even when the application is instrumented.

Actual Result

Logs are not produced to stderr when the app is instrumented using auto-instrumentation.

Additional context

No response

Would you like to implement a fix?

None

@marcoboi marcoboi added the bug Something isn't working label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant