x

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

README

Experimental Features

The Logs SDK contains features that have not yet stabilized. These features are added to the OpenTelemetry Go Logs SDK prior to stabilization so that users can start experimenting with them and provide feedback.

These feature may change in backwards incompatible ways as feedback is applied. See the Compatibility and Stability section for more information.

Features

Filter Processor

Users of logging libraries often want to know if a log Record will be processed or dropped before they perform complex operations to construct the Record. The Logger in the Logs Bridge API provides the Enabled method for just this use-case. In order for the Logs Bridge SDK to effectively implement this API, it needs to be known if the registered Processors are enabled for the Record within a context. A Processor that knows, and can identify, what Record it will process or drop when it is passed to OnEmit can communicate this to the SDK Logger by implementing the FilterProcessor.

By default, the SDK Logger.Enabled will return true when called. Only if all the registered Processors implement FilterProcessor and they all return false will Logger.Enabled return false.

See the minsev Processor for an example use-case. It is used to filter Records out that a have a Severity below a threshold.

Compatibility and Stability

Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability policy. These features may be removed or modified in successive version releases, including patch versions.

When an experimental feature is promoted to a stable feature, a migration path will be included in the changelog entry of the release.

Documentation

Overview

Package x contains support for Logs SDK experimental features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterProcessor

type FilterProcessor interface {
	// Enabled returns whether the Processor will process for the given context
	// and param.
	//
	// The passed param 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 param, 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 param.
	Enabled(ctx context.Context, param log.EnabledParameters) bool
}

FilterProcessor is a go.opentelemetry.io/otel/sdk/log.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 Processors that can make reliable enough determination of this prior to processing a log.Record and where the result is dynamic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL