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

Event emitter provider #5049

Merged
merged 10 commits into from
Feb 3, 2023
Merged

Conversation

jack-berg
Copy link
Member

Split out the event API so that it is completely separate from the log API, rather than dependent on the log API as in #4961.

Summary of changes:

  • Introduce new :api:events module, containing:
    • EventEmitterProvider (and GlobalEventEmitterProvider)
    • EventEmitterBuilder
    • EventEmitter
  • Remove event API surface area from :api:logs
  • Refactor :sdk:logs to implement both log API and event API. I.e.:
    • SdkLoggerProvider implements both LoggerProvider and EventEmitterProvider
    • SdkLoggerBuilder implements both LoggerBuilder and EventEmitterBuilder
    • SdkLogger implements both Logger and EventEmitter
  • Update autoconfigure to call GlobalEventEmitterProvider.set

Draft for now as this is not what is currently described in the Event API spec. This approach is suggested by @trask and @jkwatson here, and by myself a while ago in the otep.

@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Base: 91.00% // Head: 91.00% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (6dd56a5) compared to base (7068cb3).
Patch coverage: 87.87% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #5049   +/-   ##
=========================================
  Coverage     91.00%   91.00%           
+ Complexity     4899     4886   -13     
=========================================
  Files           549      550    +1     
  Lines         14538    14526   -12     
  Branches       1393     1382   -11     
=========================================
- Hits          13230    13220   -10     
- Misses          906      913    +7     
+ Partials        402      393    -9     
Impacted Files Coverage Δ
...java/io/opentelemetry/api/logs/LoggerProvider.java 100.00% <ø> (ø)
...io/opentelemetry/sdk/logs/SdkLogRecordBuilder.java 97.43% <ø> (ø)
...main/java/io/opentelemetry/sdk/logs/SdkLogger.java 100.00% <ø> (+10.00%) ⬆️
...a/io/opentelemetry/sdk/logs/SdkLoggerProvider.java 100.00% <ø> (ø)
...pentelemetry/sdk/logs/SdkEventEmitterProvider.java 78.78% <78.78%> (ø)
...lemetry/api/events/GlobalEventEmitterProvider.java 90.00% <90.00%> (ø)
.../opentelemetry/api/events/DefaultEventEmitter.java 100.00% <100.00%> (ø)
...emetry/api/events/DefaultEventEmitterProvider.java 100.00% <100.00%> (ø)
...opentelemetry/api/events/EventEmitterProvider.java 100.00% <100.00%> (ø)
.../java/io/opentelemetry/api/logs/DefaultLogger.java 100.00% <100.00%> (ø)
... and 35 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

* particular event domain, event name defines a particular class or type of event.
* @return a Logger instance.
*/
default EventEmitter get(String instrumentationScopeName, String eventDomain) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is eventDomain mandatory? I don't even know what sort of values I'd put in for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

As of now event.domain is required. The spec describes it as:

The event.domain attribute is used to logically separate events from different systems. For example, to record Events from browser apps, mobile apps and Kubernetes, we could use browser, device and k8s as the domain for their Events. This provides a clean separation of semantics for events in each of the domains. Within a particular domain, the event.name attribute identifies the event. Events with same domain and name are structurally similar to one another.

There's an open issue to discuss whether event.domain and event.name can be merged into a single field.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only sticking point I have with this API. I don't love having to explain to people what this is supposed to be used for. We have had enough trouble explaining what the "name" of a Tracer is...this adds an additional layer of having to explain this arcane idea that almost no one will care about. Can we make it optional? Or default to something like "none" or "unknown" or "who cares?"? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not opposed to making it optional with a default given the experimental state of the spec. The spec could reaffirm the importance and requirement of this field, in which case we'd have to come back and adjust our API, but that's fine and won't be the last breaking change to the event API. Will push a commit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushed a commit where event domain is now optional, set via eventEmitterProvider.eventEmitterBuilder("scope-name").setEventDomain("event-domain").build().

If unset, the event.domain attribute defaults to unknown.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2023

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

@github-actions github-actions bot added the Stale label Jan 3, 2023
@jack-berg jack-berg removed the Stale label Jan 3, 2023
@jack-berg jack-berg marked this pull request as ready for review January 5, 2023 18:20
@jack-berg jack-berg requested a review from a team January 5, 2023 18:20
@tigrannajaryan
Copy link
Member

tigrannajaryan commented Jan 9, 2023

@jack-berg do I understand correctly that with this PR we end up with roughly the following modules and data flows:
image

Question: do we need the "Log API" in the API package or we can get rid of it and make Bridges/Appenders call directly into Log SDK package?

@jkwatson
Copy link
Contributor

jkwatson commented Jan 9, 2023

Question: do we need the "Log API" in the API package or we can get rid of it and make Bridges/Appenders call directly into Log SDK package?

This was actually our first approach (and the one I strongly favored). Unfortunately, getting this to work with the OTel javaagent ended up being quite problematic (@trask can probably explain the details, since it's pretty fuzzy in my head), leading us to create an API surface for the javaagent to interact with.

@jack-berg
Copy link
Member Author

@jack-berg do I understand correctly that with this PR we end up with roughly the following modules and data flows:

Yes that's correct.

Question: do we need the "Log API" in the API package or we can get rid of it and make Bridges/Appenders call directly into Log SDK package?

@tigrannajaryan I responded to the question of whether or not we need a log appender API here. In summary, yes, we do need a log appender API.

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the Stale label Jan 26, 2023
@jkwatson jkwatson removed the Stale label Jan 28, 2023
Copy link
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants