Add missing sentry error backtrace

Clear traces spam
This commit is contained in:
2026-06-16 18:49:35 +00:00
parent 00d46ce968
commit 975581093a
5 changed files with 18 additions and 9 deletions
+1
View File
@@ -16,3 +16,4 @@ GITEA_TIMEOUT=30
# Optional # Optional
SENTRY_DSN= SENTRY_DSN=
RUST_LOG=info RUST_LOG=info
RUST_BACKTRACE=1
+5 -2
View File
@@ -3,6 +3,9 @@ name = "herald"
version = "1.0.1" version = "1.0.1"
edition = "2024" edition = "2024"
[profile.release]
debug = 1
[dependencies] [dependencies]
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
tokio = { version = "1.52", features = ["full"] } tokio = { version = "1.52", features = ["full"] }
@@ -12,7 +15,7 @@ futures-util = "0.3"
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
sentry = { version = "0.48", features = ["tower-axum-matched-path"] } sentry = { version = "0.48", features = ["tower-axum-matched-path"] }
sentry-anyhow = "0.48" sentry-anyhow = { version = "0.48", features = ["backtrace"] }
openrouter-rs = "0.10" openrouter-rs = "0.10"
dotenvy = "0.15" dotenvy = "0.15"
tower = "0.5" tower = "0.5"
@@ -20,7 +23,7 @@ tower-http = {version = "0.6", features = ["trace"] }
tracing = "0.1" tracing = "0.1"
tracing-subscriber = { version = "0.3", features=["env-filter"] } tracing-subscriber = { version = "0.3", features=["env-filter"] }
axum = "0.8" axum = "0.8"
anyhow = "1.0" anyhow = { version = "1.0", features = ["backtrace"] }
thiserror = "2.0" thiserror = "2.0"
hmac = "0.13" hmac = "0.13"
sha2 = "0.11" sha2 = "0.11"
+7 -2
View File
@@ -97,9 +97,14 @@ impl Bot {
Ok(()) Ok(())
} }
#[instrument(skip(self))] #[instrument(skip(self), fields(repo, pr))]
pub async fn exec(&self, webhook: WebhookType) { pub async fn exec(&self, webhook: WebhookType) {
tracing::Span::current().record("webhook_type", tracing::field::debug(&webhook)); match &webhook {
WebhookType::Review(p) => {
tracing::Span::current().record("repo", &p.repository.full_name);
tracing::Span::current().record("pr", p.pull_request.number);
}
}
let exec_result = match webhook { let exec_result = match webhook {
WebhookType::Review(review_payload) => crate::bot_actions::review::exec_review( WebhookType::Review(review_payload) => crate::bot_actions::review::exec_review(
&self.gitea_api, &self.gitea_api,
+1 -1
View File
@@ -10,7 +10,7 @@ use crate::{
open_router::OpenRouterClient, open_router::OpenRouterClient,
}; };
#[instrument(skip(gitea_api, open_router_client, http_client, review_payload), err)] #[instrument(skip(gitea_api, open_router_client, http_client, review_payload))]
pub async fn exec_review( pub async fn exec_review(
gitea_api: &GiteaAPI, gitea_api: &GiteaAPI,
open_router_client: &OpenRouterClient, open_router_client: &OpenRouterClient,
+4 -4
View File
@@ -29,7 +29,7 @@ impl GiteaAPI {
}) })
} }
#[instrument(skip(self), err)] #[instrument(skip(self))]
pub async fn comment( pub async fn comment(
&self, &self,
body: &str, body: &str,
@@ -57,7 +57,7 @@ impl GiteaAPI {
res.json::<Comment>().await.map_err(anyhow::Error::from) res.json::<Comment>().await.map_err(anyhow::Error::from)
} }
#[instrument(skip(self), err)] #[instrument(skip(self))]
pub async fn edit_comment( pub async fn edit_comment(
&self, &self,
body: &str, body: &str,
@@ -85,7 +85,7 @@ impl GiteaAPI {
Ok(()) Ok(())
} }
#[instrument(skip(self), err)] #[instrument(skip(self))]
pub async fn delete_comment(&self, full_name: &str, comment_id: u64) -> anyhow::Result<()> { pub async fn delete_comment(&self, full_name: &str, comment_id: u64) -> anyhow::Result<()> {
let url = format!( let url = format!(
"{}/api/v1/repos/{}/issues/comments/{}", "{}/api/v1/repos/{}/issues/comments/{}",
@@ -104,7 +104,7 @@ impl GiteaAPI {
Ok(()) Ok(())
} }
#[instrument(skip(self, review_result), err)] #[instrument(skip(self, review_result))]
pub async fn post_pull_request_review( pub async fn post_pull_request_review(
&self, &self,
review_result: &ReviewResult, review_result: &ReviewResult,