-
Notifications
You must be signed in to change notification settings - Fork 894
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(metricprovider): add prometheus range query support #3704
feat(metricprovider): add prometheus range query support #3704
Conversation
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Go Published Test Results2 171 tests 2 171 ✅ 2m 54s ⏱️ Results for commit 98df9ed. ♻️ This comment has been updated with latest results. |
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3704 +/- ##
==========================================
+ Coverage 80.27% 80.30% +0.03%
==========================================
Files 156 156
Lines 17964 18018 +54
==========================================
+ Hits 14420 14470 +50
- Misses 2631 2634 +3
- Partials 913 914 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
E2E Tests Published Test Results 4 files 4 suites 3h 27m 32s ⏱️ For more details on these failures, see this check. Results for commit 98df9ed. ♻️ This comment has been updated with latest results. |
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
It would be nice if we could parameterize |
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
What's the difference between this and say doing a query like Is the golang QueryRange function just some syntactic sugar for a raw query? |
Query ranges are syntactic sugar for the query endpoint as it says in that blog post. However I think there are 2 main benefits to adding query ranges:
|
That's fair, I do see it being a bit easier to reason about, also do you think it make sense to expose the start and end parameters vs hiding that behind |
I think that's would be good, although it should probably be relative to @zachaller is there a way to access args of the analysis template inside the provider so that we can parameterize things? |
Pretty sure this works today because we do things like:
Might be worth checking if it still works with your code as well just incase the template system explicity looks for those fields etc. I would also need to double check if we have access to say time.Now() or something in the templating system as well. |
Will double check if this already works |
Confirming:
does work |
There are time functions in expr, I'm going to change the API to be start/end/step, with start's default being |
hmmm, it seems this expression logic is only evaluated in success/failure conditions not in the actual fields of the provider, only args substitution works there. I could:
WDYT @zachaller? (the image doesn't seem to be embedding it's at https://github.com/argoproj/argo-rollouts/assets/6514980/29710477-b02a-4a11-a71e-cbd4690ffea1) |
Yea, it looks like Analysis only use fasttemplate not expr as seen here It might actually be fairly easy to add expr support directly to parsing analysis. I could see it being pretty useful in other cases for other providers too. Let me know your thoughts if adding expr support to analysis makes sense I would probably just start with time feature support. Also, I think your example is missing query section. |
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Hey @zachaller, I pushed that change to treat the start/end fields as expr expressions. 🙏 |
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
utils/evaluate/evaluate.go
Outdated
"asInt": asInt, | ||
"asFloat": asFloat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove asInt, asFloat and just use the built in funcs https://expr-lang.org/docs/language-definition#int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
utils/evaluate/evaluate.go
Outdated
case time.Time: | ||
return val, nil | ||
default: | ||
return time.Time{}, fmt.Errorf("expected string, but got %T", val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected time.Time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
@@ -112,29 +136,51 @@ func (p *Provider) GarbageCollect(run *v1alpha1.AnalysisRun, metric v1alpha1.Met | |||
return nil | |||
} | |||
|
|||
func sampleValuesToFloatSlice(SampleValues []model.SampleValue) []float64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we lower case SampleValues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
return results | ||
} | ||
|
||
func sampleValuesToResultStr(SampleValues []model.SampleValue) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we lowercase SampleValues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
Just a few small changes then this LGTM |
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
@zachaller have addressed your comments 🙏 |
Thank you for the contribution! |
fixes: #3702
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.