Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace context for the following actors: #7819

Merged
merged 32 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
969d45c
Trace context for the following actors:
nikurt Oct 13, 2022
754c150
Merge branch 'master' into nikurt-viewca-context
nikurt Oct 14, 2022
7b02a7f
fmt
nikurt Oct 14, 2022
b86133e
Define a macro to avoid repeating the debug span construction.
nikurt Oct 17, 2022
52c4f6d
refactor: remove dead code (#7814)
matklad Oct 14, 2022
a551dcf
Fuzz the running releases (#7833)
Ekleog-NEAR Oct 14, 2022
72eb367
[TransactionResult] Avoid panicing if original column had duplicate e…
robin-near Oct 14, 2022
4ed97af
docs: move epoch docs from confluence (#7838)
matklad Oct 17, 2022
be859da
docs: move sync docs from confluence (#7837)
matklad Oct 17, 2022
f5bc84a
nearcore: run node in archival mode if database is an archive (#7752)
mina86 Oct 17, 2022
50e4cea
client: add {node,validator}_public_key field to /status response; de…
mina86 Oct 17, 2022
292ac32
fix(o11y): Write all logs to stderr (#7834)
nikurt Oct 17, 2022
f6f02fa
refactor: move get_validator_info to EpochManagerAdapter (#7727)
matklad Oct 17, 2022
afd600d
chain: don’t clone Store in RuntimeAdapter::get_store (#7841)
mina86 Oct 17, 2022
a6783f7
Trace context for the following actors:
nikurt Oct 13, 2022
e67da3a
fmt
nikurt Oct 14, 2022
d64ffb7
Merge
nikurt Oct 17, 2022
4ddc73a
Merge branch 'master' into nikurt-viewca-context
nikurt Oct 17, 2022
4c8b410
Merge
nikurt Oct 17, 2022
8fdeebe
Merge branch 'master' into nikurt-viewca-context
nikurt Oct 17, 2022
ef5cc1b
Fix
nikurt Oct 17, 2022
3bc88cc
Merge branch 'master' into nikurt-viewca-context
nikurt Oct 18, 2022
fc0f2e8
SandboxMessage
nikurt Oct 18, 2022
8d197bb
Refactor tests to shorten `actix::spawn(client.send().then())` chains…
nikurt Oct 18, 2022
d5c0b12
Use reflection to deduce actor name and handler name
nikurt Oct 18, 2022
3028d6d
Merge branch 'master' into nikurt-viewca-context
nikurt Oct 18, 2022
5e024b8
macro tune
nikurt Oct 18, 2022
928aa36
macro tune
nikurt Oct 18, 2022
10a571c
macro tune
nikurt Oct 18, 2022
d88da99
macro tune
nikurt Oct 18, 2022
7ea4ce8
macro tune
nikurt Oct 18, 2022
c4f17ea
Merge master into nikurt-viewca-context
near-bulldozer[bot] Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 12 additions & 24 deletions chain/client/src/client_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,7 @@ impl Handler<WithSpanContext<NetworkClientMessages>> for ClientActor {
msg: WithSpanContext<NetworkClientMessages>,
ctx: &mut Context<Self>,
) -> Self::Result {
let (_span, msg) = handler_span!(
"client",
"ClientActor",
"NetworkClientMessages",
msg,
|msg: &NetworkClientMessages| msg.into()
);
let (_span, msg) = handler_span!("client", msg, |msg: &NetworkClientMessages| msg.into());

self.check_triggers(ctx);

Expand Down Expand Up @@ -630,12 +624,6 @@ impl ClientActor {
}
}

macro_rules! client_handler_span {
($handler:expr, $msg:expr) => {
handler_span!("client", "ClientActor", $handler, $msg)
};
}

#[cfg(feature = "sandbox")]
impl Handler<WithSpanContext<near_client_primitives::types::SandboxMessage>> for ClientActor {
type Result = near_client_primitives::types::SandboxResponse;
Expand All @@ -645,7 +633,7 @@ impl Handler<WithSpanContext<near_client_primitives::types::SandboxMessage>> for
msg: WithSpanContext<near_client_primitives::types::SandboxMessage>,
_ctx: &mut Context<Self>,
) -> near_client_primitives::types::SandboxResponse {
let (_span, msg) = client_handler_span!("SandboxMessage", msg);
let (_span, msg) = handler_span!("client", msg);
match msg {
near_client_primitives::types::SandboxMessage::SandboxPatchState(state) => {
self.client.chain.patch_state(
Expand Down Expand Up @@ -681,7 +669,7 @@ impl Handler<WithSpanContext<Status>> for ClientActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<Status>, ctx: &mut Context<Self>) -> Self::Result {
let (_span, msg) = client_handler_span!("Status", msg);
let (_span, msg) = handler_span!("client", msg);
let _d = delay_detector::DelayDetector::new(|| "client status".into());
self.check_triggers(ctx);

Expand Down Expand Up @@ -827,7 +815,7 @@ impl Handler<WithSpanContext<GetNetworkInfo>> for ClientActor {
msg: WithSpanContext<GetNetworkInfo>,
ctx: &mut Context<Self>,
) -> Self::Result {
let (_span, _msg) = client_handler_span!("GetNetworkInfo", msg);
let (_span, _msg) = handler_span!("client", msg);
let _d = delay_detector::DelayDetector::new(|| "client get network info".into());
self.check_triggers(ctx);

Expand Down Expand Up @@ -864,7 +852,7 @@ impl Handler<WithSpanContext<ApplyChunksDoneMessage>> for ClientActor {
msg: WithSpanContext<ApplyChunksDoneMessage>,
_ctx: &mut Self::Context,
) -> Self::Result {
let (_span, _msg) = client_handler_span!("ApplyChunksDoneMessage", msg);
let (_span, _msg) = handler_span!("client", msg);
self.try_process_unfinished_blocks();
}
}
Expand Down Expand Up @@ -1926,7 +1914,7 @@ impl Handler<WithSpanContext<ApplyStatePartsRequest>> for SyncJobsActor {
msg: WithSpanContext<ApplyStatePartsRequest>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = handler_span!("client", "SyncJobsActor", "ApplyStatePartsRequest", msg);
let (_span, msg) = handler_span!("client", msg);
let result = self.apply_parts(&msg);

self.client_addr.do_send(
Expand All @@ -1948,7 +1936,7 @@ impl Handler<WithSpanContext<ApplyStatePartsResponse>> for ClientActor {
msg: WithSpanContext<ApplyStatePartsResponse>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = client_handler_span!("ApplyStatePartsResponse", msg);
let (_span, msg) = handler_span!("client", msg);
if let Some((sync, _, _)) = self.client.catchup_state_syncs.get_mut(&msg.sync_hash) {
// We are doing catchup
sync.set_apply_result(msg.shard_id, msg.apply_result);
Expand All @@ -1966,7 +1954,7 @@ impl Handler<WithSpanContext<BlockCatchUpRequest>> for SyncJobsActor {
msg: WithSpanContext<BlockCatchUpRequest>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = handler_span!("client", "SyncJobsActor", "BlockCatchUpRequest", msg);
let (_span, msg) = handler_span!("client", msg);
let results = do_apply_chunks(msg.block_hash, msg.block_height, msg.work);

self.client_addr.do_send(
Expand All @@ -1984,7 +1972,7 @@ impl Handler<WithSpanContext<BlockCatchUpResponse>> for ClientActor {
msg: WithSpanContext<BlockCatchUpResponse>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = client_handler_span!("BlockCatchUpResponse", msg);
let (_span, msg) = handler_span!("client", msg);
if let Some((_, _, blocks_catch_up_state)) =
self.client.catchup_state_syncs.get_mut(&msg.sync_hash)
{
Expand All @@ -2004,7 +1992,7 @@ impl Handler<WithSpanContext<StateSplitRequest>> for SyncJobsActor {
msg: WithSpanContext<StateSplitRequest>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = handler_span!("client", "SyncJobsActor", "StateSplitRequest", msg);
let (_span, msg) = handler_span!("client", msg);
let results = msg.runtime.build_state_for_split_shards(
msg.shard_uid,
&msg.state_root,
Expand All @@ -2031,7 +2019,7 @@ impl Handler<WithSpanContext<StateSplitResponse>> for ClientActor {
msg: WithSpanContext<StateSplitResponse>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = client_handler_span!("StateSplitResponse", msg);
let (_span, msg) = handler_span!("client", msg);
if let Some((sync, _, _)) = self.client.catchup_state_syncs.get_mut(&msg.sync_hash) {
// We are doing catchup
sync.set_split_result(msg.shard_id, msg.new_state_roots);
Expand All @@ -2049,7 +2037,7 @@ impl Handler<WithSpanContext<ShardsManagerResponse>> for ClientActor {
msg: WithSpanContext<ShardsManagerResponse>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = client_handler_span!("ShardsManagerResponse", msg);
let (_span, msg) = handler_span!("client", msg);
match msg {
ShardsManagerResponse::ChunkCompleted { partial_chunk, shard_chunk } => {
self.client.on_chunk_completed(
Expand Down
2 changes: 1 addition & 1 deletion chain/client/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl Handler<WithSpanContext<DebugStatus>> for ClientActor {
msg: WithSpanContext<DebugStatus>,
_ctx: &mut Context<Self>,
) -> Self::Result {
let (_span, msg) = handler_span!("client", "ClientActor", "DebugStatus", msg);
let (_span, msg) = handler_span!("client", msg);
match msg {
DebugStatus::SyncStatus => {
Ok(DebugStatusResponse::SyncStatus(self.client.sync_status.clone().into()))
Expand Down
45 changes: 19 additions & 26 deletions chain/client/src/view_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,18 +476,12 @@ impl Actor for ViewClientActor {
type Context = SyncContext<Self>;
}

macro_rules! view_client_handler_span {
($handler:expr, $msg:expr) => {
handler_span!("client", "ViewClientActor", $handler, $msg)
};
}

impl Handler<WithSpanContext<Query>> for ViewClientActor {
type Result = Result<QueryResponse, QueryError>;

#[perf]
fn handle(&mut self, msg: WithSpanContext<Query>, _: &mut Self::Context) -> Self::Result {
let (_span, msg) = view_client_handler_span!("Query", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["Query"]).start_timer();
self.handle_query(msg)
}
Expand All @@ -499,7 +493,7 @@ impl Handler<WithSpanContext<GetBlock>> for ViewClientActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<GetBlock>, _: &mut Self::Context) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetBlock", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["GetBlock"]).start_timer();
let block = match self.get_block_by_reference(&msg.0)? {
Expand All @@ -522,7 +516,7 @@ impl Handler<WithSpanContext<GetBlockWithMerkleTree>> for ViewClientActor {
msg: WithSpanContext<GetBlockWithMerkleTree>,
ctx: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetBlockWithMerkleTree", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetBlockWithMerkleTree"])
.start_timer();
Expand All @@ -540,7 +534,7 @@ impl Handler<WithSpanContext<GetChunk>> for ViewClientActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<GetChunk>, _: &mut Self::Context) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetChunk", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["GetChunk"]).start_timer();
let get_chunk_from_block = |block: Block,
Expand Down Expand Up @@ -596,7 +590,7 @@ impl Handler<WithSpanContext<TxStatus>> for ViewClientActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<TxStatus>, _: &mut Self::Context) -> Self::Result {
let (_span, msg) = view_client_handler_span!("TxStatus", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["TxStatus"]).start_timer();
self.get_tx_status(msg.tx_hash, msg.signer_account_id, msg.fetch_receipt)
Expand All @@ -612,7 +606,7 @@ impl Handler<WithSpanContext<GetValidatorInfo>> for ViewClientActor {
msg: WithSpanContext<GetValidatorInfo>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetValidatorInfo", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetValidatorInfo"])
.start_timer();
Expand Down Expand Up @@ -664,7 +658,7 @@ impl Handler<WithSpanContext<GetValidatorOrdered>> for ViewClientActor {
msg: WithSpanContext<GetValidatorOrdered>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetValidatorOrdered", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetValidatorOrdered"])
.start_timer();
Expand All @@ -687,7 +681,7 @@ impl Handler<WithSpanContext<GetStateChangesInBlock>> for ViewClientActor {
msg: WithSpanContext<GetStateChangesInBlock>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetStateChangesInBlock", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetStateChangesInBlock"])
.start_timer();
Expand All @@ -711,7 +705,7 @@ impl Handler<WithSpanContext<GetStateChanges>> for ViewClientActor {
msg: WithSpanContext<GetStateChanges>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetStateChanges", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["GetStateChanges"]).start_timer();
Ok(self
Expand All @@ -734,7 +728,7 @@ impl Handler<WithSpanContext<GetStateChangesWithCauseInBlock>> for ViewClientAct
msg: WithSpanContext<GetStateChangesWithCauseInBlock>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetStateChangesWithCauseInBlock", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetStateChangesWithCauseInBlock"])
.start_timer();
Expand All @@ -759,8 +753,7 @@ impl Handler<WithSpanContext<GetStateChangesWithCauseInBlockForTrackedShards>> f
msg: WithSpanContext<GetStateChangesWithCauseInBlockForTrackedShards>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) =
view_client_handler_span!("GetStateChangesWithCauseInBlockForTrackedShards", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetStateChangesWithCauseInBlockForTrackedShards"])
.start_timer();
Expand Down Expand Up @@ -807,7 +800,7 @@ impl Handler<WithSpanContext<GetNextLightClientBlock>> for ViewClientActor {
msg: WithSpanContext<GetNextLightClientBlock>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetNextLightClientBlock", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetNextLightClientBlock"])
.start_timer();
Expand Down Expand Up @@ -854,7 +847,7 @@ impl Handler<WithSpanContext<GetExecutionOutcome>> for ViewClientActor {
msg: WithSpanContext<GetExecutionOutcome>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetExecutionOutcome", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetExecutionOutcome"])
.start_timer();
Expand Down Expand Up @@ -945,7 +938,7 @@ impl Handler<WithSpanContext<GetExecutionOutcomesForBlock>> for ViewClientActor
msg: WithSpanContext<GetExecutionOutcomesForBlock>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetExecutionOutcomesForBlock", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetExecutionOutcomesForBlock"])
.start_timer();
Expand All @@ -964,7 +957,7 @@ impl Handler<WithSpanContext<GetReceipt>> for ViewClientActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<GetReceipt>, _: &mut Self::Context) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetReceipt", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["GetReceipt"]).start_timer();
Ok(self
Expand All @@ -984,7 +977,7 @@ impl Handler<WithSpanContext<GetBlockProof>> for ViewClientActor {
msg: WithSpanContext<GetBlockProof>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetBlockProof", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["GetBlockProof"]).start_timer();
let block_header = self.chain.get_block_header(&msg.block_hash)?;
Expand All @@ -1005,7 +998,7 @@ impl Handler<WithSpanContext<GetProtocolConfig>> for ViewClientActor {
msg: WithSpanContext<GetProtocolConfig>,
_: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetProtocolConfig", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer = metrics::VIEW_CLIENT_MESSAGE_TIME
.with_label_values(&["GetProtocolConfig"])
.start_timer();
Expand All @@ -1029,7 +1022,7 @@ impl Handler<WithSpanContext<NetworkViewClientMessages>> for ViewClientActor {
msg: WithSpanContext<NetworkViewClientMessages>,
_ctx: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("NetworkViewClientMessages", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&[(&msg).into()]).start_timer();
match msg {
Expand Down Expand Up @@ -1281,7 +1274,7 @@ impl Handler<WithSpanContext<GetGasPrice>> for ViewClientActor {
msg: WithSpanContext<GetGasPrice>,
_ctx: &mut Self::Context,
) -> Self::Result {
let (_span, msg) = view_client_handler_span!("GetGasPrice", msg);
let (_span, msg) = handler_span!("client", msg);
let _timer =
metrics::VIEW_CLIENT_MESSAGE_TIME.with_label_values(&["GetGasPrice"]).start_timer();
let header = self.maybe_block_id_to_block_header(msg.block_id);
Expand Down
4 changes: 2 additions & 2 deletions chain/network/src/peer/peer_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ impl Handler<WithSpanContext<SendMessage>> for PeerActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<SendMessage>, _: &mut Self::Context) {
let (_span, msg) = handler_span!("network", "PeerActor", "SendMessage", msg);
let (_span, msg) = handler_span!("network", msg);
let _d = delay_detector::DelayDetector::new(|| "send message".into());
self.send_message_or_log(&msg.message);
}
Expand All @@ -1401,7 +1401,7 @@ impl actix::Handler<WithSpanContext<Stop>> for PeerActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<Stop>, ctx: &mut Self::Context) -> Self::Result {
let (_span, msg) = handler_span!("network", "PeerActor", "Stop", msg);
let (_span, msg) = handler_span!("network", msg);
self.stop(
ctx,
match msg.ban_reason {
Expand Down
2 changes: 1 addition & 1 deletion chain/telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Handler<WithSpanContext<TelemetryEvent>> for TelemetryActor {

#[perf]
fn handle(&mut self, msg: WithSpanContext<TelemetryEvent>, _ctx: &mut Context<Self>) {
let (_span, msg) = handler_span!("telemetry", "TelemetryActor", "TelemetryEvent", msg);
let (_span, msg) = handler_span!("telemetry", msg);
let now = Clock::instant();
if now.duration_since(self.last_telemetry_update) < self.config.reporting_interval {
// Throttle requests to the telemetry endpoints, to at most one
Expand Down
Loading