Skip to content

Commit 49d1ce7

Browse files
committed
Make sending traces to Tempo less confusing
1 parent 9fa3039 commit 49d1ce7

File tree

7 files changed

+106
-120
lines changed

7 files changed

+106
-120
lines changed

linera-base/src/tracing_otel.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ pub fn init_with_opentelemetry(log_name: &str, otlp_endpoint: Option<&str>) {
4343
global::set_tracer_provider(tracer_provider.clone());
4444
let tracer = tracer_provider.tracer("linera");
4545

46-
let telemetry_only_filter =
47-
filter_fn(|metadata| metadata.is_span() && metadata.target() == "telemetry_only");
46+
let no_tempo_filter =
47+
filter_fn(|metadata| metadata.is_span() && metadata.target() == "no_tempo");
4848

4949
let otel_env_filter = tracing_subscriber::EnvFilter::builder()
5050
.with_default_directive(tracing_subscriber::filter::LevelFilter::INFO.into())
5151
.from_env_lossy();
5252

53-
let opentelemetry_filter = otel_env_filter.or(telemetry_only_filter);
53+
let opentelemetry_filter = otel_env_filter.and_not(no_tempo_filter);
5454
let opentelemetry_layer = OpenTelemetryLayer::new(tracer).with_filter(opentelemetry_filter);
5555

5656
let config = crate::tracing::get_env_config(log_name);

linera-chain/src/block_tracker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'resources, 'blobs> BlockExecutionTracker<'resources, 'blobs> {
101101
}
102102

103103
/// Executes a transaction in the context of the block.
104-
#[instrument(target = "telemetry_only", skip_all, fields(
104+
#[instrument(skip_all, fields(
105105
chain_id = %self.chain_id,
106106
block_height = %self.block_height,
107107
))]

linera-chain/src/chain.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ where
392392
self.context().extra().chain_id()
393393
}
394394

395-
#[instrument(target = "telemetry_only", skip_all, fields(
395+
#[instrument(skip_all, fields(
396396
chain_id = %self.chain_id(),
397397
))]
398398
pub async fn query_application(
@@ -412,7 +412,7 @@ where
412412
.with_execution_context(ChainExecutionContext::Query)
413413
}
414414

415-
#[instrument(target = "telemetry_only", skip_all, fields(
415+
#[instrument(skip_all, fields(
416416
chain_id = %self.chain_id(),
417417
application_id = %application_id
418418
))]
@@ -427,7 +427,7 @@ where
427427
.with_execution_context(ChainExecutionContext::DescribeApplication)
428428
}
429429

430-
#[instrument(target = "telemetry_only", skip_all, fields(
430+
#[instrument(skip_all, fields(
431431
chain_id = %self.chain_id(),
432432
target = %target,
433433
height = %height
@@ -519,7 +519,7 @@ where
519519

520520
/// Verifies that this chain is up-to-date and all the messages executed ahead of time
521521
/// have been properly received by now.
522-
#[instrument(target = "telemetry_only", skip_all, fields(
522+
#[instrument(skip_all, fields(
523523
chain_id = %self.chain_id()
524524
))]
525525
pub async fn validate_incoming_bundles(&self) -> Result<(), ChainError> {
@@ -544,7 +544,7 @@ where
544544

545545
/// Collects all missing sender blocks from removed bundles across all inboxes.
546546
/// Returns a map of origin chain IDs to their respective missing block heights.
547-
#[instrument(target = "telemetry_only", skip_all, fields(
547+
#[instrument(skip_all, fields(
548548
chain_id = %self.chain_id()
549549
))]
550550
pub async fn collect_missing_sender_blocks(
@@ -610,7 +610,7 @@ where
610610
/// round timeouts.
611611
///
612612
/// Returns `true` if incoming `Subscribe` messages created new outbox entries.
613-
#[instrument(target = "telemetry_only", skip_all, fields(
613+
#[instrument(skip_all, fields(
614614
chain_id = %self.chain_id(),
615615
origin = %origin,
616616
bundle_height = %bundle.height
@@ -709,7 +709,7 @@ where
709709
}
710710

