Skip to content

[Problem] Logging integration with opentelemetry auto instrumentation #4427

Open
@g3david405

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions