Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remonte les erreurs dans Sentry lorsqu'un appel webhook est en erreur #9573

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

krichtof
Copy link
Contributor

@krichtof krichtof commented Oct 9, 2023

No description provided.

procedure = Procedure.find(procedure_id)
Typhoeus.post(procedure.web_hook_url, body: body, timeout: TIMEOUT)

Sentry.configure_scope do |scope|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu n'as pas besoin de faire Sentry.configure_scope. Les jobs sont enveloppés dans un scope isolé par défaut. Donc tu peux faire directement Sentry.set_tags(dossier: dossier_id, procedure: procedure_id).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, merci pour l'info :) Pour ma curiosité, je vois bien un Sentry.configure_scope dans ApplicationController mais je ne vois pas d'équivalent côté jobs. Le scope isolé par défaut par les jobs est setté où ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai amendé le commit pour intégrer ta suggestion : c3dfd73

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai amendé le commit pour intégrer ta suggestion : c3dfd73

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est fait par la gem sentry

@krichtof krichtof force-pushed the add-sentry-to-webhook-call branch from 21df9f3 to c3dfd73 Compare October 9, 2023 08:30

response = Typhoeus.post(procedure.web_hook_url, body: body, timeout: TIMEOUT)

raise StandardError, response if !response.success?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça va faire des retry en pagaille, non ? C'est ce que tu veux ? Pour moi c'est un breaking change.

Copy link
Contributor Author

@krichtof krichtof Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce n'est pas forcément ce que je veux. Ce que je souhaite, c'est avoir une trace quand la réponse du webhook n'est pas un succès.
J'ai amendé le commit en ne levant pas d'exception, mais en appelant Sentry.capture_message pour remonter l'info dans Sentry

@krichtof krichtof force-pushed the add-sentry-to-webhook-call branch from c3dfd73 to 72d28fd Compare October 9, 2023 09:37
@krichtof krichtof force-pushed the add-sentry-to-webhook-call branch from 72d28fd to 3fdc3a1 Compare October 9, 2023 09:42
@krichtof krichtof marked this pull request as ready for review October 9, 2023 10:10
@krichtof krichtof added this pull request to the merge queue Oct 9, 2023
Merged via the queue into main with commit 7b9f44e Oct 9, 2023
15 checks passed
@krichtof krichtof deleted the add-sentry-to-webhook-call branch October 9, 2023 10:22
@sentry-io
Copy link

sentry-io bot commented Oct 9, 2023

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ **NoMethodError: undefined method status' for #<Typhoeus::Response:0x00007f007688a130 @options={:httpauth_avail=>...** WebHookJob` View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants