Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

collab: Add logs to Stripe usage sync job (#33731)

Marshall Bowers8d894dd1dff5
diff --git a/crates/collab/src/api/billing.rs b/crates/collab/src/api/billing.rs
index e96f752c98e..c8df066cbf1 100644
--- a/crates/collab/src/api/billing.rs
+++ b/crates/collab/src/api/billing.rs
@@ -1404,6 +1404,9 @@ async fn sync_model_request_usage_with_stripe(
llm_db: &Arc<LlmDatabase>,
stripe_billing: &Arc<StripeBilling>,
) -> anyhow::Result<()> {
+ log::info!("Stripe usage sync: Starting");
+ let started_at = Utc::now();
+
let staff_users = app.db.get_staff_users().await?;
let staff_user_ids = staff_users
.iter()
@@ -1448,6 +1451,10 @@ async fn sync_model_request_usage_with_stripe(
.find_price_by_lookup_key("claude-3-7-sonnet-requests-max")
.await?;
+ let usage_meter_count = usage_meters.len();
+
+ log::info!("Stripe usage sync: Syncing {usage_meter_count} usage meters");
+
for (usage_meter, usage) in usage_meters {
maybe!(async {
let Some((billing_customer, billing_subscription)) =
@@ -1504,5 +1511,10 @@ async fn sync_model_request_usage_with_stripe(
.log_err();
}
+ log::info!(
+ "Stripe usage sync: Synced {usage_meter_count} usage meters in {:?}",
+ Utc::now() - started_at
+ );
+
Ok(())
}