Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ignore links with invalid context #538

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion opentelemetry-datadog/README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
7 changes: 6 additions & 1 deletion opentelemetry/src/trace/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,12 @@ impl SpanBuilder {
/// Assign links
pub fn with_links(self, links: Vec<Link>) -> Self {
SpanBuilder {
links: Some(links),
links: Some(
links
.into_iter()
.filter(|l| l.span_context().is_valid())
.collect(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use Vec::retain instead of allocating a new one here?

),
..self
}
}
Expand Down