-
Notifications
You must be signed in to change notification settings - Fork 810
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
Logs API: Add emitEvent to Logs API #5050
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5050 +/- ##
==========================================
+ Coverage 93.26% 93.27% +0.01%
==========================================
Files 317 317
Lines 8195 8209 +14
Branches 1641 1646 +5
==========================================
+ Hits 7643 7657 +14
Misses 552 552
|
|
||
public emitEvent(eventRecord: logsAPI.EventRecord): void { | ||
const attributes = eventRecord.attributes || {}; | ||
attributes['event.name'] = eventRecord.name; |
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.
Nit: (use semantic conventions)
attributes['event.name'] = eventRecord.name; | |
attributes[ATTR_EVENT_NAME] = eventRecord.name; |
|
||
type Get<T> = (version: number) => T; | ||
type OtelGlobal = Partial<{ | ||
[GLOBAL_LOGS_API_KEY]: Get<LoggerProvider>; | ||
[GLOBAL_EXPERIMENTAL_LOGS_API_KEY]: Get<ExperimentalLoggerProvider>; |
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.
created a new key for the experimental logs, to be confirmed
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.
to make a comment in the code as well
@@ -53,4 +53,23 @@ export class Logger implements logsAPI.Logger { | |||
*/ | |||
logRecordInstance._makeReadonly(); | |||
} | |||
|
|||
// public emitEvent(eventRecord: logsAPI.EventRecord): void { |
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.
Should we have an experimental entry for sdk-logs as well?
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.
need a experimental one
version?: string, | ||
options?: LoggerOptions | ||
): Logger | 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.
maybe add a baseLogger as well?
* @param logRecord | ||
*/ | ||
emitEvent(eventRecord: EventRecord): void { | ||
this._getLogger().emitEvent(eventRecord); |
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.
make sure emitevent exists
[Draft] Add
emitEvent
to Logs APITODO: Bridge current events API
emit
to logs APIemitEvent
for backward compatibility.