-
Notifications
You must be signed in to change notification settings - Fork 629
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(o11y): Attach tracing context to ClientActor work items #7773
Conversation
Use a faster way of converting `shard_id` to a string. Crate `itoa` provides the fastest way of converting ints to strings. Snapshot of metrics from a mainnet node. Note that some metrics are not incremented by 1 (`inc()`), but rather by a larger number using `inc_by()`. ``` 1948843343 near_chunk_cache_hits # Not hot 399446179 near_chunk_cache_misses # Not hot 376782133 near_shard_cache_hits # Not hot 276622570 near_peer_manager_messages_time_count 239378614 near_applied_trie_deletions # Optimized 206898552 near_database_op_latency_by_op_and_column_count 184492507 near_peer_message_sent_by_type_total 179740890 near_peer_message_received_total 179344494 near_peer_message_received_by_type_total 168098152 near_applied_trie_insertions # Optimized 160684011 near_shard_cache_pop_hits # Not hot 100536077 near_client_triggers_time_count 100064991 near_requests_count_by_type_total 98868135 near_client_messages_processing_time_count 98868135 near_client_messages_count 97408226 near_peer_client_message_received_by_type_total 94021301 near_network_routed_msg_latency_count 80880283 partial_encoded_chunk_request_delay_count 78394032 near_shard_cache_gc_pop_misses 51277767 partial_encoded_chunk_response_delay_count 43248133 near_partial_encoded_chunk_request_processing_time_count 22664046 near_shard_cache_misses # Not hot ```
…work items. Change `trace_span` to `debug_span` for messages handled by PeerActor. The reason is that this lets us compute the delay between a work item being passed between different actors.
…work items. Change `trace_span` to `debug_span` for messages handled by PeerActor. The reason is that this lets us compute the delay between a work item being passed between different actors.
Refactor attaching span context
/// This lets us trace execution across several actix Actors. | ||
#[derive(actix::Message, Debug)] | ||
#[rtype(result = "<T as actix::Message>::Result")] | ||
pub struct WithSpanContext<T: actix::Message> { |
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.
If we ever want to make this more generally applicable in the future, we could implement the actix::Message
trait manually, thus removing the T: actix::Message
bound here. It is fine as-is for now, though. Maybe we will never get to the point where we need this sort of functionality elsehwere.
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.
LGTM
Also refactor attaching span context: Use a extension trait to easily wrap actix messages into a struct `WithSpanContext` that is initialized with the current context. cc: @nagisa
Also refactor attaching span context: Use a extension trait to easily
wrap actix messages into a struct
WithSpanContext
that isinitialized with the current context.
cc: @nagisa