711711
/// Removes the incoming message bundles in the block from the inboxes.
712-
#[instrument(target = "telemetry_only", skip_all, fields(
712+
#[instrument(skip_all, fields(
713713
chain_id = %self.chain_id(),
714714
))]
715715
pub async fn remove_bundles_from_inboxes(
@@ -801,7 +801,7 @@ where
801801

802802
/// Executes a block: first the incoming messages, then the main operation.
803803
/// Does not update chain state other than the execution state.
804-
#[instrument(target = "telemetry_only", skip_all, fields(
804+
#[instrument(skip_all, fields(
805805
chain_id = %block.chain_id,
806806
block_height = %block.height
807807
))]
@@ -914,7 +914,7 @@ where
914914

915915
/// Executes a block: first the incoming messages, then the main operation.
916916
/// Does not update chain state other than the execution state.
917-
#[instrument(target = "telemetry_only", skip_all, fields(
917+
#[instrument(skip_all, fields(
918918
chain_id = %self.chain_id(),
919919
block_height = %block.height
920920
))]
@@ -978,7 +978,7 @@ where
978978
/// Applies an execution outcome to the chain, updating the outboxes, state hash and chain
979979
/// manager. This does not touch the execution state itself, which must be updated separately.
980980
/// Returns the set of event streams that were updated as a result of applying the block.
981-
#[instrument(target = "telemetry_only", skip_all, fields(
981+
#[instrument(skip_all, fields(
982982
chain_id = %self.chain_id(),
983983
block_height = %block.inner().inner().header.height
984984
))]
@@ -1016,7 +1016,7 @@ where
10161016

10171017
/// Adds a block to `preprocessed_blocks`, and updates the outboxes where possible.
10181018
/// Returns the set of streams that were updated as a result of preprocessing the block.
1019-
#[instrument(target = "telemetry_only", skip_all, fields(
1019+
#[instrument(skip_all, fields(
10201020
chain_id = %self.chain_id(),
10211021
block_height = %block.inner().inner().header.height
10221022
))]
@@ -1046,7 +1046,7 @@ where
10461046
}
10471047

10481048
/// Verifies that the block is valid according to the chain's application permission settings.
1049-
#[instrument(target = "telemetry_only", skip_all, fields(
1049+
#[instrument(skip_all, fields(
10501050
block_height = %block.height,
10511051
num_transactions = %block.transactions.len()
10521052
))]
@@ -1092,7 +1092,7 @@ where
10921092
}
10931093

10941094
/// Returns the hashes of all blocks we have in the given range.
1095-
#[instrument(target = "telemetry_only", skip_all, fields(
1095+
#[instrument(skip_all, fields(
10961096
chain_id = %self.chain_id(),
10971097
next_block_height = %self.tip_state.get().next_block_height,
10981098
start_height = ?range.start_bound(),
@@ -1143,7 +1143,7 @@ where
11431143
/// Updates the outboxes with the messages sent in the block.
11441144
///
11451145
/// Returns the set of all recipients.
1146-
#[instrument(target = "telemetry_only", skip_all, fields(
1146+
#[instrument(skip_all, fields(
11471147
chain_id = %self.chain_id(),
11481148
block_height = %block.header.height
11491149
))]
@@ -1238,7 +1238,7 @@ where
12381238
/// Updates the event streams with events emitted by the block if they form a contiguous
12391239
/// sequence (might not be the case when preprocessing a block).
12401240
/// Returns the set of updated event streams.
1241-
#[instrument(target = "telemetry_only", skip_all, fields(
1241+
#[instrument(skip_all, fields(
12421242
chain_id = %self.chain_id(),
12431243
block_height = %block.header.height
12441244
))]

linera-core/src/chain_worker/state.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ where
7777
StorageClient: Storage + Clone + Send + Sync + 'static,
7878
{
7979
/// Creates a new [`ChainWorkerState`] using the provided `storage` client.
80-
#[instrument(target = "telemetry_only", skip_all, fields(
80+
#[instrument(skip_all, fields(
8181
chain_id = %chain_id
8282
))]
8383
#[expect(clippy::too_many_arguments)]
@@ -247,7 +247,7 @@ where
247247
/// That means that when this function returns, no readers will be waiting to acquire
248248
/// the lock and it is safe to write the chain state to storage without any readers
249249
/// having a stale view of it.
250-
#[instrument(target = "telemetry_only", skip_all, fields(
250+
#[instrument(skip_all, fields(
251251
chain_id = %self.chain_id()
252252
))]
253253
pub(super) async fn clear_shared_chain_view(&mut self) {
@@ -280,7 +280,7 @@ where
280280
}
281281

