Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Fix tracing names
Browse files Browse the repository at this point in the history
  • Loading branch information
0rzech committed Mar 22, 2024
1 parent e608cc0 commit 55f1f2e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/routes/newsletters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn router() -> Router<AppState> {
}

#[tracing::instrument(
name = "Publishing newsletter",
name = "Publish newsletter",
skip(headers, app_state, body),
fields(username=tracing::field::Empty, user_id=tracing::field::Empty)
)]
Expand Down Expand Up @@ -63,7 +63,7 @@ async fn publish_newsletter(
Ok(())
}

#[tracing::instrument(name = "Extracting basic auth credentials", skip(headers))]
#[tracing::instrument(name = "Extract basic auth credentials", skip(headers))]
fn basic_authentication(headers: &HeaderMap) -> Result<Credentials, anyhow::Error> {
let base64encoded_segment = headers
.get("Authorization")
Expand Down Expand Up @@ -98,7 +98,7 @@ fn basic_authentication(headers: &HeaderMap) -> Result<Credentials, anyhow::Erro
})
}

#[tracing::instrument(name = "Validating credentials", skip(db_pool, credentials))]
#[tracing::instrument(name = "Validate credentials", skip(db_pool, credentials))]
async fn validate_credentials(
db_pool: &PgPool,
credentials: Credentials,
Expand Down Expand Up @@ -127,7 +127,7 @@ async fn validate_credentials(
user_id.ok_or_else(|| PublishError::AuthError(anyhow!("Unknown username")))
}

#[tracing::instrument(name = "Getting stored credentials", skip(db_pool, username))]
#[tracing::instrument(name = "Get stored credentials", skip(db_pool, username))]
async fn get_stored_credentials(
db_pool: &PgPool,
username: String,
Expand All @@ -149,7 +149,7 @@ async fn get_stored_credentials(
}

#[tracing::instrument(
name = "Verifying password hash",
name = "Verify password hash",
skip(expected_password_hash, password_candidate)
)]
fn verify_password_hash(
Expand All @@ -168,7 +168,7 @@ fn verify_password_hash(
.map_err(PublishError::AuthError)
}

#[tracing::instrument(name = "Getting confirmed subscribers", skip(db_pool))]
#[tracing::instrument(name = "Get confirmed subscribers", skip(db_pool))]
async fn get_confirmed_subscribers(
db_pool: &PgPool,
) -> Result<Vec<Result<ConfirmedSubscriber, anyhow::Error>>, anyhow::Error> {
Expand Down
10 changes: 5 additions & 5 deletions src/routes/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn router() -> Router<AppState> {
}

#[tracing::instrument(
name = "Adding new subscriber",
name = "Add new subscriber",
skip(app_state, form),
fields(
subscriber_email = %form.email,
Expand Down Expand Up @@ -76,7 +76,7 @@ async fn subscribe(
}

#[tracing::instrument(
name = "Getting subscriber details from the database",
name = "Get subscriber details from the database",
skip(transaction, email)
)]
async fn get_subscription(
Expand Down Expand Up @@ -107,7 +107,7 @@ async fn get_subscription(
}

#[tracing::instrument(
name = "Saving new subscriber details in the database",
name = "Save new subscriber details in the database",
skip(transaction, new_subscriber)
)]
async fn insert_subscriber(
Expand Down Expand Up @@ -136,7 +136,7 @@ async fn insert_subscriber(
}

#[tracing::instrument(
name = "Storing subscription token in the database",
name = "Store subscription token in the database",
skip(transaction, subscription_token)
)]
async fn store_token(
Expand All @@ -162,7 +162,7 @@ async fn store_token(
}

#[tracing::instrument(
name = "Sending confirmation email to a new subscriber",
name = "Send confirmation email to a new subscriber",
skip(email_client, new_subscriber, base_url, subscription_token)
)]
async fn send_confirmation_email(
Expand Down
6 changes: 3 additions & 3 deletions src/routes/subscriptions_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct Parameters {
}

#[tracing::instrument(
name = "Getting subscriber_id from token",
name = "Get subscriber_id from token",
skip(transaction, subscription_token)
)]
async fn get_subscriber_id_from_token(
Expand Down Expand Up @@ -86,7 +86,7 @@ async fn get_subscriber_id_from_token(
}

#[tracing::instrument(
name = "Marking subscriber as confirmed",
name = "Mark subscriber as confirmed",
skip(transaction, subscriber_id)
)]
async fn confirm_subscriber(
Expand All @@ -111,7 +111,7 @@ async fn confirm_subscriber(
}

#[tracing::instrument(
name = "Deleting subscribe confirmation tokens",
name = "Delete subscription confirmation tokens",
skip(transaction, subscriber_id)
)]
async fn delete_confirmation_tokens(
Expand Down

0 comments on commit 55f1f2e

Please sign in to comment.