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

Add failure logs to DiscordWebhook #30248

Open
Chief-Engineer opened this issue Jul 22, 2024 · 0 comments
Open

Add failure logs to DiscordWebhook #30248

Chief-Engineer opened this issue Jul 22, 2024 · 0 comments
Labels
D3: Low Difficulty: Some codebase knowledge required. DB: Beginner Friendly Difficulty: Great for beginners. Unambiguous in scope, and explains how to achieve the result.

Comments

@Chief-Engineer
Copy link
Contributor

Content.Server/Discord/DiscordWebhook.cs is used to send messages from various sources to various Discord webhook targets. It does not itself perform any error handling, and to my knowledge neither do all of the calls to it, so it is not currently possible to know when an issue with the webhook endpoint occurs or causes a message to be dropped. While an ideal solution to this would be #30247, adding logs would help to determine how impactful #30247 would be.

  • Every time a request is sent to a webhook using Content.Server/Discord/DiscordWebhook.cs, check the status of the response
  • Use the existing _sawmill to log every time that the response is not 2XX (200-299)
  • Do not include the webhook URL or the contents of the message in the log
  • If possible, include useful information in the log like:
    • Which method (create/edit/delete) was being used
    • Where the method was called from
    • Additional information provided by the response (like the Retry-After, X-RateLimit-Global, and X-RateLimit-Scope for a 429)
@Chief-Engineer Chief-Engineer added D3: Low Difficulty: Some codebase knowledge required. DB: Beginner Friendly Difficulty: Great for beginners. Unambiguous in scope, and explains how to achieve the result. labels Jul 22, 2024
cranberriez added a commit to cranberriez/space-station-14 that referenced this issue Aug 9, 2024
Add a new function that logs errors with discord webhook's http requests.

Create, Delete, and Edit functions were modified slightly to call the log function but return the same information as before.

The log function logs the error code, caller method using a simple constant (could be better), and attempts to log headers mentioned in issue space-wizards#30248.
PJB3005 added a commit that referenced this issue Aug 20, 2024
* Add failure logging to DiscordWebhook.cs

Add a new function that logs errors with discord webhook's http requests.

Create, Delete, and Edit functions were modified slightly to call the log function but return the same information as before.

The log function logs the error code, caller method using a simple constant (could be better), and attempts to log headers mentioned in issue #30248.

* remove extra ';'

Co-authored-by: metalgearsloth <[email protected]>

* Move header error logs to debug

---------

Co-authored-by: metalgearsloth <[email protected]>
Co-authored-by: Pieter-Jan Briers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D3: Low Difficulty: Some codebase knowledge required. DB: Beginner Friendly Difficulty: Great for beginners. Unambiguous in scope, and explains how to achieve the result.
Projects
None yet
Development

No branches or pull requests

1 participant