Skip to content

Chore: scale down traces #572

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auction-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "auction-server"
version = "0.34.0"
version = "0.34.1"
edition = "2021"
license-file = "license.txt"

Expand Down
3 changes: 0 additions & 3 deletions auction-server/src/auction/repository/add_auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all)]
async fn add_in_memory_auction(&self, auction: entities::Auction) {
self.in_memory_store
.auctions
Expand All @@ -14,12 +13,10 @@ impl Repository {
}

// NOTE: Do not call this function directly. Instead call `add_auction` from `Service`.
#[tracing::instrument(skip_all, name = "add_auction_repo", fields(auction_id))]
pub async fn add_auction(
&self,
auction: entities::Auction,
) -> anyhow::Result<entities::Auction> {
tracing::Span::current().record("auction_id", auction.id.to_string());
self.db.add_auction(&auction).await?;

self.remove_in_memory_pending_bids(auction.bids.as_slice())
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/auction/repository/add_bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
pub async fn add_bid(
&self,
bid_create: entities::BidCreate,
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/auction/repository/add_bid_analytics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
pub async fn add_bid_analytics(
&self,
bid: entities::Bid,
Expand Down
2 changes: 0 additions & 2 deletions auction-server/src/auction/repository/conclude_auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all, name = "conclude_auction_repo", fields(auction_id))]
pub async fn conclude_auction(&self, auction_id: entities::AuctionId) -> anyhow::Result<()> {
tracing::Span::current().record("auction_id", auction_id.to_string());
self.db.conclude_auction(auction_id).await?;
self.remove_in_memory_auction(auction_id).await;
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all)]
pub async fn get_or_create_in_memory_bid_lock(
&self,
key: entities::BidId,
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/auction/repository/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,6 @@ impl AnalyticsDatabase for AnalyticsDatabaseInserter {
category = "db_analytics_queries",
result = "success",
name = "add_bid",
tracing_enabled
),
skip_all
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all, fields(auction_id))]
pub async fn remove_in_memory_auction(&self, auction_id: entities::AuctionId) {
tracing::Span::current().record("auction_id", auction_id.to_string());
self.in_memory_store
.auctions
.write()
Expand Down
4 changes: 0 additions & 4 deletions auction-server/src/auction/repository/submit_auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all, name = "submit_auction_repo", fields(auction_id, tx_hash))]
pub async fn submit_auction(
&self,
auction: entities::Auction,
transaction_hash: Signature,
winner_bid_ids: Vec<entities::BidId>,
) -> anyhow::Result<entities::Auction> {
tracing::Span::current().record("auction_id", auction.id.to_string());
tracing::Span::current().record("tx_hash", format!("{:?}", transaction_hash));

if let Some(mut updated_auction) =
self.db.submit_auction(&auction, &transaction_hash).await?
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use {
};

impl Repository {
#[tracing::instrument(skip_all, fields(auction_id))]
pub async fn update_in_memory_auction(&self, auction: entities::Auction) {
tracing::Span::current().record("auction_id", auction.id.to_string());
let mut write_guard = self.in_memory_store.auctions.write().await;
match write_guard.get_mut(&auction.id) {
Some(a) => {
Expand Down
15 changes: 0 additions & 15 deletions auction-server/src/auction/service/auction_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,7 @@ impl AuctionManager for Service {
Ok(TriggerStreamSvm::new(interval(TRIGGER_DURATION_SVM)))
}

#[tracing::instrument(skip_all, fields(auction_id, bid_ids))]
async fn get_winner_bids(&self, auction: &entities::Auction) -> Result<Vec<entities::Bid>> {
tracing::Span::current().record("auction_id", auction.id.to_string());
tracing::Span::current().record(
"bid_ids",
tracing::field::display(entities::BidContainerTracing(&auction.bids)),
);
let mut bids = auction.bids.clone();
bids.sort_by(|a, b| b.amount.cmp(&a.amount));
return Ok(self
Expand All @@ -188,7 +182,6 @@ impl AuctionManager for Service {
/// Submit all the svm bids as separate transactions concurrently
/// Returns Ok if at least one of the transactions is successful
/// Returns Err if all transactions are failed
#[tracing::instrument(skip_all, fields(tx_hash))]
async fn submit_bids(
&self,
_permission_key: PermissionKeySvm,
Expand All @@ -211,18 +204,11 @@ impl AuctionManager for Service {
.expect("results should not be empty because bids is not empty"))
}

#[tracing::instrument(skip_all, fields(bid_ids, tx_hash, auction_id, bid_statuses))]
async fn get_bid_results(
&self,
bids: Vec<entities::Bid>,
bid_status_auction: entities::BidStatusAuction,
) -> Result<Vec<Option<entities::BidStatusSvm>>> {
tracing::Span::current().record(
"bid_ids",
tracing::field::display(entities::BidContainerTracing(&bids)),
);
tracing::Span::current().record("tx_hash", bid_status_auction.tx_hash.to_string());
tracing::Span::current().record("auction_id", bid_status_auction.id.to_string());
if bids.is_empty() {
return Ok(vec![]);
}
Expand Down Expand Up @@ -258,7 +244,6 @@ impl AuctionManager for Service {
vec![None; bids.len()]
};

tracing::Span::current().record("bid_statuses", format!("{:?}", statuses));
// TODO: find a better place to put this
// Remove the pending transactions from the simulator
join_all(
Expand Down
2 changes: 0 additions & 2 deletions auction-server/src/auction/service/cancel_bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub struct CancelBidInput {
}

impl Service {
#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
async fn cancel_bid_for_lock(
&self,
input: CancelBidInput,
Expand Down Expand Up @@ -71,7 +70,6 @@ impl Service {
}
}

#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE), fields(bid_id = %input.bid_id))]
pub async fn cancel_bid(&self, input: CancelBidInput) -> Result<(), RestError> {
// Lock the bid to prevent submission
let bid_lock = self
Expand Down
8 changes: 0 additions & 8 deletions auction-server/src/auction/service/conclude_auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,10 @@ pub struct ConcludeAuctionWithStatusesInput {
}

impl Service {
#[tracing::instrument(skip_all, fields(auction_id, bid_ids, bid_statuses))]
pub async fn conclude_auction_with_statuses(
&self,
input: ConcludeAuctionWithStatusesInput,
) -> anyhow::Result<()> {
tracing::Span::current().record(
"bid_ids",
tracing::field::display(entities::BidContainerTracing(&input.auction.bids)),
);
tracing::Span::current().record("auction_id", input.auction.id.to_string());
tracing::Span::current().record("bid_statuses", format!("{:?}", input.bid_statuses));
join_all(input.bid_statuses.into_iter().map(|(status, bid)| {
self.update_bid_status(UpdateBidStatusInput {
bid: bid.clone(),
Expand Down Expand Up @@ -70,7 +63,6 @@ impl Service {
}

/// Concludes an auction by getting the auction transaction status from the chain.
#[tracing::instrument(skip_all)]
async fn conclude_auction(&self, input: ConcludeAuctionInput) -> anyhow::Result<()> {
let auction = input.auction;
tracing::info!(chain_id = self.config.chain_id, auction_id = ?auction.id, permission_key = auction.permission_key.to_string(), "Concluding auction");
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/auction/service/get_bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub struct GetBidInput {
}

impl Service {
#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
pub async fn get_bid(&self, input: GetBidInput) -> Result<entities::Bid, RestError> {
self.repo.get_bid(input.bid_id).await
}
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/auction/service/get_bids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub struct GetBidsInput {
}

impl Service {
#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
pub async fn get_bids(&self, input: GetBidsInput) -> Result<Vec<entities::Bid>, RestError> {
self.repo.get_bids(input.profile.id, input.from_time).await
}
Expand Down
26 changes: 3 additions & 23 deletions auction-server/src/auction/service/handle_auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,11 @@ pub struct HandleAuctionInput {
}

impl Service {
#[tracing::instrument(skip_all, fields(auction_id, bid_ids, winner_bid_ids), err(level = tracing::Level::TRACE))]
async fn submit_auction<'a>(
async fn submit_auction(
&self,
auction: entities::Auction,
_auction_mutex_guard: MutexGuard<'a, ()>,
_auction_mutex_guard: MutexGuard<'_, ()>,
) -> anyhow::Result<()> {
tracing::Span::current().record("auction_id", auction.id.to_string());
tracing::Span::current().record(
"bid_ids",
tracing::field::display(entities::BidContainerTracing(&auction.bids)),
);

let permission_key = auction.permission_key.clone();
if !auction.is_ready(Service::AUCTION_MINIMUM_LIFETIME) {
tracing::info!(
Expand All @@ -49,10 +42,6 @@ impl Service {
}

let winner_bids = self.get_winner_bids(&auction).await?;
tracing::Span::current().record(
"winner_bid_ids",
tracing::field::display(entities::BidContainerTracing(&winner_bids)),
);
if winner_bids.is_empty() {
join_all(auction.bids.into_iter().map(|bid| {
self.update_bid_status(UpdateBidStatusInput {
Expand Down Expand Up @@ -110,7 +99,6 @@ impl Service {
Ok(())
}

#[tracing::instrument(skip_all, fields(bid_ids, auction_id))]
async fn submit_auction_for_lock(
&self,
permission_key: &PermissionKeySvm,
Expand All @@ -124,16 +112,8 @@ impl Service {
.get_in_memory_pending_bids_by_permission_key(permission_key)
.await;

tracing::Span::current().record(
"bid_ids",
tracing::field::display(entities::BidContainerTracing(&bids)),
);

match entities::Auction::try_new(bids, bid_collection_time) {
Some(auction) => {
tracing::Span::current().record("auction_id", auction.id.to_string());
self.submit_auction(auction, acquired_lock).await
}
Some(auction) => self.submit_auction(auction, acquired_lock).await,
None => Ok(()),
}
}
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/auction/service/optimize_bids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ impl Service {
/// considering the current state of the chain and the pending transactions.
/// Right now, for simplicity, the method assume the bids are sorted, and tries to submit them in order
/// and only return the ones that are successfully submitted.
#[tracing::instrument(skip_all)]
pub async fn optimize_bids(&self, bids_sorted: &[Bid]) -> RpcResult<Vec<Bid>> {
let simulator = &self.config.chain_config.simulator;
simulator.optimize_bids(bids_sorted).await
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/auction/service/submit_quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ impl Service {
Ok(bid.chain_data.transaction)
}

#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
async fn submit_auction_bid_for_lock(
&self,
signed_bid: entities::Bid,
Expand Down
4 changes: 0 additions & 4 deletions auction-server/src/auction/service/update_bid_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ impl Service {
})
}

#[tracing::instrument(skip_all, fields(bid_id, status), err(level = tracing::Level::TRACE))]
pub async fn update_bid_status(
&self,
mut input: UpdateBidStatusInput,
) -> Result<bool, RestError> {
tracing::Span::current().record("bid_id", input.bid.id.to_string());
tracing::Span::current().record("status", format!("{:?}", input.new_status));

let (is_updated, conclusion_time_new) = self
.repo
.update_bid_status(input.bid.clone(), input.new_status.clone())
Expand Down
2 changes: 0 additions & 2 deletions auction-server/src/auction/service/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,6 @@ impl Service {
Ok(())
}

#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
async fn verify_signatures(
&self,
bid: &entities::BidCreate,
Expand Down Expand Up @@ -1236,7 +1235,6 @@ impl Service {
}
}

#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
pub async fn simulate_bid(&self, bid: &entities::BidCreate) -> Result<(), RestError> {
const RETRY_LIMIT: usize = 5;
const RETRY_DELAY: Duration = Duration::from_millis(100);
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/opportunity/repository/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ impl AnalyticsDatabase for AnalyticsDatabaseInserter {
category = "db_analytics_queries",
result = "success",
name = "add_opportunity",
tracing_enabled
),
skip_all
)]
Expand Down
1 change: 0 additions & 1 deletion auction-server/src/opportunity/service/get_quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ fn get_fee_token(
}

impl Service {
#[tracing::instrument(skip_all, err(level = tracing::Level::TRACE))]
async fn get_opportunity_create_for_quote(
&self,
quote_create: entities::QuoteCreate,
Expand Down
Loading