Unverified Commit 20c3d634 authored by Pierre Krieger's avatar Pierre Krieger Committed by GitHub
Browse files

Improve Jaeger errors and debugging experience (#2127)

* Improve Jaeger errors and debugging experience

* Bind on 0.0.0.0:0 instead
parent 41c2e076
Pipeline #117460 passed with stages
in 28 minutes and 56 seconds
...@@ -70,10 +70,4 @@ pub enum JaegerError { ...@@ -70,10 +70,4 @@ pub enum JaegerError {
#[error("Missing jaeger configuration")] #[error("Missing jaeger configuration")]
MissingConfiguration, MissingConfiguration,
#[error("Failed to allocate port for UDP transfer to jaeger agent")]
PortAllocationError(#[source] std::io::Error),
#[error("Failed to send jaeger span to agent")]
SendError(#[source] std::io::Error),
} }
...@@ -210,20 +210,16 @@ impl Jaeger { ...@@ -210,20 +210,16 @@ impl Jaeger {
// Spawn a background task that pulls span information and sends them on the network. // Spawn a background task that pulls span information and sends them on the network.
spawner.spawn("jaeger-collector", Box::pin(async move { spawner.spawn("jaeger-collector", Box::pin(async move {
let res = async_std::net::UdpSocket::bind("127.0.0.1:0").await match async_std::net::UdpSocket::bind("0.0.0.0:0").await {
.map_err(JaegerError::PortAllocationError);
match res {
Ok(udp_socket) => loop { Ok(udp_socket) => loop {
let buf = traces_out.next().await; let buf = traces_out.next().await;
// UDP sending errors happen only either if the API is misused or in case of missing privilege. // UDP sending errors happen only either if the API is misused or in case of missing privilege.
if let Err(e) = udp_socket.send_to(&buf, jaeger_agent).await if let Err(e) = udp_socket.send_to(&buf, jaeger_agent).await {
.map_err(|e| JaegerError::SendError(e)) log::debug!(target: "jaeger", "UDP send error: {}", e);
{
log::trace!("Jaeger: {:?}", e);
} }
} }
Err(e) => { Err(e) => {
log::warn!("Jaeger: {:?}", e); log::warn!(target: "jaeger", "UDP socket open error: {}", e);
} }
} }
})); }));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment