Debian Codegraph @

sdk/internal/x/features.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Package x documents experimental features for [go.opentelemetry.io/otel/sdk].
5 package x // import "go.opentelemetry.io/otel/sdk/internal/x"
6
7 import "strings"
8
9 // Resource is an experimental feature flag that defines if resource detectors
10 // should be included experimental semantic conventions.
11 //
12 // To enable this feature set the OTEL_GO_X_RESOURCE environment variable
13 // to the case-insensitive string value of "true" (i.e. "True" and "TRUE"
14 // will also enable this).
15 var Resource = newFeature(
16 []string{"RESOURCE"},
17 func(v string) (string, bool) {
18 if strings.EqualFold(v, "true") {
19 return v, true
20 }
21 return "", false
22 },
23 )
24
25 // Observability is an experimental feature flag that determines if SDK
26 // observability metrics are enabled.
27 //
28 // To enable this feature set the OTEL_GO_X_OBSERVABILITY environment variable
29 // to the case-insensitive string value of "true" (i.e. "True" and "TRUE"
30 // will also enable this).
31 var Observability = newFeature(
32 []string{"OBSERVABILITY", "SELF_OBSERVABILITY"},
33 func(v string) (string, bool) {
34 if strings.EqualFold(v, "true") {
35 return v, true
36 }
37 return "", false
38 },
39 )
40
41 // PerSeriesStartTimestamps is an experimental feature flag that determines if the SDK
42 // uses the new Start Timestamps specification.
43 //
44 // To enable this feature set the OTEL_GO_X_PER_SERIES_START_TIMESTAMPS environment variable
45 // to the case-insensitive string value of "true".
46 var PerSeriesStartTimestamps = newFeature(
47 []string{"PER_SERIES_START_TIMESTAMPS"},
48 func(v string) (bool, bool) {
49 if strings.EqualFold(v, "true") {
50 return true, true
51 }
52 return false, false
53 },
54 )