Source File
x.go
Belonging Package
go.opentelemetry.io/otel/sdk/log/internal/x
// Copyright The OpenTelemetry Authors// SPDX-License-Identifier: Apache-2.0// Package x documents experimental features for [go.opentelemetry.io/otel/sdk/log].package x // import "go.opentelemetry.io/otel/sdk/log/internal/x"import ()// SelfObservability is an experimental feature flag that determines if SDK// self-observability metrics are enabled.//// To enable this feature set the OTEL_GO_X_SELF_OBSERVABILITY environment variable// to the case-insensitive string value of "true" (i.e. "True" and "TRUE"// will also enable this).var SelfObservability = newFeature("SELF_OBSERVABILITY", func( string) (string, bool) {if strings.EqualFold(, "true") {return , true}return "", false})// Feature is an experimental feature control flag. It provides a uniform way// to interact with these feature flags and parse their values.type Feature[ any] struct {key stringparse func(v string) (, bool)}func newFeature[ any]( string, func(string) (, bool)) Feature[] {const = "OTEL_GO_X_"return Feature[]{key: + ,parse: ,}}// Key returns the environment variable key that needs to be set to enable the// feature.func ( Feature[]) () string { return .key }// 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.func ( Feature[]) () ( , bool) {// https://github.com/open-telemetry/opentelemetry-specification/blob/62effed618589a0bec416a87e559c0a9d96289bb/specification/configuration/sdk-environment-variables.md#parsing-empty-value//// > The SDK MUST interpret an empty value of an environment variable the// > same way as when the variable is unset.:= os.Getenv(.key)if == "" {return ,}return .parse()}// Enabled reports whether the feature is enabled.func ( Feature[]) () bool {, := .Lookup()return}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |