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

fix(log): correctly handle errors when logging events #1040

Merged
merged 1 commit into from
May 28, 2024

Conversation

glevco
Copy link
Contributor

@glevco glevco commented May 23, 2024

Motivation

This PR contains 2 separate but related fixes that will improve our on-call overhead. They would cause some errors to be logged in multiple unstructured lines, generating several unnecessary alerts.

The first problem was that a bug in string formatting would generate an exception during log event processing, triggering the "error when logging event" path. The second problem was with the logging of this error itself, that was using print statements, and therefore generating the multiple unstructured lines.

This finally resolves https://github.com/HathorNetwork/on-call-incidents/issues/153.

Acceptance Criteria

  • Fix incorrect string formatting that caused a KeyError to be raised during logging.
  • Remove print() statements when errors occur during logging.

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@glevco glevco added the bug Something isn't working label May 23, 2024
@glevco glevco self-assigned this May 23, 2024
@glevco glevco marked this pull request as ready for review May 23, 2024 18:29
@glevco glevco requested review from jansegre and msbrogli as code owners May 23, 2024 18:29
Copy link

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.96%. Comparing base (47831ae) to head (973afe6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1040      +/-   ##
==========================================
+ Coverage   84.94%   84.96%   +0.02%     
==========================================
  Files         297      297              
  Lines       22906    22906              
  Branches     3463     3463              
==========================================
+ Hits        19457    19462       +5     
+ Misses       2765     2762       -3     
+ Partials      684      682       -2     

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

jansegre
jansegre previously approved these changes May 23, 2024
hathor/cli/util.py Outdated Show resolved Hide resolved
@glevco glevco force-pushed the fix/logging-errors branch from 9147964 to 5bfc088 Compare May 28, 2024 19:01
@glevco glevco force-pushed the fix/logging-errors branch from 5bfc088 to 973afe6 Compare May 28, 2024 19:51
@glevco glevco merged commit fbbcc64 into master May 28, 2024
12 checks passed
@glevco glevco deleted the fix/logging-errors branch May 28, 2024 23:43
@jansegre jansegre mentioned this pull request Jun 3, 2024
2 tasks
@jansegre jansegre mentioned this pull request Jul 25, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants