-
Notifications
You must be signed in to change notification settings - Fork 731
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 Events SDK #4629
base: main
Are you sure you want to change the base?
add Events SDK #4629
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! I added a few non-blocking suggestions to make it easier for someone to try it out. I also added a note about setting a default severityNumber of 9 based on the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, looks good overall 👍
ConsoleLogRecordExporter, | ||
} = require('@opentelemetry/sdk-logs'); | ||
|
||
// The Events SDK has a dependency on the Logs SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nit: can you keep a consistency in the comments?
some start with capitalized letter and end with period, others don't. Some have a -
between sentences on different lines, some don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made a few changes in this file to make the comments more consistent.
new SimpleLogRecordProcessor(new ConsoleLogRecordExporter()) | ||
); | ||
logs.setGlobalLoggerProvider(loggerProvider); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JamieDanielson you made a comment on the other file to add an example for OTLP exporter, do you think one should also exist here?
Or since there is a link to that example right below is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the other SDK READMEs include OTLP exporters. IMO, this is a good thing, so that the README is focused only on how the package is used. The example is different because users might actually want to run it as is.
|
||
getEventLogger( | ||
name: string, | ||
version?: string | undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to add undefined
if you're using ?
to mark as optional, since it will already be undefined
if you don't pass anything.
Same for the options?
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
assert( | ||
spy.calledWith( | ||
sinon.match({ | ||
severityNumber: 9, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use SeverityNumber.INFO
here instead of 9? In case the value ever changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
// emit a log record | ||
const eventLogger = events.getEventLogger('example'); | ||
eventLogger.emit({ | ||
name: 'my-event', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: 'my-event', | |
name: 'my-domain.my-event', |
Just to emphasise using a domain prefix as a recommendation.
This adds details to how EventLoggerProvider and EventLogger should be implemented in the default Events SDK. Prototypes - [JavaScript prototype](open-telemetry/opentelemetry-js#4629) - [Java prototype](https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/internal/SdkEventLoggerProvider.java)
Which problem is this PR solving?
This adds an experimental implementation of the Events SDK.
As a related update, I have also updated the Events API with the following:
Type of change
Checklist: