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: Support a dynamic minimum interval for alerts and reports #29241

Merged

Conversation

Vitor-Avila
Copy link
Contributor

SUMMARY

This PR adds the ability to control the ALERT_MINIMUM_INTERVAL and/or REPORT_MINIMUM_INTERVAL configs dynamically (rather than having it statically defined during runtime). This is useful in case the value should be dynamically changed/evaluated on demand (you might want to control it externally).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No UI changes.

TESTING INSTRUCTIONS

Added unit tests to make sure the config supports both an integer and a callable.

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

@github-actions github-actions bot added the doc Namespace | Anything related to documentation label Jun 13, 2024
@dosubot dosubot bot added alert-reports Namespace | Anything related to the Alert & Reports feature change:backend Requires changing the backend need:tests This PR requires tests labels Jun 13, 2024
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.73%. Comparing base (76d897e) to head (1e8635c).
Report is 1094 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #29241       +/-   ##
===========================================
+ Coverage   60.48%   83.73%   +23.24%     
===========================================
  Files        1931      518     -1413     
  Lines       76236    37541    -38695     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    31435    -14679     
+ Misses      28017     6106    -21911     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.94% <0.00%> (-0.23%) ⬇️
javascript ?
mysql 77.21% <50.00%> (?)
postgres 77.34% <50.00%> (?)
presto 53.56% <0.00%> (-0.25%) ⬇️
python 83.73% <100.00%> (+20.24%) ⬆️
sqlite 76.80% <50.00%> (?)
unit 59.24% <100.00%> (+1.61%) ⬆️

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

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

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Nice!

One comment I had, I wonder if we should have some parameters passed to the function, even if your examples don't need them. This way we don't need to change the signature in the future. Eg, we could pass the database, so that databases where query are more expensive would have a higher minimum interval.

@Vitor-Avila
Copy link
Contributor Author

@betodealmeida that makes perfect sense! I added **kwargs to the example method so that if in the future additional work is done to pass parameters, this shouldn't break any existing setup.

@Vitor-Avila Vitor-Avila merged commit 3dadefc into apache:master Jun 13, 2024
38 checks passed
eschutho pushed a commit that referenced this pull request Jun 23, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.1.0 labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels change:backend Requires changing the backend doc Namespace | Anything related to documentation need:tests This PR requires tests size/M 🚢 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants