Skip to content

Commit

Permalink
feat: ignore links with invalid context (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyCpp committed May 4, 2021
1 parent 3a8123c commit b3623ab
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion opentelemetry-datadog/README.md
Expand Up @@ -82,7 +82,7 @@ to [`Datadog`].
// Traced app logic here...
});
opentelemetry::global::shut_down_provider();
opentelemetry::global::shutdown_tracer_provider();
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-jaeger/README.md
Expand Up @@ -53,7 +53,7 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
// Traced app logic here...
});

global::shut_down_provider(); // sending remaining spans
global::shutdown_tracer_provider(); // sending remaining spans

Ok(())
}
Expand Down Expand Up @@ -131,7 +131,7 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
// Traced app logic here...
});

opentelemetry::global::shut_down_provider(); // sending remaining spans
opentelemetry::global::shutdown_tracer_provider(); // sending remaining spans

Ok(())
}
Expand Down Expand Up @@ -175,7 +175,7 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
// Traced app logic here...
});

global::shut_down_provider(); // sending remaining spans
global::shutdown_tracer_provider(); // sending remaining spans

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-zipkin/README.md
Expand Up @@ -53,7 +53,7 @@ fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
// Traced app logic here...
});

global::shut_down_provider();
global::shutdown_tracer_provider();

Ok(())
}
Expand Down Expand Up @@ -153,7 +153,7 @@ fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
// Traced app logic here...
});

global::shut_down_provider();
global::shutdown_tracer_provider();

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry/src/sdk/trace/span.rs
Expand Up @@ -523,8 +523,8 @@ mod tests {

let mut link = Link::new(
SpanContext::new(
TraceId::from_u128(0),
SpanId::from_u64(0),
TraceId::from_u128(12),
SpanId::from_u64(12),
0,
false,
Default::default(),
Expand Down
3 changes: 2 additions & 1 deletion opentelemetry/src/trace/tracer.rs
Expand Up @@ -458,7 +458,8 @@ impl SpanBuilder {
}

/// Assign links
pub fn with_links(self, links: Vec<Link>) -> Self {
pub fn with_links(self, mut links: Vec<Link>) -> Self {
links.retain(|l| l.span_context().is_valid());
SpanBuilder {
links: Some(links),
..self
Expand Down

0 comments on commit b3623ab

Please sign in to comment.