Skip to content

Commit 30f285c

Browse files
committed
Fix
1 parent d7e32dc commit 30f285c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::trace::{Sampler, ShouldSample};
55
use futures_util::{stream, StreamExt as _};
66
use http::Uri;
77
use opentelemetry::trace::{Link, SamplingResult, SpanKind, TraceError, TraceId};
8-
use opentelemetry::{otel_debug, Context, KeyValue};
8+
use opentelemetry::{otel_error, Context, KeyValue};
99
use opentelemetry_http::HttpClient;
1010
use std::str::FromStr;
1111
use std::sync::Arc;
@@ -204,9 +204,9 @@ impl JaegerRemoteSampler {
204204
match Self::request_new_strategy(&client, endpoint.clone()).await {
205205
Ok(remote_strategy_resp) => strategy.update(remote_strategy_resp),
206206
Err(err_msg) => {
207-
otel_debug!(
207+
otel_error!(
208208
name: "JaegerRemoteSampler.UpdateStrategy.RequestFailed",
209-
message = "Failed to fetch new sampling strategy",
209+
message = "Failed to fetch new sampling strategy from remote endpoint. This may cause the sampler to use stale configuration until the next successful update.",
210210
reason = format!("{}", err_msg),
211211
);
212212
}

opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampling_strategy.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::trace::sampler::sample_based_on_probability;
66
use opentelemetry::trace::{
77
SamplingDecision, SamplingResult, TraceContextExt, TraceId, TraceState,
88
};
9-
use opentelemetry::{otel_debug, Context};
9+
use opentelemetry::{otel_warn, Context};
1010
use std::collections::HashMap;
1111
use std::fmt::{Debug, Formatter};
1212
use std::sync::Mutex;
@@ -109,7 +109,7 @@ impl Inner {
109109
.unwrap_or_else(|_err| {
110110
otel_debug!(
111111
name: "JaegerRemoteSampler.MutexPoisoned",
112-
reason = "Failed to update strategy due to poisoned mutex"
112+
message = "Failed to update Jaeger Remote sampling strategy. The sampler's internal mutex is poisoned, indicating a panic occurred in another thread holding the lock. Sampling decisions may be using stale configuration.",
113113
);
114114
});
115115
}
@@ -138,7 +138,15 @@ impl Inner {
138138
(_, _, Some(probabilistic)) => {
139139
Some(Strategy::Probabilistic(probabilistic.sampling_rate))
140140
}
141-
_ => None,
141+
_ => {
142+
otel_warn!(
143+
name: "Sampler.JaegerRemote.InvalidStrategy",
144+
message = "Received invalid sampling strategy from Jaeger remote endpoint. Expected one of: OperationSampling, RateLimitingSampling (max traces per second), or ProbabilisticSampling (0.0-1.0 sampling probability). No valid strategy was found in the response. Using previous strategy if available.",
145+
received_operation_sampling = operation_sampling.is_some(),
146+
received_rate_limiting = rate_limiting_sampling.is_some(),
147+
received_probabilistic = probabilistic_sampling.is_some()
148+
);
149+
}
142150
}
143151
}
144152

0 commit comments

Comments
 (0)