mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 05:14:35 +00:00
Implement custom OpenTelemetry sampler to filter uninstrumented traces (#8647)
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -21,9 +21,6 @@ use beacon_chain::{
|
||||
};
|
||||
use beacon_processor::{Work, WorkEvent};
|
||||
use lighthouse_network::{Client, MessageAcceptance, MessageId, PeerAction, PeerId, ReportSource};
|
||||
use lighthouse_tracing::{
|
||||
SPAN_PROCESS_GOSSIP_BLOB, SPAN_PROCESS_GOSSIP_BLOCK, SPAN_PROCESS_GOSSIP_DATA_COLUMN,
|
||||
};
|
||||
use logging::crit;
|
||||
use operation_pool::ReceivedPreCapella;
|
||||
use slot_clock::SlotClock;
|
||||
@@ -605,7 +602,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
}
|
||||
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_GOSSIP_DATA_COLUMN,
|
||||
name = "lh_process_gossip_data_column",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -769,7 +766,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_GOSSIP_BLOB,
|
||||
name = "lh_process_gossip_blob",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -1135,7 +1132,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
/// Raises a log if there are errors.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_GOSSIP_BLOCK,
|
||||
name = "lh_process_gossip_block",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
|
||||
@@ -10,13 +10,6 @@ use lighthouse_network::rpc::methods::{
|
||||
};
|
||||
use lighthouse_network::rpc::*;
|
||||
use lighthouse_network::{PeerId, ReportSource, Response, SyncInfo};
|
||||
use lighthouse_tracing::{
|
||||
SPAN_HANDLE_BLOBS_BY_RANGE_REQUEST, SPAN_HANDLE_BLOBS_BY_ROOT_REQUEST,
|
||||
SPAN_HANDLE_BLOCKS_BY_RANGE_REQUEST, SPAN_HANDLE_BLOCKS_BY_ROOT_REQUEST,
|
||||
SPAN_HANDLE_DATA_COLUMNS_BY_RANGE_REQUEST, SPAN_HANDLE_DATA_COLUMNS_BY_ROOT_REQUEST,
|
||||
SPAN_HANDLE_LIGHT_CLIENT_BOOTSTRAP, SPAN_HANDLE_LIGHT_CLIENT_FINALITY_UPDATE,
|
||||
SPAN_HANDLE_LIGHT_CLIENT_OPTIMISTIC_UPDATE, SPAN_HANDLE_LIGHT_CLIENT_UPDATES_BY_RANGE,
|
||||
};
|
||||
use methods::LightClientUpdatesByRangeRequest;
|
||||
use slot_clock::SlotClock;
|
||||
use std::collections::{HashMap, HashSet, hash_map::Entry};
|
||||
@@ -163,7 +156,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `BlocksByRoot` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_BLOCKS_BY_ROOT_REQUEST,
|
||||
name = "lh_handle_blocks_by_root_request",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -263,7 +256,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `BlobsByRoot` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_BLOBS_BY_ROOT_REQUEST,
|
||||
name = "lh_handle_blobs_by_root_request",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -392,7 +385,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `DataColumnsByRoot` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_DATA_COLUMNS_BY_ROOT_REQUEST,
|
||||
name = "lh_handle_data_columns_by_root_request",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -485,7 +478,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
}
|
||||
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_LIGHT_CLIENT_UPDATES_BY_RANGE,
|
||||
name = "lh_handle_light_client_updates_by_range",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -586,7 +579,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `LightClientBootstrap` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_LIGHT_CLIENT_BOOTSTRAP,
|
||||
name = "lh_handle_light_client_bootstrap",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -626,7 +619,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `LightClientOptimisticUpdate` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_LIGHT_CLIENT_OPTIMISTIC_UPDATE,
|
||||
name = "lh_handle_light_client_optimistic_update",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -660,7 +653,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `LightClientFinalityUpdate` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_LIGHT_CLIENT_FINALITY_UPDATE,
|
||||
name = "lh_handle_light_client_finality_update",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -694,7 +687,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `BlocksByRange` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_BLOCKS_BY_RANGE_REQUEST,
|
||||
name = "lh_handle_blocks_by_range_request",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -990,7 +983,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `BlobsByRange` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_BLOBS_BY_RANGE_REQUEST,
|
||||
name = "lh_handle_blobs_by_range_request",
|
||||
parent = None,
|
||||
skip_all,
|
||||
level = "debug",
|
||||
@@ -1155,7 +1148,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Handle a `DataColumnsByRange` request from the peer.
|
||||
#[instrument(
|
||||
name = SPAN_HANDLE_DATA_COLUMNS_BY_RANGE_REQUEST,
|
||||
name = "lh_handle_data_columns_by_range_request",
|
||||
parent = None,
|
||||
skip_all,
|
||||
level = "debug",
|
||||
|
||||
@@ -21,11 +21,6 @@ use beacon_processor::{
|
||||
use beacon_processor::{Work, WorkEvent};
|
||||
use lighthouse_network::PeerAction;
|
||||
use lighthouse_network::service::api_types::CustodyBackfillBatchId;
|
||||
use lighthouse_tracing::{
|
||||
SPAN_CUSTODY_BACKFILL_SYNC_IMPORT_COLUMNS, SPAN_PROCESS_CHAIN_SEGMENT,
|
||||
SPAN_PROCESS_CHAIN_SEGMENT_BACKFILL, SPAN_PROCESS_RPC_BLOBS, SPAN_PROCESS_RPC_BLOCK,
|
||||
SPAN_PROCESS_RPC_CUSTODY_COLUMNS,
|
||||
};
|
||||
use logging::crit;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
@@ -107,7 +102,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
/// Attempt to process a block received from a direct RPC request.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_RPC_BLOCK,
|
||||
name = "lh_process_rpc_block",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -261,7 +256,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
|
||||
/// Attempt to process a list of blobs received from a direct RPC request.
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_RPC_BLOBS,
|
||||
name = "lh_process_rpc_blobs",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -349,7 +344,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
}
|
||||
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_RPC_CUSTODY_COLUMNS,
|
||||
name = "lh_process_rpc_custody_columns",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -429,7 +424,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
expected_cgc: u64,
|
||||
) {
|
||||
let _guard = debug_span!(
|
||||
SPAN_CUSTODY_BACKFILL_SYNC_IMPORT_COLUMNS,
|
||||
"lh_custody_backfill_sync_import_columns",
|
||||
epoch = %batch_id.epoch,
|
||||
columns_received_count = downloaded_columns.len()
|
||||
)
|
||||
@@ -524,7 +519,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
/// Attempt to import the chain segment (`blocks`) to the beacon chain, informing the sync
|
||||
/// thread if more blocks are needed to process it.
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_CHAIN_SEGMENT,
|
||||
name = "lh_process_chain_segment",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
@@ -605,7 +600,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
/// Attempt to import the chain segment (`blocks`) to the beacon chain, informing the sync
|
||||
/// thread if more blocks are needed to process it.
|
||||
#[instrument(
|
||||
name = SPAN_PROCESS_CHAIN_SEGMENT_BACKFILL,
|
||||
name = "lh_process_chain_segment_backfill",
|
||||
parent = None,
|
||||
level = "debug",
|
||||
skip_all,
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user