-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
107 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Logs Bridge API Design | ||
|
||
Author: Robert Pająk | ||
|
||
Tracking issue at [#4696](https://github.com/open-telemetry/opentelemetry-go/issues/4696). | ||
|
||
## Abstract | ||
|
||
<!-- A short summary of the proposal. --> | ||
|
||
We propose adding a `go.opentelemetry.io/otel/log` Go module which will provide | ||
[Logs Data Model](https://opentelemetry.io/docs/specs/otel/logs/data-model/) | ||
and [Logs Bridge API](https://opentelemetry.io/docs/specs/otel/logs/data-model/). | ||
|
||
## Background | ||
|
||
<!-- An introduction of the necessary background and the problem being solved by the proposed change. --> | ||
|
||
They key challenge is to create API which will be complaint with the specification | ||
and be as performant as possible. | ||
|
||
Performance is seen as one of the most imporatant charactristics of logging libraries in Go. | ||
|
||
## Proposal | ||
|
||
The design and benchmarks takes inspiration from [`slog`](https://pkg.go.dev/log/slog), | ||
because for the Go team it was also critical to create API that would be fast | ||
and interoperable with existing logging packages. [^1] [^2] | ||
|
||
<!-- A precise statement of the proposed change. --> | ||
|
||
## Rationale | ||
|
||
<!-- A discussion of alternate approaches and the trade offs, advantages, and disadvantages of the specified approach. --> | ||
|
||
## Compatibility | ||
|
||
The backwards compatibility is achieved using the `embedded` design pattern | ||
that is already used in Trace API and Metrics API. | ||
|
||
## Implementation | ||
|
||
<!-- A description of the steps in the implementation, who will do them, and when. --> | ||
|
||
## Open issues (if applicable) | ||
|
||
<!-- A discussion of issues relating to this proposal for which the author does not | ||
know the solution. This section may be omitted if there are none. --> | ||
|
||
[^1]: Jonathan Amsterdam, [The Go Blog: Structured Logging with slog](https://go.dev/blog/slog) | ||
[^2]: Jonathan Amsterdam, [GopherCon Europe 2023: A Fast Structured Logging Package](https://www.youtube.com/watch?v=tC4Jt3i62ns) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Copyright 2022 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package log_test | ||
|
||
import "testing" | ||
|
||
// These benchmarks are based on slog/internal/benchmarks. | ||
// They have the following desirable properties: | ||
// | ||
// - They test a complete log record, from the user's call to its return. | ||
// | ||
// - The benchmarked code is run concurrently in multiple goroutines, to | ||
// better simulate a real server (the most common environment for structured | ||
// logs). | ||
// | ||
// - Some handlers are optimistic versions of real handlers, doing real-world | ||
// tasks as fast as possible (and sometimes faster, in that an | ||
// implementation may not be concurrency-safe). This gives us an upper bound | ||
// on handler performance, so we can evaluate the (handler-independent) core | ||
// activity of the package in an end-to-end context without concern that a | ||
// slow handler implementation is skewing the results. | ||
func BenchmarkEndToEnd(b *testing.B) { | ||
// TODO: Replicate https://github.com/golang/go/blob/master/src/log/slog/internal/benchmarks/benchmarks_test.go | ||
// Run benchmarks against a "noop.Logger" and "fastTextLogger" (based on fastTextHandler) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Package log provides the OpenTelemetry Logs Data Model and Bridge API. | ||
package log // import "go.opentelemetry.io/otel/log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package log_test | ||
|
||
func Example() { | ||
// Output: | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module go.opentelemetry.io/otel/log | ||
|
||
go 1.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters