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

[Logs API] - Logger Changes #1688

Closed
lalitb opened this issue Oct 17, 2022 · 0 comments · Fixed by #1884
Closed

[Logs API] - Logger Changes #1688

lalitb opened this issue Oct 17, 2022 · 0 comments · Fixed by #1884

Comments

@lalitb
Copy link
Member

lalitb commented Oct 17, 2022

Specs - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/api.md#logger-operations

  • The API specs defines two interfaces to emit logs and events.
  • As per the specs, the interface to emit the logs is ONLY for the Appenders, and not the end-user/instrumentation library. The specs intentionally leaves the general-purpose logging API for the instrumentation library as unspecified. Which means, we may continue using the existing APIs as it is, and add two new interfaces for emitting events and logs.
  • event_name would be copied to Logs attributes before exporting to the destination, ( as part of SDK implementation)

Something like -

  virtual nostd::unique_ptr<LogRecord> Logger::CreateLogRecord() = 0;

  virtual void Logger::EmitEvent(nostd::string event_name, nostd::unique_ptr<LogRecord> log_record) = 0;
 
  virtual void Logger::EmitLog(nostd::unique_ptr<LogRecord> log_record) = 0;
  • In above code design, LogRecord is thought as analogous to Span, and the setters are defined through the Recordable interface implementation by exporter.

  • The existing Logger::Log() method can be renamed as Logger::EmitLog() to be consistent with the newly introduced Logger::EmitLog(log_record) method. This will ensure there won't be much code changes required by instrumentation library.

@marcalff marcalff added the logs label Oct 17, 2022
@lalitb lalitb changed the title [Logs API] - Logger Changes [Logs API] - Logger, EventLogger Changes Nov 29, 2022
@lalitb lalitb changed the title [Logs API] - Logger, EventLogger Changes [Logs API] - Logger Changes Nov 29, 2022
@owent owent self-assigned this Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants