Skip to content

Commit 8af2de2

Browse files
Rename oltp_endpoint to otlp_endpoint to match opentelemetry spec and lib name (#5068)
* rename oltp_endpoint to otlp_endpoint to be consistent with library name and spec Signed-off-by: bha <[email protected]> * update changelog Signed-off-by: bha <[email protected]> * change BUGFIX to CHANGE Signed-off-by: bha <[email protected]> * deprecate instead of remove Signed-off-by: bha <[email protected]> * fix errors because I forgot this is golang and not python lol Signed-off-by: sharkymcdongles <[email protected]> * improve documentation comment Signed-off-by: sharkymcdongles <[email protected]> * remove newline Signed-off-by: sharkymcdongles <[email protected]> * hide deprecated config Signed-off-by: sharkymcdongles <[email protected]> * remove hidden Signed-off-by: sharkymcdongles <[email protected]> --------- Signed-off-by: bha <[email protected]> Signed-off-by: sharkymcdongles <[email protected]> Signed-off-by: Bryan <[email protected]>
1 parent bfb1f94 commit 8af2de2

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## master / unreleased
44
* [CHANGE] Alertmanager: Local file disclosure vulnerability in OpsGenie configuration has been fixed. #5045
5+
* [CHANGE] Rename oltp_endpoint to otlp_endpoint to match opentelemetry spec and lib name. #5067
56
* [CHANGE] Distributor/Ingester: Log warn level on push requests when they have status code 4xx. Do not log if status is 429. #5103
67
* [ENHANCEMENT] Update Go version to 1.19.3. #4988
78
* [ENHANCEMENT] Querier: limit series query to only ingesters if `start` param is not specified. #4976

docs/configuration/config-file-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4158,8 +4158,8 @@ The `tracing_config` configures backends cortex uses.
41584158

41594159
otel:
41604160
# otl collector endpoint that the driver will use to send spans.
4161-
# CLI flag: -tracing.otel.oltp-endpoint
4162-
[oltp_endpoint: <string> | default = ""]
4161+
# CLI flag: -tracing.otel.otlp-endpoint
4162+
[otlp_endpoint: <string> | default = ""]
41634163

41644164
# enhance/modify traces/propagators for specific exporter. If empty, OTEL
41654165
# defaults will apply. Supported values are: `awsxray.`

pkg/tracing/tracing.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ type Config struct {
3838
}
3939

4040
type Otel struct {
41-
OltpEndpoint string `yaml:"oltp_endpoint" json:"oltp_endpoint"`
41+
OltpEndpoint string `yaml:"oltp_endpoint" json:"oltp_endpoint" doc:"hidden"`
42+
OtlpEndpoint string `yaml:"otlp_endpoint" json:"otlp_endpoint"`
4243
ExporterType string `yaml:"exporter_type" json:"exporter_type"`
4344
SampleRatio float64 `yaml:"sample_ratio" json:"sample_ratio"`
4445
TLSEnabled bool `yaml:"tls_enabled"`
@@ -51,7 +52,8 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) {
5152
p := "tracing"
5253
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 .")
5354
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.")
54-
f.StringVar(&c.Otel.OltpEndpoint, p+".otel.oltp-endpoint", "", "otl collector endpoint that the driver will use to send spans.")
55+
f.StringVar(&c.Otel.OltpEndpoint, p+".otel.oltp-endpoint", "", "DEPRECATED: use otel.otlp-endpoint instead.")
56+
f.StringVar(&c.Otel.OtlpEndpoint, p+".otel.otlp-endpoint", "", "otl collector endpoint that the driver will use to send spans.")
5557
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.`")
5658
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.")
5759
c.Otel.TLS.RegisterFlagsWithPrefix(p+".otel.tls", f)
@@ -60,8 +62,11 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) {
6062
func (c *Config) Validate() error {
6163
switch strings.ToLower(c.Type) {
6264
case OtelType:
63-
if c.Otel.OltpEndpoint == "" {
64-
return errors.New("oltp-endpoint must be defined when using otel exporter")
65+
if (c.Otel.OtlpEndpoint == "") && (c.Otel.OltpEndpoint == "") {
66+
return errors.New("otlp-endpoint must be defined when using otel exporter")
67+
}
68+
if len(c.Otel.OltpEndpoint) > 0 {
69+
level.Warn(util_log.Logger).Log("DEPRECATED: otel.oltp-endpoint is deprecated. User otel.otlp-endpoint instead.")
6570
}
6671
}
6772

@@ -83,8 +88,19 @@ func SetupTracing(ctx context.Context, name string, c Config) (func(context.Cont
8388
case OtelType:
8489
util_log.Logger.Log("msg", "creating otel exporter")
8590

91+
if (len(c.Otel.OtlpEndpoint) > 0) && (len(c.Otel.OltpEndpoint) > 0) {
92+
level.Warn(util_log.Logger).Log("msg", "DEPRECATED: otel.otlp and otel.oltp both set, using otel.otlp because otel.oltp is deprecated")
93+
}
94+
8695
options := []otlptracegrpc.Option{
87-
otlptracegrpc.WithEndpoint(c.Otel.OltpEndpoint),
96+
otlptracegrpc.WithEndpoint(c.Otel.OtlpEndpoint),
97+
}
98+
99+
if (c.Otel.OtlpEndpoint == "") && (len(c.Otel.OltpEndpoint) > 0) {
100+
level.Warn(util_log.Logger).Log("msg", "DEPRECATED: otel.oltp is deprecated use otel.otlp")
101+
options = []otlptracegrpc.Option{
102+
otlptracegrpc.WithEndpoint(c.Otel.OltpEndpoint),
103+
}
88104
}
89105

90106
if c.Otel.TLSEnabled {

0 commit comments

Comments
 (0)