Skip to content

Commit fd5d884

Browse files
add attributes
1 parent 86a14c0 commit fd5d884

6 files changed

Lines changed: 45 additions & 9 deletions

File tree

consensus/src/aggregation/engine.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ impl<
539539
let handle = self
540540
.context
541541
.child("construct_certificate")
542+
.with_attribute("height", height)
543+
.with_attribute("epoch", epoch)
542544
.shared(true)
543545
.spawn(move |_| async move {
544546
let certificate = Certificate::from_acks(
@@ -708,6 +710,8 @@ impl<
708710
let handle =
709711
self.context
710712
.child("verify_ack")
713+
.with_attribute("height", ack.item.height)
714+
.with_attribute("epoch", ack.epoch)
711715
.shared(true)
712716
.spawn(move |mut context| async move {
713717
let valid = ack.verify(&mut context, &*scheme, &strategy);

consensus/src/marshal/coding/marshaled.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,11 @@ where
857857
build_timer.observe(&runtime_context);
858858

859859
let erasure_timer = erasure_encode_duration.timer(&runtime_context);
860+
let round = consensus_context.round;
860861
let handle =
861862
runtime_context
862863
.child("erasure_encode")
864+
.with_attribute("round", round)
863865
.shared(true)
864866
.spawn(move |_| async move {
865867
CodedBlock::<B, C, H>::new(built_block, coding_config, &strategy)
@@ -874,7 +876,6 @@ where
874876
erasure_timer.observe(&runtime_context);
875877

876878
let commitment = coded_block.commitment();
877-
let round = consensus_context.round;
878879
if !marshal.proposed(round, coded_block).await {
879880
debug!(?round, ?commitment, "marshal rejected proposed block");
880881
return;

consensus/src/marshal/coding/shards/engine.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ where
675675
let handle = self
676676
.context
677677
.child("erasure_decode")
678+
.with_attribute("round", round)
678679
.shared(true)
679680
.spawn(move |_| async move {
680681
let blob = C::decode(
@@ -924,9 +925,11 @@ where
924925
state: ReconstructionState<P, C, H>,
925926
) -> ReconstructionState<P, C, H> {
926927
let strategy = self.strategy.clone();
928+
let round = state.round();
927929
let handle = self
928930
.context
929931
.child("transition_reconstruction")
932+
.with_attribute("round", round)
930933
.shared(true)
931934
.spawn(move |_| async move {
932935
let mut state = state;
@@ -982,6 +985,7 @@ where
982985
let handle = self
983986
.context
984987
.child("count_shards")
988+
.with_attribute("round", round)
985989
.shared(true)
986990
.spawn(move |_| async move {
987991
let shard_count = block.shards(&strategy).len();

consensus/src/marshal/core/actor.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,17 +1308,20 @@ where
13081308
// batch verify per epoch using scoped verifiers.
13091309
let verified = if let Some(scheme) = self.provider.all() {
13101310
let strategy = self.strategy.clone();
1311-
let handle = self.context.child("verify_deliveries").shared(true).spawn(
1312-
move |mut context| async move {
1311+
let handle = self
1312+
.context
1313+
.child("verify_deliveries")
1314+
.with_attribute("count", delivers.len())
1315+
.shared(true)
1316+
.spawn(move |mut context| async move {
13131317
let cert_refs: Vec<_> = delivers
13141318
.iter()
13151319
.map(PendingVerification::as_subject_and_certificate)
13161320
.collect();
13171321
let verified =
13181322
verify_certificates(&mut context, &scheme, &cert_refs, &strategy);
13191323
(delivers, verified)
1320-
},
1321-
);
1324+
});
13221325
let (returned, verified) = handle.await.expect("strategy task failed");
13231326
delivers = returned;
13241327
verified
@@ -1337,9 +1340,12 @@ where
13371340
continue;
13381341
};
13391342
let strategy = self.strategy.clone();
1343+
let count = indices.len();
13401344
let handle = self
13411345
.context
13421346
.child("verify_epoch_deliveries")
1347+
.with_attribute("epoch", epoch)
1348+
.with_attribute("count", count)
13431349
.shared(true)
13441350
.spawn(move |mut context| async move {
13451351
let group_refs: Vec<_> = indices

consensus/src/simplex/actors/batcher/actor.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,15 @@ where
159159

160160
fn verify_round(
161161
&self,
162+
view: View,
162163
round: Round<S, B, D, Re>,
163164
) -> impl Future<Output = RoundOutput<S, B, D, Re, VerifiedVotes<S, D>>> + Send + 'static {
164165
let strategy = self.strategy.clone();
165166
let handle =
166167
self.context
167168
.child("verify_round")
169+
.with_attribute("epoch", self.epoch)
170+
.with_attribute("view", view)
168171
.shared(true)
169172
.spawn(move |mut context| async move {
170173
let mut round = round;
@@ -184,12 +187,15 @@ where
184187

185188
fn try_construct_notarization(
186189
&self,
190+
view: View,
187191
round: Round<S, B, D, Re>,
188192
) -> impl Future<Output = RoundOutput<S, B, D, Re, Notarization<S, D>>> + Send + 'static {
189193
let strategy = self.strategy.clone();
190194
let handle = self
191195
.context
192196
.child("construct_notarization")
197+
.with_attribute("epoch", self.epoch)
198+
.with_attribute("view", view)
193199
.shared(true)
194200
.spawn(move |_| async move {
195201
let mut round = round;
@@ -201,12 +207,15 @@ where
201207

202208
fn try_construct_nullification(
203209
&self,
210+
view: View,
204211
round: Round<S, B, D, Re>,
205212
) -> impl Future<Output = RoundOutput<S, B, D, Re, Nullification<S>>> + Send + 'static {
206213
let strategy = self.strategy.clone();
207214
let handle = self
208215
.context
209216
.child("construct_nullification")
217+
.with_attribute("epoch", self.epoch)
218+
.with_attribute("view", view)
210219
.shared(true)
211220
.spawn(move |_| async move {
212221
let mut round = round;
@@ -218,12 +227,15 @@ where
218227

219228
fn try_construct_finalization(
220229
&self,
230+
view: View,
221231
round: Round<S, B, D, Re>,
222232
) -> impl Future<Output = RoundOutput<S, B, D, Re, Finalization<S, D>>> + Send + 'static {
223233
let strategy = self.strategy.clone();
224234
let handle = self
225235
.context
226236
.child("construct_finalization")
237+
.with_attribute("epoch", self.epoch)
238+
.with_attribute("view", view)
227239
.shared(true)
228240
.spawn(move |_| async move {
229241
let mut round = round;
@@ -624,7 +636,7 @@ where
624636
|| round.ready_finalizes()
625637
{
626638
let timer = self.verify_latency.timer(self.context.as_ref());
627-
let (round, verified) = self.verify_round(round).await;
639+
let (round, verified) = self.verify_round(updated_view, round).await;
628640
(round, verified.map(|verified| (timer, verified)))
629641
} else {
630642
(round, None)
@@ -666,7 +678,8 @@ where
666678
// Try to construct and forward certificates
667679
let round = if round.ready_construct_notarization() {
668680
let timer = self.recover_latency.timer(self.context.as_ref());
669-
let (round, notarization) = self.try_construct_notarization(round).await;
681+
let (round, notarization) =
682+
self.try_construct_notarization(updated_view, round).await;
670683
if let Some(notarization) = notarization {
671684
timer.observe(self.context.as_ref());
672685
debug!(view = %updated_view, "constructed notarization, forwarding to voter");
@@ -680,7 +693,8 @@ where
680693
};
681694
let round = if round.ready_construct_nullification() {
682695
let timer = self.recover_latency.timer(self.context.as_ref());
683-
let (round, nullification) = self.try_construct_nullification(round).await;
696+
let (round, nullification) =
697+
self.try_construct_nullification(updated_view, round).await;
684698
if let Some(nullification) = nullification {
685699
timer.observe(self.context.as_ref());
686700
debug!(view = %updated_view, "constructed nullification, forwarding to voter");
@@ -692,7 +706,8 @@ where
692706
};
693707
let round = if round.ready_construct_finalization() {
694708
let timer = self.recover_latency.timer(self.context.as_ref());
695-
let (round, finalization) = self.try_construct_finalization(round).await;
709+
let (round, finalization) =
710+
self.try_construct_finalization(updated_view, round).await;
696711
if let Some(finalization) = finalization {
697712
timer.observe(self.context.as_ref());
698713
debug!(view = %updated_view, "constructed finalization, forwarding to voter");

consensus/src/simplex/actors/resolver/actor.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ impl<
182182
let handle = self
183183
.context
184184
.child("verify_notarization")
185+
.with_attribute("epoch", self.epoch)
186+
.with_attribute("view", view)
185187
.shared(true)
186188
.spawn(move |mut context| async move {
187189
let valid = notarization.verify(&mut context, &scheme, &strategy);
@@ -213,6 +215,8 @@ impl<
213215
let handle = self
214216
.context
215217
.child("verify_finalization")
218+
.with_attribute("epoch", self.epoch)
219+
.with_attribute("view", view)
216220
.shared(true)
217221
.spawn(move |mut context| async move {
218222
let valid = finalization.verify(&mut context, &scheme, &strategy);
@@ -244,6 +248,8 @@ impl<
244248
let handle = self
245249
.context
246250
.child("verify_nullification")
251+
.with_attribute("epoch", self.epoch)
252+
.with_attribute("view", view)
247253
.shared(true)
248254
.spawn(move |mut context| async move {
249255
let valid = nullification.verify::<_, D>(&mut context, &scheme, &strategy);

0 commit comments

Comments
 (0)