package x

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

Package x contains support for OTel 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 Resource = newFeature("RESOURCE", func(v string) (string, bool) {
	if strings.ToLower(v) == "true" {
		return v, true
	}
	return "", false
})

Resource is an experimental feature flag that defines if resource detectors should be included experimental semantic conventions.

To enable this feature set the OTEL_GO_X_RESOURCE environment variable to the case-insensitive string value of "true" (i.e. "True" and "TRUE" will also enable this).

Types

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
2 packages
Last checked
2 days ago

Tools for package owners.