Skip to content

fix(sentry): change log level for bot disconnection to info #919

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

Merged
merged 4 commits into from
Jun 23, 2025

Conversation

anemoijereja-eden
Copy link
Collaborator

@anemoijereja-eden anemoijereja-eden commented Jun 21, 2025

Description

Corrects #917 by changing the log level of the bot disconnection warning.

Guidelines

  • My code follows the style guidelines of this project (formatted with Ruff)

  • I have performed a self-review of my own code

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation if needed

  • My changes generate no new warnings

  • I have tested this change

  • Any dependent changes have been merged and published in downstream modules

  • I have added all appropriate labels to this PR

  • I have followed all of these guidelines.

How Has This Been Tested? (if applicable)

Please describe how you tested your code. e.g describe what commands you ran, what arguments, and any config stuff (if applicable)

Screenshots (if applicable)

Please add screenshots to help explain your changes.

Additional Information

Please add any other information that is important to this PR.

Summary by Sourcery

Set Sentry disconnect events to info level and clarify the disconnect message

Bug Fixes:

  • Change Sentry log level for bot disconnection from warning to info
  • Update Sentry disconnect message to indicate occasional disconnections are normal

Copy link
Contributor

sourcery-ai bot commented Jun 21, 2025

Reviewer's Guide

This PR updates the Sentry disconnection handler in tux/bot.py to lower its alert severity and provide more contextual messaging: instead of logging every disconnect as a warning, it now records them as informational events with an expanded description to reduce noise while still tracking occurrences.

File-Level Changes

Change Details Files
Adjusted Sentry disconnection event severity and message content
  • Changed scope.set_level from “warning” to “info”
  • Expanded capture_message text to note that occasional disconnects are expected and harmless
tux/bot.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

github-actions bot commented Jun 21, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @anemoijereja-eden - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Jun 21, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 9.02%. Comparing base (1afca03) to head (7145055).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tux/bot.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #919      +/-   ##
========================================
+ Coverage   8.92%   9.02%   +0.09%     
========================================
  Files        121     121              
  Lines      10269   10269              
  Branches    1255    1255              
========================================
+ Hits         917     927      +10     
+ Misses      9278    9242      -36     
- Partials      74     100      +26     
Flag Coverage Δ *Carryforward flag
database 0.30% <ø> (+<0.01%) ⬆️ Carriedforward from 730e8de
integration 5.93% <0.00%> (ø)
unit 6.38% <0.00%> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Components Coverage Δ
Core Bot Infrastructure 16.45% <0.00%> (ø)
Database Layer 0.00% <ø> (ø)
Bot Commands & Features 0.00% <ø> (ø)
Event & Error Handling ∅ <ø> (∅)
Utilities & Helpers ∅ <ø> (∅)
User Interface Components 0.00% <ø> (ø)
CLI Interface ∅ <ø> (∅)
External Service Wrappers ∅ <ø> (∅)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cloudflare-workers-and-pages bot commented Jun 21, 2025

Deploying tux with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7145055
Status: ✅  Deploy successful!
Preview URL: https://fa64d7f8.tux-afh.pages.dev
Branch Preview URL: https://917-change-error-to-info.tux-afh.pages.dev

View logs

@anemoijereja-eden anemoijereja-eden changed the title fix(sentry): change log lever for bot disconnection to info fix(sentry): change log level for bot disconnection to info Jun 21, 2025
@anemoijereja-eden
Copy link
Collaborator Author

TODO: reword the message, as requested by the issue.

@anemoijereja-eden
Copy link
Collaborator Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @anemoijereja-eden - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `tux/bot.py:210` </location>
<code_context>
-                sentry_sdk.capture_message("Bot disconnected from Discord")
+                scope.set_level("info")
+                sentry_sdk.capture_message(
+                    "Bot disconnected from Discord, this happens sometimes and is fine as long as it's not hapening too often",
+                )

</code_context>

<issue_to_address>
Typo in the word 'hapening' should be 'happening'.

Fixing the typo ensures the log message is clear and professional.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
                sentry_sdk.capture_message(
                    "Bot disconnected from Discord, this happens sometimes and is fine as long as it's not hapening too often",
                )
=======
                sentry_sdk.capture_message(
                    "Bot disconnected from Discord, this happens sometimes and is fine as long as it's not happening too often",
                )
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@electron271 electron271 merged commit 4426b1a into main Jun 23, 2025
36 checks passed
@electron271 electron271 deleted the 917-change-error-to-info branch June 23, 2025 03:21
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.

Change "Bot disconnected from Discord" warning to be info and reword
2 participants