-
Notifications
You must be signed in to change notification settings - Fork 821
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/events SDK #3400
Logs/events SDK #3400
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.
Overall structure of the package looks good to me. Have a few comments which amount to style preferences rather than actual issues. Named exports one is important though.
Some files are missing copyright headers.
constructor( | ||
resource: Resource, | ||
instrumentationScope: InstrumentationScope, | ||
timestamp?: number, | ||
severityNumber?: number, | ||
severityText?: string, | ||
body?: string, | ||
attributes?: Attributes, | ||
traceFlags?: number, | ||
traceId?: string, | ||
spanId?: string |
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.
Might be better to use an object here since there are many optional arguments and there could be more added in the future. I would suggest resource and scope stay as required positional arguments, then make a third required positional arg with log record properties.
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 even use api.LogRecord
type?
readonly timestamp?: number | undefined; | ||
readonly severityNumber?: number | undefined; | ||
readonly severityText?: string | undefined; | ||
readonly body?: string | undefined; | ||
readonly traceFlags?: number | undefined; | ||
readonly traceId?: string | undefined; | ||
readonly spanId?: string | undefined; | ||
readonly resource: Resource; | ||
readonly instrumentationScope: InstrumentationScope; |
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.
These are all public by default, is that intentional?
import { ReadableLogRecord } from './export/ReadableLogRecord'; | ||
|
||
export class LogRecord implements ReadableLogRecord { | ||
private attributes?: Attributes | 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 set a default value of {}
in the constructor unless undefined has special meaning
readonly resource: Resource; | ||
readonly instrumentationScope: InstrumentationScope; | ||
readonly provider: 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.
Should these be private?
this._emit(logRecord); | ||
} | ||
|
||
_emit(logRecord: LogRecord): 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.
private?
)); | ||
} | ||
|
||
emitEvent(event: api.LogEvent): 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.
This moved to a separate API in open-telemetry/opentelemetry-specification#2941
readonly processors: LogRecordProcessor[] = []; | ||
readonly resource: Resource; |
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.
private?
return Promise.resolve(); | ||
} | ||
|
||
private _exportInfo(logRecord: ReadableLogRecord) { |
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.
What is this function doing?
export * from './Logger'; | ||
export * from './LoggerProvider'; | ||
export * from './LogRecordProcessor'; | ||
export * from './export/SimpleLogProcessor'; | ||
export * from './export/ConsoleLogExporter'; |
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.
Explicit named exports would make it so that we don't accidentally leak internals. We've been moving that way in other packages.
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
This PR was closed because it has been stale for 14 days with no activity. |
This PR is not finished, but open to early feedback on the interfaces/classes of the SDK.
Related spec
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md