Fix collab logging (#10095)
span! statically determines which fields are available, and record silently fails if you write to a field that is not available :/ Release Notes: - N/A
This commit is contained in:
parent
9317fe46af
commit
65cde17063
1 changed files with 13 additions and 2 deletions
|
@ -734,7 +734,13 @@ impl Server {
|
||||||
executor: Executor,
|
executor: Executor,
|
||||||
) -> impl Future<Output = ()> {
|
) -> impl Future<Output = ()> {
|
||||||
let this = self.clone();
|
let this = self.clone();
|
||||||
let span = info_span!("handle connection", %address, impersonator = field::Empty, connection_id = field::Empty);
|
let span = info_span!("handle connection", %address,
|
||||||
|
connection_id=field::Empty,
|
||||||
|
user_id=field::Empty,
|
||||||
|
login=field::Empty,
|
||||||
|
impersonator=field::Empty,
|
||||||
|
dev_server_id=field::Empty
|
||||||
|
);
|
||||||
principal.update_span(&span);
|
principal.update_span(&span);
|
||||||
|
|
||||||
let mut teardown = self.teardown.subscribe();
|
let mut teardown = self.teardown.subscribe();
|
||||||
|
@ -812,7 +818,12 @@ impl Server {
|
||||||
let type_name = message.payload_type_name();
|
let type_name = message.payload_type_name();
|
||||||
// note: we copy all the fields from the parent span so we can query them in the logs.
|
// note: we copy all the fields from the parent span so we can query them in the logs.
|
||||||
// (https://github.com/tokio-rs/tracing/issues/2670).
|
// (https://github.com/tokio-rs/tracing/issues/2670).
|
||||||
let span = tracing::info_span!("receive message", %connection_id, %address, type_name);
|
let span = tracing::info_span!("receive message", %connection_id, %address, type_name,
|
||||||
|
user_id=field::Empty,
|
||||||
|
login=field::Empty,
|
||||||
|
impersonator=field::Empty,
|
||||||
|
dev_server_id=field::Empty
|
||||||
|
);
|
||||||
principal.update_span(&span);
|
principal.update_span(&span);
|
||||||
let span_enter = span.enter();
|
let span_enter = span.enter();
|
||||||
if let Some(handler) = this.handlers.get(&message.payload_type_id()) {
|
if let Some(handler) = this.handlers.get(&message.payload_type_id()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue