Skip to content

Events API based on LogRecords#1

Open
scheler wants to merge 5 commits into
mainfrom
logs-api
Open

Events API based on LogRecords#1
scheler wants to merge 5 commits into
mainfrom
logs-api

Conversation

@scheler

@scheler scheler commented May 9, 2022

Copy link
Copy Markdown
Owner

No description provided.

@tigrannajaryan tigrannajaryan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you think my proposal to keep/rename SdkLogEmitterProvider->SdkLogRecordEmitterProvider and SdkLogEmitter->SdkLogRecordEmitter is reasonable?

So we will have:

  • LoggerProvider and Logger that can be used to create events and exceptions.
  • SdkLogRecordEmitterProvider and SdkLogRecordEmitter that can be used to produce any log records.

* <p>Obtain a {@link LogRecordBuilder} via {@link Logger#eventBuilder(String)}, add properties using the
* setters, and emit the event by calling {@link #emit()}.
*/
public interface LogRecord {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we want to make LogRecord part of public API?
Do we want to have both LogRecord with setters and LogRecordBuilder?

* @param additionalAttributes the additional {@link Attributes} to record.
* @return this.
*/
LogRecord recordException(Throwable t, Attributes additionalAttributes);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Will this create a LogRecord with attributes defined here? https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md

Do we omit event.name for exceptions? Does this mean "exception" is not an "event"?

@scheler scheler May 16, 2022

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This is confusing but I think there is no issue here. The span event have exception as the value of the name field, and in LogRecords, exception events will have an attribute event.name with value exception.

Span.Event -> {
name: exception
}

LogRecord -> {
  attributes: {
    event.name: exception
  }
}

Comment thread api/all/src/main/java/io/opentelemetry/api/logs/LogRecord.java Outdated
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.

2 participants