Starting impl Sentry and tracing #3
+6
-6
@@ -79,6 +79,12 @@ where
|
|||||||
let type_header = extract_header(GITEA_EVENT_TYPE_HEADER_NAME, headers)?;
|
let type_header = extract_header(GITEA_EVENT_TYPE_HEADER_NAME, headers)?;
|
||||||
let body_bytes = read_body(req.into_body()).await?;
|
let body_bytes = read_body(req.into_body()).await?;
|
||||||
|
|
||||||
|
verify_signature(
|
||||||
|
app_state.config.webhook_secret.as_bytes(),
|
||||||
|
|
|||||||
|
&sig_header,
|
||||||
|
&body_bytes,
|
||||||
|
)?;
|
||||||
|
|
||||||
let body_str = String::from_utf8_lossy(&body_bytes).into_owned();
|
let body_str = String::from_utf8_lossy(&body_bytes).into_owned();
|
||||||
sentry::configure_scope(|scope| {
|
sentry::configure_scope(|scope| {
|
||||||
scope.add_event_processor(move |mut event| {
|
scope.add_event_processor(move |mut event| {
|
||||||
@@ -89,12 +95,6 @@ where
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
verify_signature(
|
|
||||||
app_state.config.webhook_secret.as_bytes(),
|
|
||||||
&sig_header,
|
|
||||||
&body_bytes,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
let webhook = parse_webhook(&type_header, &app_state.config.bot_name, &body_bytes)?;
|
let webhook = parse_webhook(&type_header, &app_state.config.bot_name, &body_bytes)?;
|
||||||
Ok(WebhookExtract(webhook))
|
Ok(WebhookExtract(webhook))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user
Ajouter un event processor à chaque requête est problématique : les processors s'accumulent et ne sont jamais retirés, ce qui peut entraîner une fuite mémoire et une dégradation des performances. De plus, Sentry peut déjà capturer le corps de la requête si l'option
attach_request_bodyest activée dansClientOptions(ou via l'intégration tower). Il est préférable de configurer cela globalement plutôt que manuellement à chaque appel.