Implement custom OpenTelemetry sampler to filter uninstrumented traces (#8647)

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
Jimmy Chen
2026-01-22 16:11:26 +11:00
committed by GitHub
parent 21cabba1a2
commit 7f065009a7
24 changed files with 139 additions and 157 deletions

View File

@@ -7,7 +7,6 @@ use crate::sync::network_context::{
use beacon_chain::{BeaconChainTypes, BlockProcessStatus};
use educe::Educe;
use lighthouse_network::service::api_types::Id;
use lighthouse_tracing::SPAN_SINGLE_BLOCK_LOOKUP;
use parking_lot::RwLock;
use std::collections::HashSet;
use std::fmt::Debug;
@@ -93,7 +92,7 @@ impl<T: BeaconChainTypes> SingleBlockLookup<T> {
awaiting_parent: Option<Hash256>,
) -> Self {
let lookup_span = debug_span!(
SPAN_SINGLE_BLOCK_LOOKUP,
"lh_single_block_lookup",
block_root = %requested_block_root,
id = id,
);

View File

@@ -10,7 +10,6 @@ use lighthouse_network::{
service::api_types::{CustodyBackFillBatchRequestId, CustodyBackfillBatchId},
types::CustodyBackFillState,
};
use lighthouse_tracing::SPAN_CUSTODY_BACKFILL_SYNC_BATCH_REQUEST;
use logging::crit;
use std::hash::{DefaultHasher, Hash, Hasher};
use tracing::{debug, error, info, info_span, warn};
@@ -1004,7 +1003,7 @@ impl<T: BeaconChainTypes> CustodyBackFillSync<T> {
network: &mut SyncNetworkContext<T>,
batch_id: BatchId,
) -> Result<(), CustodyBackfillError> {
let span = info_span!(SPAN_CUSTODY_BACKFILL_SYNC_BATCH_REQUEST);
let span = info_span!("lh_custody_backfill_sync_batch_request");
let _enter = span.enter();
if let Some(batch) = self.batches.get_mut(&batch_id) {

View File

@@ -31,7 +31,6 @@ use lighthouse_network::service::api_types::{
DataColumnsByRootRequester, Id, SingleLookupReqId, SyncRequestId,
};
use lighthouse_network::{Client, NetworkGlobals, PeerAction, PeerId, ReportSource};
use lighthouse_tracing::{SPAN_OUTGOING_BLOCK_BY_ROOT_REQUEST, SPAN_OUTGOING_RANGE_REQUEST};
use parking_lot::RwLock;
pub use requests::LookupVerifyError;
use requests::{
@@ -546,7 +545,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
) -> Result<Id, RpcRequestSendError> {
let range_request_span = debug_span!(
parent: None,
SPAN_OUTGOING_RANGE_REQUEST,
"lh_outgoing_range_request",
range_req_id = %requester,
block_peers = block_peers.len(),
column_peers = column_peers.len()
@@ -908,7 +907,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
let request_span = debug_span!(
parent: Span::current(),
SPAN_OUTGOING_BLOCK_BY_ROOT_REQUEST,
"lh_outgoing_block_by_root_request",
%block_root,
);
self.blocks_by_root_requests.insert(

View File

@@ -6,7 +6,6 @@ use beacon_chain::validator_monitor::timestamp_now;
use fnv::FnvHashMap;
use lighthouse_network::PeerId;
use lighthouse_network::service::api_types::{CustodyId, DataColumnsByRootRequester};
use lighthouse_tracing::SPAN_OUTGOING_CUSTODY_REQUEST;
use parking_lot::RwLock;
use std::collections::HashSet;
use std::hash::{BuildHasher, RandomState};
@@ -69,7 +68,7 @@ impl<T: BeaconChainTypes> ActiveCustodyRequest<T> {
) -> Self {
let span = debug_span!(
parent: Span::current(),
SPAN_OUTGOING_CUSTODY_REQUEST,
"lh_outgoing_custody_request",
%block_root,
);
Self {

View File

@@ -12,7 +12,6 @@ use beacon_chain::BeaconChainTypes;
use beacon_chain::block_verification_types::RpcBlock;
use lighthouse_network::service::api_types::Id;
use lighthouse_network::{PeerAction, PeerId};
use lighthouse_tracing::SPAN_SYNCING_CHAIN;
use logging::crit;
use std::collections::{BTreeMap, HashSet, btree_map::Entry};
use std::hash::{Hash, Hasher};
@@ -161,7 +160,7 @@ pub enum ChainSyncingState {
impl<T: BeaconChainTypes> SyncingChain<T> {
#[allow(clippy::too_many_arguments)]
#[instrument(
name = SPAN_SYNCING_CHAIN,
name = "lh_syncing_chain",
parent = None,
level="debug",
skip_all,