282282
/// Returns the requested blob, if it belongs to the current locking block or pending proposal.
283-
#[instrument(target = "telemetry_only", skip_all, fields(
283+
#[instrument(skip_all, fields(
284284
chain_id = %self.chain_id(),
285285
blob_id = %blob_id
286286
))]
@@ -294,7 +294,7 @@ where
294294

295295
/// Reads the blobs from the chain manager or from storage. Returns an error if any are
296296
/// missing.
297-
#[instrument(target = "telemetry_only", skip_all, fields(
297+
#[instrument(skip_all, fields(
298298
chain_id = %self.chain_id()
299299
))]
300300
async fn get_required_blobs(
@@ -317,7 +317,7 @@ where
317317
}
318318

319319
/// Tries to read the blobs from the chain manager or storage. Returns `None` if not found.
320-
#[instrument(target = "telemetry_only", skip_all, fields(
320+
#[instrument(skip_all, fields(
321321
chain_id = %self.chain_id()
322322
))]
323323
async fn maybe_get_required_blobs(
@@ -388,7 +388,7 @@ where
388388
}
389389

390390
/// Loads pending cross-chain requests, and adds `NewRound` notifications where appropriate.
391-
#[instrument(target = "telemetry_only", skip_all, fields(
391+
#[instrument(skip_all, fields(
392392
chain_id = %self.chain_id()
393393
))]
394394
async fn create_network_actions(
@@ -428,7 +428,7 @@ where
428428
})
429429
}
430430

431-
#[instrument(target = "telemetry_only", skip_all, fields(
431+
#[instrument(skip_all, fields(
432432
chain_id = %self.chain_id(),
433433
num_recipients = %heights_by_recipient.len()
434434
))]
@@ -503,7 +503,7 @@ where
503503

504504
/// Returns true if there are no more outgoing messages in flight up to the given
505505
/// block height.
506-
#[instrument(target = "telemetry_only", skip_all, fields(
506+
#[instrument(skip_all, fields(
507507
chain_id = %self.chain_id(),
508508
height = %height
509509
))]
@@ -533,7 +533,7 @@ where
533533
}
534534

535535
/// Processes a leader timeout issued for this multi-owner chain.
536-
#[instrument(target = "telemetry_only", skip_all, fields(
536+
#[instrument(skip_all, fields(
537537
chain_id = %self.chain_id(),
538538
height = %certificate.inner().height()
539539
))]
@@ -575,7 +575,7 @@ where
575575
///
576576
/// If they cannot be found, it creates an entry in `pending_proposed_blobs` so they can be
577577
/// submitted one by one.
578-
#[instrument(target = "telemetry_only", skip_all, fields(
578+
#[instrument(skip_all, fields(
579579
chain_id = %self.chain_id(),
580580
block_height = %proposal.content.block.height
581581
))]
@@ -623,7 +623,7 @@ where
623623
}
624624

625625
/// Processes a validated block issued for this multi-owner chain.
626-
#[instrument(target = "telemetry_only", skip_all, fields(
626+
#[instrument(skip_all, fields(
627627
chain_id = %self.chain_id(),
628628
block_height = %certificate.block().header.height
629629
))]
@@ -936,7 +936,7 @@ where
936936
}
937937

938938
/// Updates the chain's inboxes, receiving messages from a cross-chain update.
939-
#[instrument(level = "trace", target = "telemetry_only", skip(self, bundles))]
939+
#[instrument(level = "trace", skip(self, bundles))]
940940
async fn process_cross_chain_update(
941941
&mut self,
942942
origin: ChainId,
@@ -985,7 +985,7 @@ where
985985
}
986986

987987
/// Handles the cross-chain request confirming that the recipient was updated.
988-
#[instrument(target = "telemetry_only", skip_all, fields(
988+
#[instrument(skip_all, fields(
989989
chain_id = %self.chain_id(),
990990
recipient = %recipient,
991991
latest_height = %latest_height
@@ -1012,7 +1012,7 @@ where
10121012
Ok(())
10131013
}
10141014

1015-
#[instrument(target = "telemetry_only", skip_all, fields(
1015+
#[instrument(skip_all, fields(
10161016
chain_id = %self.chain_id(),
10171017
num_trackers = %new_trackers.len()
10181018
))]
@@ -1027,7 +1027,7 @@ where
10271027
}
10281028

