Skip to content

Commit

Permalink
Merge pull request #31 from grafana/python-logs
Browse files Browse the repository at this point in the history
python logs have to be enabled explicitly
  • Loading branch information
zeitlinger authored Apr 2, 2024
2 parents c643910 + 7b6f139 commit 41cc227
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ COPY app.py .

# Logging support is still in alpha, so we need to enable it explicitly
ENV OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
ENV OTEL_LOGS_EXPORTER=otlp

EXPOSE 8082

Expand Down
4 changes: 4 additions & 0 deletions examples/python/oats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ expected:
metrics:
- promql: 'http_server_active_requests{http_method="GET"}'
value: ">= 0"
logs:
- logql: '{exporter="OTLP"} | json | body =~ `Anonymous player is rolling the dice.*`'
contains:
- 'Anonymous player is rolling the dice'
1 change: 1 addition & 0 deletions examples/python/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ opentelemetry-bootstrap -a install

# Step 2: Run the application
export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
export OTEL_LOGS_EXPORTER=otlp
opentelemetry-instrument flask run -p 8082

0 comments on commit 41cc227

Please sign in to comment.