Skip to content

Commit 455e5ff

Browse files
DewyerBarnabas Ratki
andauthored
feat: Improve important service call instrumentation (#468)
Co-authored-by: Barnabas Ratki <barna@dourolabs.xyz>
1 parent 539f6c3 commit 455e5ff

12 files changed

Lines changed: 25 additions & 5 deletions

File tree

Tiltfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ local_resource(
157157
)
158158

159159
monitor_command = (
160-
"source tilt-resources.env; "
160+
"source ./tilt-resources.env; "
161161
+ "poetry -C tilt-scripts run "
162162
+ "python3 -m tilt-scripts.protocols.token_vault_monitor "
163163
+ "--chain-id development "
@@ -231,7 +231,7 @@ local_resource(
231231
)
232232

233233
rust_searcher_command = (
234-
"source tilt-resources.env;"
234+
"source ./tilt-resources.env;"
235235
+ "export SVM_PRIVATE_KEY_FILE=keypairs/searcher_rust.json;"
236236
+ "cargo run -p testing-searcher -- --api-key=$(poetry -C tilt-scripts run python3 tilt-scripts/utils/create_profile.py --name rust_sdk --email rust_sdk@dourolabs.com --role searcher)"
237237
)

auction-server/src/api.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ use {
6969
},
7070
spl_associated_token_account::instruction::AssociatedTokenAccountInstruction,
7171
std::{
72+
fmt::{
73+
Display,
74+
Formatter,
75+
},
7276
sync::{
7377
atomic::Ordering,
7478
Arc,
@@ -567,6 +571,12 @@ impl IntoResponse for RestError {
567571
}
568572
}
569573

574+
impl Display for RestError {
575+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
576+
write!(f, "{}", self.to_status_and_message().1)
577+
}
578+
}
579+
570580
pub async fn live() -> Response {
571581
(StatusCode::OK, "OK").into_response()
572582
}

auction-server/src/auction/repository/add_bid.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use {
1616
};
1717

1818
impl<T: ChainTrait> Repository<T> {
19+
#[tracing::instrument(skip_all, err)]
1920
pub async fn add_bid(
2021
&self,
2122
bid_create: entities::BidCreate<T>,

auction-server/src/auction/service/cancel_bid.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct CancelBidInput {
1818
}
1919

2020
impl Service<Svm> {
21+
#[tracing::instrument(skip_all, err)]
2122
async fn cancel_bid_for_lock(
2223
&self,
2324
input: CancelBidInput,
@@ -57,6 +58,7 @@ impl Service<Svm> {
5758
}
5859
}
5960

61+
#[tracing::instrument(skip_all, err)]
6062
pub async fn cancel_bid(&self, input: CancelBidInput) -> Result<(), RestError> {
6163
// Lock the bid to prevent submission
6264
let bid_lock = self

auction-server/src/auction/service/get_bid.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub struct GetBidInput {
1414
}
1515

1616
impl<T: ChainTrait> Service<T> {
17+
#[tracing::instrument(skip_all, err)]
1718
pub async fn get_bid(&self, input: GetBidInput) -> Result<entities::Bid<T>, RestError> {
1819
self.repo.get_bid(input.bid_id).await
1920
}

auction-server/src/auction/service/get_bids.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub struct GetBidsInput {
1717
}
1818

1919
impl<T: ChainTrait> Service<T> {
20+
#[tracing::instrument(skip_all, err)]
2021
pub async fn get_bids(&self, input: GetBidsInput) -> Result<Vec<entities::Bid<T>>, RestError> {
2122
self.repo.get_bids(input.profile.id, input.from_time).await
2223
}

auction-server/src/auction/service/handle_auction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<T: ChainTrait> Service<T>
2727
where
2828
Service<T>: AuctionManager<T>,
2929
{
30-
#[tracing::instrument(skip_all, fields(auction_id, bid_ids, winner_bid_ids))]
30+
#[tracing::instrument(skip_all, fields(auction_id, bid_ids, winner_bid_ids), err)]
3131
async fn submit_auction<'a>(
3232
&self,
3333
auction: entities::Auction<T>,

auction-server/src/auction/service/handle_bid.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ where
2323
{
2424
#[tracing::instrument(
2525
skip_all,
26-
fields(bid_id, profile_name, simulation_error, permission_key)
26+
fields(bid_id, profile_name, simulation_error, permission_key),
27+
err
2728
)]
2829
pub async fn handle_bid(
2930
&self,

auction-server/src/auction/service/submit_quote.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ impl Service<Svm> {
9292
Ok(())
9393
}
9494

95+
#[tracing::instrument(skip_all, err)]
9596
pub async fn submit_quote(
9697
&self,
9798
input: SubmitQuoteInput,

auction-server/src/auction/service/update_bid_status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct UpdateBidStatusInput<T: ChainTrait> {
1919
}
2020

2121
impl<T: ChainTrait> Service<T> {
22-
#[tracing::instrument(skip_all, fields(bid_id, status))]
22+
#[tracing::instrument(skip_all, fields(bid_id, status), err)]
2323
pub async fn update_bid_status(
2424
&self,
2525
input: UpdateBidStatusInput<T>,

0 commit comments

Comments
 (0)