10291029
/// Attempts to vote for a leader timeout, if possible.
1030-
#[instrument(target = "telemetry_only", skip_all, fields(
1030+
#[instrument(skip_all, fields(
10311031
chain_id = %self.chain_id(),
10321032
height = %height,
10331033
round = %round
@@ -1059,7 +1059,7 @@ where
10591059
}
10601060

10611061
/// Votes for falling back to a public chain.
1062-
#[instrument(target = "telemetry_only", skip_all, fields(
1062+
#[instrument(skip_all, fields(
10631063
chain_id = %self.chain_id()
10641064
))]
10651065
async fn vote_for_fallback(&mut self) -> Result<(), WorkerError> {
@@ -1084,7 +1084,7 @@ where
10841084
Ok(())
10851085
}
10861086

1087-
#[instrument(target = "telemetry_only", skip_all, fields(
1087+
#[instrument(skip_all, fields(
10881088
chain_id = %self.chain_id(),
10891089
blob_id = %blob.id()
10901090
))]
@@ -1121,7 +1121,7 @@ where
11211121

11221122
/// Returns a stored [`Certificate`] for the chain's block at the requested [`BlockHeight`].
11231123
#[cfg(with_testing)]
1124-
#[instrument(target = "telemetry_only", skip_all, fields(
1124+
#[instrument(skip_all, fields(
11251125
chain_id = %self.chain_id(),
11261126
height = %height
11271127
))]
@@ -1143,7 +1143,7 @@ where
11431143
}
11441144

11451145
/// Queries an application's state on the chain.
1146-
#[instrument(target = "telemetry_only", skip_all, fields(
1146+
#[instrument(skip_all, fields(
11471147
chain_id = %self.chain_id(),
11481148
query_application_id = %query.application_id()
11491149
))]
@@ -1158,7 +1158,7 @@ where
11581158
}
11591159

11601160
/// Returns an application's description.
1161-
#[instrument(target = "telemetry_only", skip_all, fields(
1161+
#[instrument(skip_all, fields(
11621162
chain_id = %self.chain_id(),
11631163
application_id = %application_id
11641164
))]
@@ -1172,7 +1172,7 @@ where
11721172
}
11731173

11741174
/// Executes a block without persisting any changes to the state.
1175-
#[instrument(target = "telemetry_only", skip_all, fields(
1175+
#[instrument(skip_all, fields(
11761176
chain_id = %self.chain_id(),
11771177
block_height = %block.height
11781178
))]
@@ -1207,7 +1207,7 @@ where
12071207
}
12081208

12091209
/// Validates and executes a block proposed to extend this chain.
1210-
#[instrument(target = "telemetry_only", skip_all, fields(
1210+
#[instrument(skip_all, fields(
12111211
chain_id = %self.chain_id(),
12121212
block_height = %proposal.content.block.height
12131213
))]
@@ -1358,7 +1358,7 @@ where
13581358
}
13591359

13601360
/// Prepares a [`ChainInfoResponse`] for a [`ChainInfoQuery`].
1361-
#[instrument(target = "telemetry_only", skip_all, fields(
1361+
#[instrument(skip_all, fields(
13621362
chain_id = %self.chain_id()
13631363
))]
13641364
async fn prepare_chain_info_response(
@@ -1431,7 +1431,7 @@ where
14311431
}
14321432

14331433
/// Executes a block, caches the result, and returns the outcome.
1434-
#[instrument(target = "telemetry_only", skip_all, fields(
1434+
#[instrument(skip_all, fields(
14351435
chain_id = %self.chain_id(),
14361436
block_height = %block.height
14371437
))]
@@ -1459,7 +1459,7 @@ where
14591459
}
14601460

14611461
/// Initializes and saves the current chain if it is not active yet.
1462-
#[instrument(target = "telemetry_only", skip_all, fields(
1462+
#[instrument(skip_all, fields(
14631463
chain_id = %self.chain_id()
14641464
))]
14651465
async fn initialize_and_save_if_needed(&mut self) -> Result<(), WorkerError> {
@@ -1479,7 +1479,7 @@ where
14791479
/// Stores the chain state in persistent storage.
14801480
///
14811481
/// Waits until the [`ChainStateView`] is no longer shared before persisting the changes.
1482-
#[instrument(target = "telemetry_only", skip_all, fields(
1482+
#[instrument(skip_all, fields(
14831483
chain_id = %self.chain_id()
14841484
))]
14851485
async fn save(&mut self) -> Result<(), WorkerError> {

0 commit comments

Comments
 (0)