open-telemetry / open-telemetry/opentelemetry-python
[Problem] Logging integration with opentelemetry auto instrumentation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 19
Description
Is your feature request related to a problem?
I use python auto instrumentation for my FastAPI application.
I want to do zero code insert for opentelemetry like this docs
The log and trace were perfectly send to opentelemetry collector by following instrumentation in kubernetes:
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: opentelemetry-instrumentation
namespace: opentelemetry-operator-system
spec:
defaults: {}
exporter:
endpoint: http://opentelemetry-collector.open-telemetry.svc.cluster.local:4318
propagators:
- tracecontext
- baggage
python:
env:
- name: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED
value: 'true'
image: >-
ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.50b0
resourceRequirements:
limits:
cpu: 500m
memory: 64Mi
requests:
cpu: 50m
memory: 64Mi
volumeClaimTemplate:
metadata: {}
spec:
resources: {}
resource: {}
sampler:
argument: '1'
type: parentbased_traceidratio
If I specified OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED to true, the log which use logging will be send to opentelemetry collector, but disappear in console.
How can I send the log to opentelemetry and print in console by logging using python auto instrumentation?
If possible, I want to maintain the concept of zero code. I don't want to change the application code.
thanks
Describe the solution you'd like
I can use variable or something that I can send logging log to console and opentelemetry collector
Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python zero-code instrumentation documentation linked in the issue and the Kubernetes Instrumentation manifest, focusing on OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED. Determine whether configuration can preserve console output while exporting logs to the collector without application changes; done means logs appear in both destinations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, kubernetes, python
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100