1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-26 21:05:00 +02:00

Ensure exported struct in sdk/log are not comparable (#5693)

Ensure the `Record` and `Provider` continue to be non-comparable.

Restrict `BatchProcessor` and `SimpleProcessor` to be non-comparable.

There is no obvious reason an end-user will need to compare these types,
and we want to keep the possibility of changing the internals without
changing this behavior.

if comparability is required by end-users in the future we can add
`Equal(other T)` methods in the future.
This commit is contained in:
Tyler Yahn 2024-08-09 07:31:42 -07:00 committed by GitHub
parent 69e235829e
commit c4ebcaa08d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- `SimpleProcessor.Enabled` in `go.opentelemetry.io/otel/sdk/log` now returns `false` if the exporter is `nil`. (#5665)
- Update the concurrency requirements of `Exporter` in `go.opentelemetry.io/otel/sdk/log`. (#5666)
- `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` synchronizes `OnEmit` calls. (#5666)
- The `SimpleProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693)
- The `BatchProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693)
### Fixed

View File

@ -96,6 +96,8 @@ type BatchProcessor struct {
// stopped holds the stopped state of the BatchProcessor.
stopped atomic.Bool
noCmp [0]func() //nolint: unused // This is indeed used.
}
// NewBatchProcessor decorates the provided exporter

View File

@ -69,6 +69,8 @@ type LoggerProvider struct {
loggers map[instrumentation.Scope]*logger
stopped atomic.Bool
noCmp [0]func() //nolint: unused // This is indeed used.
}
// Compile-time check LoggerProvider implements log.LoggerProvider.

View File

@ -86,6 +86,8 @@ type Record struct {
attributeValueLengthLimit int
attributeCountLimit int
noCmp [0]func() //nolint: unused // This is indeed used.
}
func (r *Record) addDropped(n int) {

View File

@ -17,6 +17,8 @@ var _ Processor = (*SimpleProcessor)(nil)
type SimpleProcessor struct {
mu sync.Mutex
exporter Exporter
noCmp [0]func() //nolint: unused // This is indeed used.
}
// NewSimpleProcessor is a simple Processor adapter.