Source File
x.go
Belonging Package
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x
// Code generated by gotmpl. DO NOT MODIFY.// source: internal/shared/x/x.go.tmpl// Copyright The OpenTelemetry Authors// SPDX-License-Identifier: Apache-2.0// Package x documents experimental features for [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc].package x // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x"import ()// 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 {keys []stringparse func(v string) (, bool)}func newFeature[ any]( []string, func(string) (, bool)) Feature[] {const = "OTEL_GO_X_":= make([]string, 0, len())for , := range {= append(, +)}return Feature[]{keys: ,parse: ,}}// Keys returns the environment variable keys that can be set to enable the// feature.func ( Feature[]) () []string { return .keys }// 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.for , := range .keys {:= os.Getenv()if != "" {return .parse()}}return ,}// 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. |