-
Notifications
You must be signed in to change notification settings - Fork 554
fix: Modify SpanExporter trait to use immutable references for shutdown and force_flush methods #3066
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
base: main
Are you sure you want to change the base?
fix: Modify SpanExporter trait to use immutable references for shutdown and force_flush methods #3066
Changes from 7 commits
1e5da1e
d296a3c
d4cd0ee
71fc798
6dfee01
94817d7
85cdc91
99da387
e512fba
49c9bca
8fb8894
d65d0ec
35e236d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,7 @@ impl InMemoryLogExporterBuilder { | |
|
||
/// If set, the records will not be [`InMemoryLogExporter::reset`] on shutdown. | ||
#[cfg(test)] | ||
#[allow(dead_code)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're correct - the |
||
pub(crate) fn keep_records_on_shutdown(self) -> Self { | ||
Self { | ||
reset_on_shutdown: false, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -607,8 +607,8 @@ mod tests { | |
tracer.in_span("test-span", |cx| { | ||
let ambient_ctxt = cx.span().span_context().clone(); | ||
let explicit_ctxt = TraceContext { | ||
trace_id: TraceId::from_u128(13), | ||
span_id: SpanId::from_u64(14), | ||
trace_id: TraceId::from_bytes([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot This change seems irrelevant to the PR - can it removed if so? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right - those changes to the test code were unrelated to the SpanExporter trait modifications. I've reverted them back to use |
||
span_id: SpanId::from_bytes([0, 0, 0, 0, 0, 0, 0, 14]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://gh.io/copilot-coding-agent-docs This change seems irrelevant to the PR - can it removed if so? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right - those changes to the test code were unrelated to the SpanExporter trait modifications. I've reverted them back to use |
||
trace_flags: None, | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot This looks incorrect. The previous implementation showed the correct thing. need to continue to do the same even though we dont need mutable ref anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right! I've restored the proper shutdown semantics in commit d65d0ec. The TonicTracesClient now uses
Mutex<Option<ClientInner>>
to properly track shutdown state with&self
, preserving the original behavior where the first call to shutdown() returns Ok(()) and subsequent calls return Err(AlreadyShutdown).