mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
initial jaeger integration (#2047)
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com> Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
15c253117d
commit
a5fe710cc6
@@ -44,6 +44,7 @@ use polkadot_subsystem::messages::{
|
||||
NetworkBridgeMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
errors::{ChainApiError, RuntimeApiError},
|
||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, Subsystem,
|
||||
SubsystemContext, SubsystemError,
|
||||
@@ -354,6 +355,8 @@ where
|
||||
}
|
||||
};
|
||||
|
||||
let mut _span = jaeger::hash_span(&gossiped_availability.candidate_hash.0, "availability-message-received");
|
||||
|
||||
process_incoming_peer_message(ctx, state, remote, gossiped_availability, metrics)
|
||||
.await?;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ use futures::{channel::oneshot, FutureExt};
|
||||
|
||||
use polkadot_subsystem::messages::*;
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, Subsystem, SubsystemContext, SubsystemResult,
|
||||
};
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
@@ -180,7 +181,9 @@ impl BitfieldDistribution {
|
||||
|
||||
for relay_parent in activated {
|
||||
tracing::trace!(target: LOG_TARGET, relay_parent = %relay_parent, "activated");
|
||||
// query basic system parameters once
|
||||
let _span = jaeger::hash_span(&relay_parent, "bitfield-dist:active_leaves:basics");
|
||||
|
||||
// query validator set and signing context per relay_parent once only
|
||||
match query_basics(&mut ctx, relay_parent).await {
|
||||
Ok(Some((validator_set, signing_context))) => {
|
||||
// If our runtime API fails, we don't take down the node,
|
||||
@@ -232,6 +235,7 @@ where
|
||||
Context: SubsystemContext<Message = BitfieldDistributionMessage>,
|
||||
{
|
||||
tracing::trace!(target: LOG_TARGET, rep = ?rep, peer_id = %peer, "reputation change");
|
||||
|
||||
ctx.send_message(AllMessages::NetworkBridge(
|
||||
NetworkBridgeMessage::ReportPeer(peer, rep),
|
||||
))
|
||||
@@ -306,6 +310,9 @@ async fn relay_message<Context>(
|
||||
where
|
||||
Context: SubsystemContext<Message = BitfieldDistributionMessage>,
|
||||
{
|
||||
let span = jaeger::hash_span(&message.relay_parent, "relay_msg");
|
||||
|
||||
let _span = span.child("provisionable");
|
||||
// notify the overseer about a new and valid signed bitfield
|
||||
ctx.send_message(AllMessages::Provisioner(
|
||||
ProvisionerMessage::ProvisionableData(
|
||||
@@ -318,6 +325,9 @@ where
|
||||
))
|
||||
.await;
|
||||
|
||||
drop(_span);
|
||||
|
||||
let _span = span.child("interested peers");
|
||||
// pass on the bitfield distribution to all interested peers
|
||||
let interested_peers = peer_views
|
||||
.iter()
|
||||
@@ -341,6 +351,7 @@ where
|
||||
}
|
||||
})
|
||||
.collect::<Vec<PeerId>>();
|
||||
drop(_span);
|
||||
|
||||
if interested_peers.is_empty() {
|
||||
tracing::trace!(
|
||||
@@ -349,6 +360,7 @@ where
|
||||
"no peers are interested in gossip for relay parent",
|
||||
);
|
||||
} else {
|
||||
let _span = span.child("gossip");
|
||||
ctx.send_message(AllMessages::NetworkBridge(
|
||||
NetworkBridgeMessage::SendValidationMessage(
|
||||
interested_peers,
|
||||
@@ -483,6 +495,8 @@ where
|
||||
NetworkBridgeEvent::PeerMessage(remote, message) => {
|
||||
match message {
|
||||
protocol_v1::BitfieldDistributionMessage::Bitfield(relay_parent, bitfield) => {
|
||||
let mut _span = jaeger::hash_span(&relay_parent, "bitfield-gossip-received");
|
||||
_span.add_string_tag("peer-id", &remote.to_base58());
|
||||
tracing::trace!(target: LOG_TARGET, peer_id = %remote, "received bitfield gossip from peer");
|
||||
let gossiped_bitfield = BitfieldGossipMessage {
|
||||
relay_parent,
|
||||
@@ -581,6 +595,8 @@ where
|
||||
return;
|
||||
};
|
||||
|
||||
let _span = jaeger::hash_span(&message.relay_parent, "gossip");
|
||||
|
||||
job_data.message_sent_to_peer
|
||||
.entry(dest.clone())
|
||||
.or_default()
|
||||
|
||||
@@ -24,6 +24,7 @@ use polkadot_primitives::v1::{
|
||||
CollatorId, CoreIndex, CoreState, Hash, Id as ParaId, CandidateReceipt, PoV, ValidatorId,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
FromOverseer, OverseerSignal, SubsystemContext,
|
||||
messages::{
|
||||
AllMessages, CollatorProtocolMessage,
|
||||
@@ -430,6 +431,8 @@ async fn process_msg(
|
||||
state.collating_on = Some(id);
|
||||
}
|
||||
DistributeCollation(receipt, pov) => {
|
||||
let _span1 = jaeger::hash_span(&receipt.descriptor.relay_parent, "distributing-collation");
|
||||
let _span2 = jaeger::pov_span(&pov, "distributing-collation");
|
||||
match state.collating_on {
|
||||
Some(id) if receipt.descriptor.para_id != id => {
|
||||
// If the ParaId of a collation requested to be distributed does not match
|
||||
@@ -539,10 +542,12 @@ async fn handle_incoming_peer_message(
|
||||
);
|
||||
}
|
||||
RequestCollation(request_id, relay_parent, para_id) => {
|
||||
let _span = jaeger::hash_span(&relay_parent, "rx-collation-request");
|
||||
match state.collating_on {
|
||||
Some(our_para_id) => {
|
||||
if our_para_id == para_id {
|
||||
if let Some(collation) = state.collations.get(&relay_parent).cloned() {
|
||||
let _span = _span.child("sending");
|
||||
send_collation(ctx, state, request_id, origin, collation.0, collation.1).await;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -30,6 +30,7 @@ use polkadot_primitives::v1::{
|
||||
Id as ParaId, CandidateReceipt, CollatorId, Hash, PoV,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
FromOverseer, OverseerSignal, SubsystemContext,
|
||||
messages::{
|
||||
AllMessages, CandidateSelectionMessage, CollatorProtocolMessage, NetworkBridgeMessage,
|
||||
@@ -504,6 +505,7 @@ where
|
||||
state.peer_views.entry(origin).or_default();
|
||||
}
|
||||
AdvertiseCollation(relay_parent, para_id) => {
|
||||
let _span = jaeger::hash_span(&relay_parent, "advertising-collation");
|
||||
state.advertisements.entry(origin.clone()).or_default().insert((para_id, relay_parent));
|
||||
|
||||
if let Some(collator) = state.known_collators.get(&origin) {
|
||||
@@ -515,6 +517,8 @@ where
|
||||
modify_reputation(ctx, origin, COST_UNEXPECTED_MESSAGE).await;
|
||||
}
|
||||
Collation(request_id, receipt, pov) => {
|
||||
let _span1 = jaeger::hash_span(&receipt.descriptor.relay_parent, "received-collation");
|
||||
let _span2 = jaeger::pov_span(&pov, "received-collation");
|
||||
received_collation(ctx, state, origin, request_id, receipt, pov).await;
|
||||
}
|
||||
}
|
||||
@@ -659,6 +663,7 @@ where
|
||||
);
|
||||
}
|
||||
FetchCollation(relay_parent, collator_id, para_id, tx) => {
|
||||
let _span = jaeger::hash_span(&relay_parent, "fetching-collation");
|
||||
fetch_collation(ctx, state, relay_parent, collator_id, para_id, tx).await;
|
||||
}
|
||||
ReportCollator(id) => {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
Subsystem, SubsystemResult, SubsystemContext, SpawnedSubsystem,
|
||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal,
|
||||
messages::{
|
||||
@@ -828,6 +829,7 @@ async fn handle_network_update(
|
||||
).await;
|
||||
|
||||
if let Some((relay_parent, new)) = new_stored {
|
||||
let mut _span = jaeger::hash_span(&relay_parent, "sending-statement");
|
||||
// When we receive a new message from a peer, we forward it to the
|
||||
// candidate backing subsystem.
|
||||
let message = AllMessages::CandidateBacking(
|
||||
@@ -943,6 +945,7 @@ impl StatementDistribution {
|
||||
FromOverseer::Communication { msg } => match msg {
|
||||
StatementDistributionMessage::Share(relay_parent, statement) => {
|
||||
let _timer = metrics.time_share();
|
||||
let mut _span = jaeger::hash_span(&relay_parent, "circulate-statement");
|
||||
|
||||
inform_statement_listeners(
|
||||
&statement,
|
||||
|
||||
Reference in New Issue
Block a user