Skip to content

Enable by default or support ENV based configuration of EventLoggerProvider #4269

Closed
@codefromthecrypt

Description

@codefromthecrypt

Is your feature request related to a problem?

Right now, to use instrumentation that relies on EventLogger, you cannot do a full zero-code approach. You have to add code like this to plumb the event logger:

from opentelemetry import _events
from opentelemetry.sdk._events import EventLoggerProvider
_events.set_event_logger_provider(EventLoggerProvider())

This assumes you have ENV like below:

OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
OTEL_LOGS_EXPORTER=otlp_proto_http

Describe the solution you'd like

I would like the EventLoggerProvider to be enabled by default or driven by ENV variables, so that "zero code" works as expected for the other signal types.

Describe alternatives you've considered

paste the code, but it does end up with a warning log message
Uploading Screenshot 2024-11-12 at 1.29.14 PM.png…

Additional Context

#4176 (comment) suggests this could be implemented in a PR

open-telemetry/opentelemetry.io#5575 is a blog which is more complicated as it relies on manual setup

Would you like to implement a fix?

None

Metadata

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