Skip to content

Commit

Permalink
view: 🧿 add trace spans to ViewService methods
Browse files Browse the repository at this point in the history
these are useful for the sake of following the sequence of function
calls when debugging issues related to the view server, the view server
worker, and integration tests making use of the `Planner`.

x-ref: #3913
  • Loading branch information
cratelyn committed May 22, 2024
1 parent 152cb6b commit 7611ac3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions crates/view/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ impl ViewService for ViewServer {
type AuctionsStream =
Pin<Box<dyn futures::Stream<Item = Result<pb::AuctionsResponse, tonic::Status>> + Send>>;

#[instrument(skip_all, level = "trace")]
async fn auctions(
&self,
request: tonic::Request<pb::AuctionsRequest>,
Expand Down Expand Up @@ -469,6 +470,7 @@ impl ViewService for ViewServer {
Ok(Response::new(stream))
}

#[instrument(skip_all, level = "trace")]
async fn broadcast_transaction(
&self,
request: tonic::Request<pb::BroadcastTransactionRequest>,
Expand All @@ -489,6 +491,7 @@ impl ViewService for ViewServer {
Ok(tonic::Response::new(stream))
}

#[instrument(skip_all, level = "trace")]
async fn transaction_planner(
&self,
request: tonic::Request<pb::TransactionPlannerRequest>,
Expand Down Expand Up @@ -760,6 +763,7 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn address_by_index(
&self,
request: tonic::Request<pb::AddressByIndexRequest>,
Expand All @@ -783,6 +787,7 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn index_by_address(
&self,
request: tonic::Request<pb::IndexByAddressRequest>,
Expand All @@ -806,6 +811,7 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn ephemeral_address(
&self,
request: tonic::Request<pb::EphemeralAddressRequest>,
Expand All @@ -829,6 +835,7 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn transaction_info_by_hash(
&self,
request: tonic::Request<pb::TransactionInfoByHashRequest>,
Expand Down Expand Up @@ -1012,6 +1019,7 @@ impl ViewService for ViewServer {
Ok(tonic::Response::new(response))
}

#[instrument(skip_all, level = "trace")]
async fn swap_by_commitment(
&self,
request: tonic::Request<pb::SwapByCommitmentRequest>,
Expand Down Expand Up @@ -1137,6 +1145,7 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn note_by_commitment(
&self,
request: tonic::Request<pb::NoteByCommitmentRequest>,
Expand Down Expand Up @@ -1167,6 +1176,7 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn nullifier_status(
&self,
request: tonic::Request<pb::NullifierStatusRequest>,
Expand All @@ -1190,6 +1200,7 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn status(
&self,
_: tonic::Request<pb::StatusRequest>,
Expand All @@ -1201,6 +1212,7 @@ impl ViewService for ViewServer {
})?))
}

#[instrument(skip_all, level = "trace")]
async fn status_stream(
&self,
_: tonic::Request<pb::StatusStreamRequest>,
Expand Down Expand Up @@ -1233,6 +1245,7 @@ impl ViewService for ViewServer {
Ok(tonic::Response::new(stream.boxed()))
}

#[instrument(skip_all, level = "trace")]
async fn notes(
&self,
request: tonic::Request<pb::NotesRequest>,
Expand Down Expand Up @@ -1284,6 +1297,7 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn notes_for_voting(
&self,
request: tonic::Request<pb::NotesForVotingRequest>,
Expand Down Expand Up @@ -1324,6 +1338,7 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn assets(
&self,
request: tonic::Request<pb::AssetsRequest>,
Expand Down Expand Up @@ -1392,6 +1407,7 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn transaction_info(
&self,
request: tonic::Request<pb::TransactionInfoRequest>,
Expand Down Expand Up @@ -1439,6 +1455,7 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn witness(
&self,
request: tonic::Request<pb::WitnessRequest>,
Expand Down Expand Up @@ -1519,6 +1536,7 @@ impl ViewService for ViewServer {
Ok(tonic::Response::new(witness_response))
}

#[instrument(skip_all, level = "trace")]
async fn witness_and_build(
&self,
request: tonic::Request<pb::WitnessAndBuildRequest>,
Expand Down Expand Up @@ -1585,6 +1603,7 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn app_parameters(
&self,
_request: tonic::Request<pb::AppParametersRequest>,
Expand All @@ -1603,6 +1622,7 @@ impl ViewService for ViewServer {
Ok(tonic::Response::new(response))
}

#[instrument(skip_all, level = "trace")]
async fn gas_prices(
&self,
_request: tonic::Request<pb::GasPricesRequest>,
Expand All @@ -1622,6 +1642,7 @@ impl ViewService for ViewServer {
Ok(tonic::Response::new(response))
}

#[instrument(skip_all, level = "trace")]
async fn fmd_parameters(
&self,
_request: tonic::Request<pb::FmdParametersRequest>,
Expand All @@ -1640,6 +1661,7 @@ impl ViewService for ViewServer {
Ok(tonic::Response::new(response))
}

#[instrument(skip_all, level = "trace")]
async fn owned_position_ids(
&self,
request: tonic::Request<pb::OwnedPositionIdsRequest>,
Expand Down Expand Up @@ -1686,13 +1708,15 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn authorize_and_build(
&self,
_request: tonic::Request<pb::AuthorizeAndBuildRequest>,
) -> Result<tonic::Response<Self::AuthorizeAndBuildStream>, tonic::Status> {
unimplemented!("authorize_and_build")
}

#[instrument(skip_all, level = "trace")]
async fn unclaimed_swaps(
&self,
_: tonic::Request<pb::UnclaimedSwapsRequest>,
Expand Down Expand Up @@ -1720,6 +1744,7 @@ impl ViewService for ViewServer {
))
}

#[instrument(skip_all, level = "trace")]
async fn wallet_id(
&self,
_: Request<WalletIdRequest>,
Expand All @@ -1733,6 +1758,7 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn asset_metadata_by_id(
&self,
request: Request<AssetMetadataByIdRequest>,
Expand All @@ -1755,13 +1781,15 @@ impl ViewService for ViewServer {
}))
}

#[instrument(skip_all, level = "trace")]
async fn delegations_by_address_index(
&self,
_request: tonic::Request<pb::DelegationsByAddressIndexRequest>,
) -> Result<tonic::Response<Self::DelegationsByAddressIndexStream>, tonic::Status> {
unimplemented!("delegations_by_address_index")
}

#[instrument(skip_all, level = "trace")]
async fn unbonding_tokens_by_address_index(
&self,
_request: tonic::Request<pb::UnbondingTokensByAddressIndexRequest>,
Expand Down

0 comments on commit 7611ac3

Please sign in to comment.