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(api): make triggers with seriesByTag function require at least one argument with a strict equality #988

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

mchrome
Copy link
Contributor

@mchrome mchrome commented Feb 12, 2024

Make triggers with seriesByTag function require at least one argument with a strict equality

This PR is intended to prevent Moira from saving too many metrics locally when someone creates/edits a trigger with a target that can match a lot of them.
With these changes seriesByTag must have at least one argument with equality operator and no wildcards.

Examples

Valid targets after the change

  • movingAverage(groupByTags(seriesByTag('project=my-test-project'), 'max'), '10min')
  • aliasByTags(seriesByTag('name=~*', 'tag1=val1', 'tag2=val2', 'tag3=val3*'),'tag')

Invalid targets after the change

  • seriesByTag('name=ab.bc.*.cd.*.ef')
  • aliasByTags(seriesByTag('name=~*'),'tag')
  • aliasByTags(seriesByTag('name=~*', 'tag1~=*val1*', 'tag2=*val2*'),'tag')

@mchrome mchrome requested a review from a team as a code owner February 12, 2024 14:56
@mchrome mchrome marked this pull request as draft February 12, 2024 14:58
@mchrome mchrome marked this pull request as ready for review February 13, 2024 11:07
@mchrome
Copy link
Contributor Author

mchrome commented Feb 22, 2024

/build

1 similar comment
@Tetrergeru
Copy link
Member

/build

@codecov-commenter
Copy link

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (493d7a1) 68.13% compared to head (b52ad01) 68.17%.
Report is 7 commits behind head on master.

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

Files Patch % Lines
api/dto/target.go 72.00% 5 Missing and 2 partials ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #988      +/-   ##
==========================================
+ Coverage   68.13%   68.17%   +0.03%     
==========================================
  Files         208      208              
  Lines       11789    11819      +30     
==========================================
+ Hits         8033     8058      +25     
- Misses       3272     3276       +4     
- Partials      484      485       +1     

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

@Tetrergeru Tetrergeru merged commit 5b4ff82 into moira-alert:master Feb 27, 2024
6 checks passed
Copy link

Build and push Docker images with tag: 2024-02-27.5b4ff82

@mchrome mchrome deleted the fix/costly-seriesByTag branch February 27, 2024 12:04
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.

4 participants