Skip to content
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

Add event processors to the Event SDK #4196

Closed
wants to merge 2 commits into from

Conversation

tedsuo
Copy link
Contributor

@tedsuo tedsuo commented Aug 27, 2024

This PR changes the EventProvider SDK constructor to take a list of EventProcessors, to match the way that the tracing and logging providers are configured.

The three types of event processors included in this PR cover the features requested durning the August 23rd meeting of the Event SIG.

The log processor and the span event processor can be composed together:

# Configure the event provider to record each event
# as both a LogRecord and a SpanEvent.
event_provider:
  processors:
    - log
    - span_events

Alternatively, a language-specific logging processor could be used to send events directly to another logging system:

# Configure the event provider send the events to
# a language-specific logging system.
event_provider:
  processors:
    - python_logger

Log bridge processor

This processor passes the event's LogRecord to the Log SDK.

Span event processor

This processor converts the event's LogRecord into a SpanEvent on the current span. If there is no current span, this is a no-op.

If the event's LogRecord has a body, it MUST be json-serialized to a SpanEvent
attribute named event.body.

Event processors for language-specific logging libraries

These processors turn the Event API into "sugar" for popular logging libraries by sending the events directly to that 3rd-party logger's API. This is helpful for users who want to ensure that the LogRecords created via the Event API are processed in the same pipeline as their application logs.

For example, in Python the default logging library is very popular. A PythonLoggerProcessor would allow users to turn events directly into python logs. Any further processing is managed through the python logging system, including sending it to the LogBridge API if they want to record their logs in Otel.

@tedsuo tedsuo requested review from a team August 27, 2024 03:08

**Returns:**

* `next` - an Enum with two values, STOP and CONTINUE.
Copy link
Member

Choose a reason for hiding this comment

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

For logs,traces, a different approach is used where the next processor(s) are always called. Filtering there would require one to make wrapping processors.

I think this approach makes it easier to do filtering. Wondering if there were some discussions comparing the approaches for their pros/cons? The PR description only says "list of EventProcessors, to match the way that the tracing and logging providers are configured."

@jack-berg
Copy link
Member

Is there a prototype for this?

* `loggingProvider` - the `LoggingProvider` to use when emitting `LogRecord`s.
TODO need new Logging Provider SDK method

#### Span event processor
Copy link
Member

Choose a reason for hiding this comment

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

maybe this should be a log processor instead, so that it will apply also to events emitted directly via language-specific loggers?

@jack-berg
Copy link
Member

The TC discussed and think we should agree / resolve open-telemetry/oteps#265 before proceeding with this, since the outcome may change the strategy of the spec and cause churn.

@tedsuo tedsuo marked this pull request as draft August 28, 2024 17:26
@tedsuo
Copy link
Contributor Author

tedsuo commented Aug 28, 2024

Makes sense, I've marked this PR as draft for the time being.

Copy link

github-actions bot commented Sep 5, 2024

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Sep 5, 2024
Copy link

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants