package x

import "go.opentelemetry.io/otel/sdk/metric/internal/x"

Package x contains support for OTel metric SDK experimental features.

This package should only be used for features defined in the specification. It should not be used for experiments or new project ideas.

Index

Variables

var CardinalityLimit = newFeature("CARDINALITY_LIMIT", func(v string) (int, bool) {
	n, err := strconv.Atoi(v)
	if err != nil {
		return 0, false
	}
	return n, true
})

CardinalityLimit is an experimental feature flag that defines if cardinality limits should be applied to the recorded metric data-points.

To enable this feature set the OTEL_GO_X_CARDINALITY_LIMIT environment variable to the integer limit value you want to use.

Setting OTEL_GO_X_CARDINALITY_LIMIT to a value less than or equal to 0 will disable the cardinality limits.

Types

type EnabledInstrument

type EnabledInstrument interface {
	// Enabled returns whether the instrument will process measurements for the given context.
	//
	// This function can be used in places where measuring an instrument
	// would result in computationally expensive operations.
	Enabled(context.Context) bool
}

EnabledInstrument informs whether the instrument is enabled.

EnabledInstrument interface is implemented by synchronous instruments.

type Feature

type Feature[T any] struct {
	// contains filtered or unexported fields
}

Feature is an experimental feature control flag. It provides a uniform way to interact with these feature flags and parse their values.

func (Feature[T]) Enabled

func (f Feature[T]) Enabled() bool

Enabled returns if the feature is enabled.

func (Feature[T]) Key

func (f Feature[T]) Key() string

Key returns the environment variable key that needs to be set to enable the feature.

func (Feature[T]) Lookup

func (f Feature[T]) Lookup() (v T, ok bool)

Lookup returns the user configured value for the feature and true if the user has enabled the feature. Otherwise, if the feature is not enabled, a zero-value and false are returned.

Source Files

x.go

Version
v1.34.0 (latest)
Published
Jan 17, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
3 hours ago

Tools for package owners.