Skip to content

add aiohttp example #248

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

add aiohttp example #248

wants to merge 2 commits into from

Conversation

andreaturli
Copy link

What does this pull request do?

Add an example for aiohttp server

Related issues

Closes #ISSUE

Co-authored-by: Riccardo Magliocchetti <[email protected]>
```sh
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer P....l"
docker run -e OTEL_EXPORTER_OTLP_ENDPOINT="$OTEL_EXPORTER_OTLP_ENDPOINT" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using logging here I think we can can export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true and then update docker to forward it

from aiohttp import web


logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call to logging.basicConfig() is a no-op when the otel sdk is configured to handle logs, we can call logger.setLevel() later to get the logs exported in otlp

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next release will have this fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants