You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-12-07 23:32:49 +02:00
47 lines
1.9 KiB
Go
47 lines
1.9 KiB
Go
|
|
// Copyright The OpenTelemetry Authors
|
||
|
|
// SPDX-License-Identifier: Apache-2.0
|
||
|
|
|
||
|
|
// Package x contains support for Logs SDK experimental features.
|
||
|
|
package x // import "go.opentelemetry.io/otel/sdk/log/internal/x"
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"go.opentelemetry.io/otel/log"
|
||
|
|
)
|
||
|
|
|
||
|
|
// FilterProcessor is a [Processor] that knows, and can identify, what
|
||
|
|
// [log.Record] it will process or drop when it is passed to OnEmit.
|
||
|
|
//
|
||
|
|
// This is useful for users of logging libraries that want to know if a [log.Record]
|
||
|
|
// will be processed or dropped before they perform complex operations to
|
||
|
|
// construct the [log.Record].
|
||
|
|
//
|
||
|
|
// [Processor] implementations that choose to support this by satisfying this
|
||
|
|
// interface are expected to re-evaluate the [log.Record]s passed to OnEmit, it is
|
||
|
|
// not expected that the caller to OnEmit will use the functionality from this
|
||
|
|
// interface prior to calling OnEmit.
|
||
|
|
//
|
||
|
|
// This should only be implemented for [Processor]s that can make reliable
|
||
|
|
// enough determination of this prior to processing a [log.Record] and where
|
||
|
|
// the result is dynamic.
|
||
|
|
//
|
||
|
|
// [Processor]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/log#Processor
|
||
|
|
type FilterProcessor interface {
|
||
|
|
// Enabled returns whether the Processor will process for the given context
|
||
|
|
// and record.
|
||
|
|
//
|
||
|
|
// The passed record is likely to be a partial record with only the
|
||
|
|
// bridge-relevant information being provided (e.g a record with only the
|
||
|
|
// Severity set). If a Logger needs more information than is provided, it
|
||
|
|
// is said to be in an indeterminate state (see below).
|
||
|
|
//
|
||
|
|
// The returned value will be true when the Processor will process for the
|
||
|
|
// provided context and record, and will be false if the Processor will not
|
||
|
|
// process. An implementation should default to returning true for an
|
||
|
|
// indeterminate state.
|
||
|
|
//
|
||
|
|
// Implementations should not modify the record.
|
||
|
|
Enabled(ctx context.Context, record log.Record) bool
|
||
|
|
}
|