Skip to content

Commit f619e60

Browse files
committed
review comments
1 parent f1c7fa6 commit f619e60

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

opentelemetry-sdk/src/trace/config.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ impl Default for Config {
130130
Box::new(Sampler::TraceIdRatioBased(r))
131131
} else {
132132
otel_warn!(
133-
name: "TracesSampler.TraceIdRatio.Error",
134-
message= "Missing or invalid OTEL_TRACES_SAMPLER_ARG env variable. Falling back to default: 1.0"
133+
name: "Sampler.TraceIdRatio.InvalidArgument",
134+
message = "OTEL_TRACES_SAMPLER is set to 'traceidratio' but OTEL_TRACES_SAMPLER_ARG environment variable is missing or invalid. OTEL_TRACES_SAMPLER_ARG must be a valid float between 0.0 and 1.0 representing the desired sampling probability (0.0 = no traces sampled, 1.0 = all traces sampled, 0.5 = 50% of traces sampled). Falling back to default ratio: 1.0 (100% sampling)"
135135
);
136136
Box::new(Sampler::TraceIdRatioBased(1.0))
137137
}
@@ -150,39 +150,42 @@ impl Default for Config {
150150
))))
151151
} else {
152152
otel_warn!(
153-
name: "TracesSampler.ParentBasedTraceIdRatio.Error",
154-
message = "Missing or invalid OTEL_TRACES_SAMPLER_ARG env variable. Falling back to default: 1.0"
153+
name: "Sampler.ParentBasedTraceIdRatio.InvalidArgument",
154+
message = "OTEL_TRACES_SAMPLER is set to 'parentbased_traceidratio' but OTEL_TRACES_SAMPLER_ARG environment variable is missing or invalid. OTEL_TRACES_SAMPLER_ARG must be a valid float between 0.0 and 1.0 representing the desired sampling probability (0.0 = no traces sampled, 1.0 = all traces sampled, 0.5 = 50% of traces sampled). Falling back to default ratio: 1.0 (100% sampling)"
155155
);
156156
Box::new(Sampler::ParentBased(Box::new(Sampler::TraceIdRatioBased(
157157
1.0,
158158
))))
159159
}
160160
}
161161
"parentbased_jaeger_remote" => {
162-
otel_debug!(
163-
name: "TracesSampler.ParentBasedJaegerRemote.Error",
164-
message = "Unimplemented parentbased_jaeger_remote sampler. Falling back to default: parentbased_always_on"
162+
otel_warn!(
163+
name: "Sampler.ParentBasedJaegerRemote.Unsupported",
164+
message = "ParentBased JaegerRemote sampler is not implemented in this SDK version. Using fallback sampler: ParentBased(AlwaysOn). Configure an alternative sampler using OTEL_TRACES_SAMPLER"
165165
);
166166
Box::new(Sampler::ParentBased(Box::new(Sampler::AlwaysOn)))
167167
}
168168
"jaeger_remote" => {
169-
otel_debug!(
170-
name: "TracesSampler.JaegerRemote.Error",
171-
message = "Unimplemented jaeger_remote sampler. Falling back to default: parentbased_always_on"
169+
otel_warn!(
170+
name: "Sampler.JaegerRemote.Unsupported",
171+
message = "JaegerRemote sampler is not implemented in this SDK version. Using fallback sampler: ParentBased(AlwaysOn). Configure an alternative sampler using OTEL_TRACES_SAMPLER"
172172
);
173173
Box::new(Sampler::ParentBased(Box::new(Sampler::AlwaysOn)))
174174
}
175175
"xray" => {
176-
otel_debug!(
177-
name: "TracesSampler.Xray.Error",
178-
message = "Unimplemented xray sampler. Falling back to default: parentbased_always_on"
176+
otel_warn!(
177+
name: "Sampler.XRay.Unsupported",
178+
message = "AWS X-Ray sampler is not implemented in this SDK version. Using fallback sampler: ParentBased(AlwaysOn). Configure an alternative sampler using OTEL_TRACES_SAMPLER"
179179
);
180180
Box::new(Sampler::ParentBased(Box::new(Sampler::AlwaysOn)))
181181
}
182182
s => {
183183
otel_warn!(
184-
name: "TracesSampler.Unknown.Error",
185-
message = "Unrecognised OTEL_TRACES_SAMPLER env variable. Falling back to default: parentbased_always_on",
184+
name: "Sampler.Configuration.InvalidSamplerType",
185+
message = format!(
186+
"Unrecognized sampler type '{}' in OTEL_TRACES_SAMPLER environment variable. Valid values are: always_on, always_off, traceidratio, parentbased_always_on, parentbased_always_off, parentbased_traceidratio. Using fallback sampler: ParentBased(AlwaysOn)",
187+
s
188+
),
186189
sampler = s
187190
);
188191
Box::new(Sampler::ParentBased(Box::new(Sampler::AlwaysOn)))

0 commit comments

Comments
 (0)