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

fixes: limit no authorization error for sentry #9816

Merged
merged 2 commits into from May 20, 2020

Conversation

lilykuang
Copy link
Member

@lilykuang lilykuang commented May 15, 2020

SUMMARY

We user sentry to help us keep tracking errors and fix crashes. flask_jwt_extended/view_decorators.py in _decode_jwt_from_request at line 312 has raise NoAuthorizationError(err_msg). Sentry reports NoAuthorizationError expectedly but this error is not an actual crash. We want filter error out to reduce noise. It will log a 401 instead of throwing error to sentry.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov-io
Copy link

codecov-io commented May 15, 2020

Codecov Report

Merging #9816 into master will decrease coverage by 1.70%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9816      +/-   ##
==========================================
- Coverage   66.16%   64.46%   -1.71%     
==========================================
  Files         585      534      -51     
  Lines       30427    29283    -1144     
  Branches     3152     2810     -342     
==========================================
- Hits        20133    18877    -1256     
- Misses      10113    10228     +115     
+ Partials      181      178       -3     
Flag Coverage Δ
#cypress 53.57% <ø> (?)
#javascript ?
#python 71.23% <100.00%> (+0.20%) ⬆️
Impacted Files Coverage Δ
superset/views/base.py 73.45% <100.00%> (+0.23%) ⬆️
...uperset-frontend/src/dashboard/util/dnd-reorder.js 0.00% <0.00%> (-100.00%) ⬇️
...rset-frontend/src/dashboard/util/getEmptyLayout.js 0.00% <0.00%> (-100.00%) ⬇️
.../src/dashboard/util/getFilterScopeFromNodesTree.js 0.00% <0.00%> (-93.19%) ⬇️
.../src/dashboard/components/FilterIndicatorGroup.jsx 11.76% <0.00%> (-88.24%) ⬇️
...c/explore/components/controls/withVerification.jsx 9.09% <0.00%> (-87.88%) ⬇️
...src/dashboard/components/gridComponents/Header.jsx 10.52% <0.00%> (-86.85%) ⬇️
...rc/dashboard/components/gridComponents/Divider.jsx 13.33% <0.00%> (-86.67%) ⬇️
...uperset-frontend/src/utils/getClientErrorObject.ts 0.00% <0.00%> (-83.88%) ⬇️
...c/dashboard/components/gridComponents/Markdown.jsx 6.59% <0.00%> (-82.42%) ⬇️
... and 308 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea9b7f2...05bec1c. Read the comment docs.

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

one question, it seems like this shouldn't be necessary to solve the issue you're having. however, if my proposed solution doesn't work, some more details about the exact apis that are triggering sentry alerts would be awesome

@@ -141,6 +141,9 @@ def api(f):
def wraps(self, *args, **kwargs):
try:
return f(self, *args, **kwargs)
except SupersetSecurityException as ex:
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be managed by also wrapping the function in handle_api_exception as opposed to adding it here?

@lilykuang
Copy link
Member Author

@etr2460 I misunderstood the issue. Changing to logger.warning to reduce sentry errors because it doesn't raise to sentry

@lilykuang lilykuang requested a review from etr2460 May 18, 2020 16:45
Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

cool, lgtm. Since this is a 4xx status code, I think logging a warning vs. an exception is probably better anyway.

That said, it might be worth looking into filtering these out within your Sentry integration. At some point we'll probably run into a case where we want to keep logging a certain way in open source, but your particular use case would want to ignore them

@willbarrett
Copy link
Member

Agreed @etr2460 - we're taking this on a case-by-case basis. The PRs we've opened are for instances where we think the log level in Superset is wrong for what it's capturing, but we don't want to force changes on the community where it doesn't make sense for others. My belief is that we'll find more alignment than disagreement when improving log levels.

@etr2460 etr2460 merged commit 6f1208f into apache:master May 20, 2020
@lilykuang lilykuang deleted the lily/filter-no-authorization-error branch May 20, 2020 16:11
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* rescue no authorization error

* update no authorization exception to warning
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.37.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS 🚢 0.37.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants