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:
Bernhard Schuster
2020-12-11 17:38:55 +01:00
committed by GitHub
parent 15c253117d
commit a5fe710cc6
20 changed files with 555 additions and 58 deletions
@@ -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) => {