opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

Proposal: OpenTelemetry Logs

Open pellared opened this issue 9 months ago • 5 comments

Problem Statement

Design the following components in accordance to the OTel Specifcation (https://opentelemetry.io/docs/specs/otel/logs/):

  • Logs Bridge API
  • Logs SDK
  • slog.Handler implementation; log appender; bridge
  • Stdout exporter

Proposed Solution

Create a separate proposal PR which contains:

  1. A design document.
  2. A prototype implementation.

This issue is to track the whole proposal. It should be closed when the OTel Go maintainers and approvers accept the proposed design and prototype.

The prototype should have a PoC (happy-path; tests and proper error handling is not required) implementation of all components, with example and benchmarks. The main focus is on the API and performance. The prototype can have everything as a single Go module for ease of development.

After the proposal is accepted, the actual implementation will be built based on the prototype as many PRs with tests, benchmarks, and documentation.

Current design and prototype

  • https://github.com/open-telemetry/opentelemetry-go/pull/4809
  • https://github.com/open-telemetry/opentelemetry-go/pull/4725
  • ...

Prior Art

  • https://github.com/open-telemetry/opentelemetry-go/pull/3606
  • https://github.com/MadVikingGod/opentelemetry-go/tree/mvg/slog

Additional Context

It is worth to get all the lessons learned that the Go team had when they created slog:

  • https://go.dev/blog/slog
  • https://go.googlesource.com/proposal/+/master/design/56345-structured-logging.md
  • https://github.com/golang/go/tree/master/src/log/slog
  • https://golang.org/s/slog-handler-guide
  • https://github.com/golang/go/issues/56345
  • https://github.com/golang/go/discussions/54763

It is important to notice that API design can affect performance (e.g. allocations). It would be good to create benchmarks similar to https://github.com/golang/go/tree/master/src/log/slog Reference: https://www.youtube.com/watch?v=tC4Jt3i62ns

pellared avatar Nov 08 '23 08:11 pellared

@jba Do you want to participate (in any way you feel comfortable with) in adding logs to OpenTelemetry Go? I would be more than happy to get any feedback from you.

pellared avatar Nov 08 '23 12:11 pellared

Yes, I'd love to review the work related to slog.

jba avatar Nov 08 '23 15:11 jba

Hi @pellared , I'm very interested in this feature lately. We are going to build a new system that will import full OpenTelemetry stack. But yesterday we found the latest opentelemtry-go SDK is still not supporting log report(to otel collector), however, our another team using opentelemetry-java, which has already supported.

I'm glad to help if there is anything I can do.

cloorc avatar Dec 20 '23 02:12 cloorc

Hi @pellared , I'm very interested in this feature lately. We are going to build a new system that will import full OpenTelemetry stack. But yesterday we found the latest opentelemtry-go SDK is still not supporting log report(to otel collector), however, our another team using opentelemetry-java, which has already supported.

I'm glad to help if there is anything I can do.

@cloorc one thing to keep in mind is the OTel "logs implementation" is going to be a bridge that will back popular logging APIs. If you are using something like slog, logr, zap, ... there will likely be an OTel export pipeline built for these systems.

MrAlias avatar Dec 20 '23 15:12 MrAlias

Hi @pellared , I'm very interested in this feature lately. We are going to build a new system that will import full OpenTelemetry stack. But yesterday we found the latest opentelemtry-go SDK is still not supporting log report(to otel collector), however, our another team using opentelemetry-java, which has already supported. I'm glad to help if there is anything I can do.

@cloorc one thing to keep in mind is the OTel "logs implementation" is going to be a bridge that will back popular logging APIs. If you are using something like slog, logr, zap, ... there will likely be an OTel export pipeline built for these systems.

Yeah, it sounds like what we are looking forward to. Thanks!

cloorc avatar Dec 22 '23 08:12 cloorc

Closing per https://github.com/open-telemetry/opentelemetry-go/pull/4809.

New issues will be created e.g. for SDK design.

pellared avatar Feb 09 '24 07:02 pellared