diff --git a/CHANGELOG.md b/CHANGELOG.md index dce9f511e4f..fc17ca6d168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## master / unreleased * [CHANGE] Alertmanager: Local file disclosure vulnerability in OpsGenie configuration has been fixed. #5045 +* [CHANGE] Rename oltp_endpoint to otlp_endpoint to match opentelemetry spec and lib name. #5067 * [CHANGE] Distributor/Ingester: Log warn level on push requests when they have status code 4xx. Do not log if status is 429. #5103 * [ENHANCEMENT] Update Go version to 1.19.3. #4988 * [ENHANCEMENT] Querier: limit series query to only ingesters if `start` param is not specified. #4976 diff --git a/docs/configuration/config-file-reference.md b/docs/configuration/config-file-reference.md index ab75686cc23..18e56571ba0 100644 --- a/docs/configuration/config-file-reference.md +++ b/docs/configuration/config-file-reference.md @@ -4158,8 +4158,8 @@ The `tracing_config` configures backends cortex uses. otel: # otl collector endpoint that the driver will use to send spans. - # CLI flag: -tracing.otel.oltp-endpoint - [oltp_endpoint: | default = ""] + # CLI flag: -tracing.otel.otlp-endpoint + [otlp_endpoint: | default = ""] # enhance/modify traces/propagators for specific exporter. If empty, OTEL # defaults will apply. Supported values are: `awsxray.` diff --git a/pkg/tracing/tracing.go b/pkg/tracing/tracing.go index c562d771cf1..bfa97e6a06f 100644 --- a/pkg/tracing/tracing.go +++ b/pkg/tracing/tracing.go @@ -38,7 +38,8 @@ type Config struct { } type Otel struct { - OltpEndpoint string `yaml:"oltp_endpoint" json:"oltp_endpoint"` + OltpEndpoint string `yaml:"oltp_endpoint" json:"oltp_endpoint" doc:"hidden"` + OtlpEndpoint string `yaml:"otlp_endpoint" json:"otlp_endpoint"` ExporterType string `yaml:"exporter_type" json:"exporter_type"` SampleRatio float64 `yaml:"sample_ratio" json:"sample_ratio"` TLSEnabled bool `yaml:"tls_enabled"` @@ -51,7 +52,8 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) { p := "tracing" f.StringVar(&c.Type, p+".type", JaegerType, "Tracing type. OTEL and JAEGER are currently supported. For jaeger `JAEGER_AGENT_HOST` environment variable should also be set. See: https://cortexmetrics.io/docs/guides/tracing .") f.Float64Var(&c.Otel.SampleRatio, p+".otel.sample-ratio", 0.001, "Fraction of traces to be sampled. Fractions >= 1 means sampling if off and everything is traced.") - f.StringVar(&c.Otel.OltpEndpoint, p+".otel.oltp-endpoint", "", "otl collector endpoint that the driver will use to send spans.") + f.StringVar(&c.Otel.OltpEndpoint, p+".otel.oltp-endpoint", "", "DEPRECATED: use otel.otlp-endpoint instead.") + f.StringVar(&c.Otel.OtlpEndpoint, p+".otel.otlp-endpoint", "", "otl collector endpoint that the driver will use to send spans.") f.StringVar(&c.Otel.ExporterType, p+".otel.exporter-type", "", "enhance/modify traces/propagators for specific exporter. If empty, OTEL defaults will apply. Supported values are: `awsxray.`") f.BoolVar(&c.Otel.TLSEnabled, p+".otel.tls-enabled", c.Otel.TLSEnabled, "Enable TLS in the GRPC client. This flag needs to be enabled when any other TLS flag is set. If set to false, insecure connection to gRPC server will be used.") c.Otel.TLS.RegisterFlagsWithPrefix(p+".otel.tls", f) @@ -60,8 +62,11 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) { func (c *Config) Validate() error { switch strings.ToLower(c.Type) { case OtelType: - if c.Otel.OltpEndpoint == "" { - return errors.New("oltp-endpoint must be defined when using otel exporter") + if (c.Otel.OtlpEndpoint == "") && (c.Otel.OltpEndpoint == "") { + return errors.New("otlp-endpoint must be defined when using otel exporter") + } + if len(c.Otel.OltpEndpoint) > 0 { + level.Warn(util_log.Logger).Log("DEPRECATED: otel.oltp-endpoint is deprecated. User otel.otlp-endpoint instead.") } } @@ -83,8 +88,19 @@ func SetupTracing(ctx context.Context, name string, c Config) (func(context.Cont case OtelType: util_log.Logger.Log("msg", "creating otel exporter") + if (len(c.Otel.OtlpEndpoint) > 0) && (len(c.Otel.OltpEndpoint) > 0) { + level.Warn(util_log.Logger).Log("msg", "DEPRECATED: otel.otlp and otel.oltp both set, using otel.otlp because otel.oltp is deprecated") + } + options := []otlptracegrpc.Option{ - otlptracegrpc.WithEndpoint(c.Otel.OltpEndpoint), + otlptracegrpc.WithEndpoint(c.Otel.OtlpEndpoint), + } + + if (c.Otel.OtlpEndpoint == "") && (len(c.Otel.OltpEndpoint) > 0) { + level.Warn(util_log.Logger).Log("msg", "DEPRECATED: otel.oltp is deprecated use otel.otlp") + options = []otlptracegrpc.Option{ + otlptracegrpc.WithEndpoint(c.Otel.OltpEndpoint), + } } if c.Otel.TLSEnabled {