approval-distribution: Add approvals/assignments spans on all paths (#7317)

* approval-distribution: Add approvals/assignments spans on all paths

The approval and assignment logic gets called from multiple paths, so make sure
we create a tracing span on all paths to make debugging easier and be able and
correlate with the spans from approval-voting.

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* Tag each label with a difference tracing name

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

* Address review feedback

Use the source to determine the tag name

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
This commit is contained in:
Alexandru Gheorghe
2023-06-06 11:19:39 +03:00
committed by GitHub
parent 884225d340
commit 8508c3ae57
2 changed files with 42 additions and 17 deletions
+12 -1
View File
@@ -277,7 +277,7 @@ impl Span {
}
/// Derive a child span from `self`.
pub fn child(&self, name: &'static str) -> Self {
pub fn child(&self, name: &str) -> Self {
match self {
Self::Enabled(inner) => Self::Enabled(inner.child(name)),
Self::Disabled => Self::Disabled,
@@ -297,11 +297,22 @@ impl Span {
self
}
/// Attach a peer-id tag to the span.
#[inline(always)]
pub fn with_peer_id(self, peer: &PeerId) -> Self {
self.with_string_tag("peer-id", &peer.to_base58())
}
/// Attach a `peer-id` tag to the span when peer is present.
#[inline(always)]
pub fn with_optional_peer_id(self, peer: Option<&PeerId>) -> Self {
if let Some(peer) = peer {
self.with_peer_id(peer)
} else {
self
}
}
/// Attach a candidate hash to the span.
#[inline(always)]
pub fn with_candidate(self, candidate_hash: CandidateHash) -> Self {