Skip to content

Commit

Permalink
tracing spans
Browse files Browse the repository at this point in the history
  • Loading branch information
eserilev committed Nov 27, 2024
1 parent 77fc2d4 commit 35532a2
Show file tree
Hide file tree
Showing 15 changed files with 1,099 additions and 182 deletions.
308 changes: 264 additions & 44 deletions beacon_node/beacon_chain/src/validator_monitor.rs

Large diffs are not rendered by default.

42 changes: 36 additions & 6 deletions beacon_node/lighthouse_network/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ pub struct RPC<Id: ReqId, E: EthSpec> {
}

impl<Id: ReqId, E: EthSpec> RPC<Id, E> {
#[instrument(level = "trace", name = "libp2p_rpc", skip(network_params))]
#[instrument(
level = "trace",
fields(service = "libp2p_rpc"),
name = "libp2p_rpc",
skip(network_params)
)]
pub fn new(
fork_context: Arc<ForkContext>,
enable_light_client_server: bool,
Expand Down Expand Up @@ -200,7 +205,12 @@ impl<Id: ReqId, E: EthSpec> RPC<Id, E> {
/// Sends an RPC response.
///
/// The peer must be connected for this to succeed.
#[instrument(level = "trace", name = "libp2p_rpc", skip(self))]
#[instrument(
level = "trace",
fields(service = "libp2p_rpc"),
name = "libp2p_rpc",
skip(self)
)]
pub fn send_response(
&mut self,
peer_id: PeerId,
Expand All @@ -218,7 +228,12 @@ impl<Id: ReqId, E: EthSpec> RPC<Id, E> {
/// Submits an RPC request.
///
/// The peer must be connected for this to succeed.
#[instrument(level = "trace", name = "libp2p_rpc", skip(self))]
#[instrument(
level = "trace",
fields(service = "libp2p_rpc"),
name = "libp2p_rpc",
skip(self)
)]
pub fn send_request(&mut self, peer_id: PeerId, request_id: Id, req: RequestType<E>) {
let event = if let Some(self_limiter) = self.self_limiter.as_mut() {
match self_limiter.allows(peer_id, request_id, req) {
Expand All @@ -241,7 +256,12 @@ impl<Id: ReqId, E: EthSpec> RPC<Id, E> {

/// Lighthouse wishes to disconnect from this peer by sending a Goodbye message. This
/// gracefully terminates the RPC behaviour with a goodbye message.
#[instrument(level = "trace", name = "libp2p_rpc", skip(self))]
#[instrument(
level = "trace",
fields(service = "libp2p_rpc"),
name = "libp2p_rpc",
skip(self)
)]
pub fn shutdown(&mut self, peer_id: PeerId, id: Id, reason: GoodbyeReason) {
self.events.push(ToSwarm::NotifyHandler {
peer_id,
Expand All @@ -250,13 +270,23 @@ impl<Id: ReqId, E: EthSpec> RPC<Id, E> {
});
}

#[instrument(level = "trace", name = "libp2p_rpc", skip(self))]
#[instrument(
level = "trace",
fields(service = "libp2p_rpc"),
name = "libp2p_rpc",
skip(self)
)]
pub fn update_seq_number(&mut self, seq_number: u64) {
self.seq_number = seq_number
}

/// Send a Ping request to the destination `PeerId` via `ConnectionId`.
#[instrument(level = "trace", name = "libp2p_rpc", skip(self))]
#[instrument(
level = "trace",
fields(service = "libp2p_rpc"),
name = "libp2p_rpc",
skip(self)
)]
pub fn ping(&mut self, peer_id: PeerId, id: Id) {
let ping = Ping {
data: self.seq_number,
Expand Down
Loading

0 comments on commit 35532a2

Please sign in to comment.