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

This PR adds some additional logs to the Stripe usage sync job for
monitoring purposes.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-07-01 14:10:00 -04:00 committed by GitHub
parent 0eee768e7b
commit 8d894dd1df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(())
}