mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 21:41:02 +00:00
Add one Jaeger span per relay parent (#2196)
* Add one Jaeger span per relay parent This adds one Jaeger span per relay parent, instead of always creating new spans per relay parent. This should improve the UI view, because subsystems are now grouped below one common span. * Fix doc tests * Replace `PerLeaveSpan` to `PerLeafSpan` * More renaming * Moare * Update node/subsystem/src/lib.rs Co-authored-by: Andronik Ordian <write@reusable.software> * Skip the spans * Increase `spec_version` Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -126,12 +126,17 @@ impl CollationGenerationSubsystem {
|
||||
// follow the procedure from the guide
|
||||
if let Some(config) = &self.config {
|
||||
let metrics = self.metrics.clone();
|
||||
if let Err(err) =
|
||||
handle_new_activations(config.clone(), &activated, ctx, metrics, sender).await
|
||||
{
|
||||
if let Err(err) = handle_new_activations(
|
||||
config.clone(),
|
||||
activated.into_iter().map(|v| v.0),
|
||||
ctx,
|
||||
metrics,
|
||||
sender,
|
||||
).await {
|
||||
tracing::warn!(target: LOG_TARGET, err = ?err, "failed to handle new activations");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
Ok(Signal(Conclude)) => true,
|
||||
@@ -164,10 +169,10 @@ where
|
||||
Context: SubsystemContext<Message = CollationGenerationMessage>,
|
||||
{
|
||||
fn start(self, ctx: Context) -> SpawnedSubsystem {
|
||||
let future = Box::pin(async move {
|
||||
let future = async move {
|
||||
self.run(ctx).await;
|
||||
Ok(())
|
||||
});
|
||||
}.boxed();
|
||||
|
||||
SpawnedSubsystem {
|
||||
name: "collation-generation-subsystem",
|
||||
@@ -176,10 +181,10 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "trace", skip(ctx, metrics, sender), fields(subsystem = LOG_TARGET))]
|
||||
#[tracing::instrument(level = "trace", skip(ctx, metrics, sender, activated), fields(subsystem = LOG_TARGET))]
|
||||
async fn handle_new_activations<Context: SubsystemContext>(
|
||||
config: Arc<CollationGenerationConfig>,
|
||||
activated: &[Hash],
|
||||
activated: impl IntoIterator<Item = Hash>,
|
||||
ctx: &mut Context,
|
||||
metrics: Metrics,
|
||||
sender: &mpsc::Sender<AllMessages>,
|
||||
@@ -189,11 +194,9 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
|
||||
let _overall_timer = metrics.time_new_activations();
|
||||
|
||||
for relay_parent in activated.iter().copied() {
|
||||
for relay_parent in activated {
|
||||
let _relay_parent_timer = metrics.time_new_activations_relay_parent();
|
||||
|
||||
// double-future magic happens here: the first layer of requests takes a mutable borrow of the context, and
|
||||
// returns a receiver. The second layer of requests actually polls those receivers to completion.
|
||||
let (availability_cores, validators) = join!(
|
||||
request_availability_cores_ctx(relay_parent, ctx).await?,
|
||||
request_validators_ctx(relay_parent, ctx).await?,
|
||||
@@ -544,7 +547,7 @@ mod tests {
|
||||
subsystem_test_harness(overseer, |mut ctx| async move {
|
||||
handle_new_activations(
|
||||
test_config(123u32),
|
||||
&subsystem_activated_hashes,
|
||||
subsystem_activated_hashes,
|
||||
&mut ctx,
|
||||
Metrics(None),
|
||||
&tx,
|
||||
@@ -623,7 +626,7 @@ mod tests {
|
||||
let (tx, _rx) = mpsc::channel(0);
|
||||
|
||||
subsystem_test_harness(overseer, |mut ctx| async move {
|
||||
handle_new_activations(test_config(16), &activated_hashes, &mut ctx, Metrics(None), &tx)
|
||||
handle_new_activations(test_config(16), activated_hashes, &mut ctx, Metrics(None), &tx)
|
||||
.await
|
||||
.unwrap();
|
||||
});
|
||||
@@ -700,7 +703,7 @@ mod tests {
|
||||
let sent_messages = Arc::new(Mutex::new(Vec::new()));
|
||||
let subsystem_sent_messages = sent_messages.clone();
|
||||
subsystem_test_harness(overseer, |mut ctx| async move {
|
||||
handle_new_activations(subsystem_config, &activated_hashes, &mut ctx, Metrics(None), &tx)
|
||||
handle_new_activations(subsystem_config, activated_hashes, &mut ctx, Metrics(None), &tx)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user