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

feat: add statsd metrics for notifications #20158

Merged
merged 5 commits into from
May 26, 2022

Conversation

dpgaspar
Copy link
Member

SUMMARY

Add a statsd gauge metric for Slack and email notifications.
We want to add more visibility for Alerts & Reports notifications: how many errors, how many notifications were sent

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented May 23, 2022

Codecov Report

Merging #20158 (dfbd89b) into master (56e9695) will decrease coverage by 0.18%.
The diff coverage is 63.05%.

❗ Current head dfbd89b differs from pull request most recent head ad9257b. Consider uploading reports for the commit ad9257b to get more accurate results

@@            Coverage Diff             @@
##           master   #20158      +/-   ##
==========================================
- Coverage   66.45%   66.27%   -0.19%     
==========================================
  Files        1721     1722       +1     
  Lines       64513    64656     +143     
  Branches     6806     6821      +15     
==========================================
- Hits        42875    42849      -26     
- Misses      19906    20074     +168     
- Partials     1732     1733       +1     
Flag Coverage Δ
hive ?
mysql 82.14% <82.02%> (-0.01%) ⬇️
postgres 82.19% <82.02%> (-0.02%) ⬇️
presto ?
python 82.27% <82.02%> (-0.37%) ⬇️
sqlite 81.94% <82.02%> (-0.01%) ⬇️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...in-chart-echarts/src/MixedTimeseries/buildQuery.ts 100.00% <ø> (ø)
.../plugin-chart-echarts/src/Timeseries/buildQuery.ts 66.66% <ø> (ø)
...hart-pivot-table/src/react-pivottable/utilities.js 0.00% <0.00%> (ø)
...ugin-chart-table/src/DataTable/hooks/useSticky.tsx 4.21% <0.00%> (ø)
...nd/plugins/plugin-chart-table/src/controlPanel.tsx 16.66% <ø> (ø)
...d/plugins/plugin-chart-table/src/transformProps.ts 64.44% <ø> (ø)
...c/SqlLab/components/ExploreResultsButton/index.tsx 100.00% <ø> (ø)
superset-frontend/src/components/Icons/index.tsx 100.00% <ø> (ø)
...end/src/components/PageHeaderWithActions/index.tsx 90.00% <ø> (ø)
...ponents/ReportModal/HeaderReportDropdown/index.tsx 68.00% <ø> (-1.34%) ⬇️
... and 42 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 56e9695...ad9257b. Read the comment docs.

metric_prefix_ = metric_prefix or f.__name__
try:
result = f(*args, **kwargs)
current_app.config["STATS_LOGGER"].gauge(f"{metric_prefix_}.ok", 1)
Copy link
Member

Choose a reason for hiding this comment

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

Does this allow for the end user to set a custom prefix?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, when creating a custom statsd logger class

Copy link
Member

@craig-rueda craig-rueda left a comment

Choose a reason for hiding this comment

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

Can we add some tests?

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Looks great!

@dpgaspar dpgaspar merged commit 77ccec5 into apache:master May 26, 2022
@dpgaspar dpgaspar deleted the chore/add-stats-metrics branch May 26, 2022 14:43
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
* feat: add statsd metrics for notifications

* fix import

* fix lint

* add decorator arg for custom prefix

* add tests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 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 preset-io size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants