Path: blob/main/component/otelcol/internal/featuregate/install.go
4096 views
// Package featuregate automatically enables upstream feature gates that1// otelcol components require. The package must be imported for the feature2// gates to be enabled.3package featuregate45import (6"os"78"go.opentelemetry.io/collector/featuregate"910_ "go.opentelemetry.io/collector/obsreport" // telemetry.useOtelForInternalMetrics11)1213// TODO(rfratto): this package should be updated occasionally to remove feature14// gates which no longer exist.15//16// Once all feature gates are removed, this package can be removed as well.1718func init() {19_ = enableFeatureGates(featuregate.GetRegistry())20}2122func enableFeatureGates(reg *featuregate.Registry) error {23// TODO(marctc): temporary workaround to fix issue with traces' metrics not24// being collected even flow is not enabled.25return reg.Apply(map[string]bool{26"telemetry.useOtelForInternalMetrics": isFlowRunning(),27})28}2930func isFlowRunning() bool {31key, _ := os.LookupEnv("AGENT_MODE")3233switch key {34case "flow":35return true36default:37return false38}39}404142