-
Notifications
You must be signed in to change notification settings - Fork 134
cleanup: refactor PodList calls to prepare for making pod metrics staleness configurable #1046
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
cleanup: refactor PodList calls to prepare for making pod metrics staleness configurable #1046
Conversation
Skipping CI for Draft Pull Request. |
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
12f8bfe
to
2d42a53
Compare
a339897
to
1005486
Compare
1005486
to
9b1e7e2
Compare
9b1e7e2
to
12943a7
Compare
/cc @liu-cong |
12943a7
to
518655c
Compare
518655c
to
e54be57
Compare
I found that it becomes very inconvenient to write unit tests after updating |
@nayihz I don’t want to nitpick too much, but to be honest I’m not sure why the interface change was required. |
I mean - to leave PodGetAll function as is.. and use the ListPod with that predicate only in the specific places it’s needed. would that help? |
6bde389
to
bff4272
Compare
make sense to me. |
Most of the comments have been addressed. There are still two remaining comments that can be discussed further. @liu-cong |
pkg/epp/datastore/datastore_test.go
Outdated
}, | ||
}, | ||
storePods: []*corev1.Pod{pod1, pod2, pod3}, | ||
want: []*backendmetrics.MetricsState{pod1Metrics, pod2Metrics}, // pod3 metrics were stale and should not be included. |
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.
The test is using a FakePodMetricsClient, you should be able to inject whatever test data you want. I don't think the current test is really testing what you want.
48e5285
to
3dfb4d8
Compare
This PR involves changes to many files, so I kindly ask everyone to move forward as soon as possible. Otherwise, it's easy to encounter branch conflicts, which can sometimes take a lot of time to resolve. |
Thank you for your patience @nayihz . I had two comments which are small I believe, I will lgtm once those are addressed. Thanks again! |
3dfb4d8
to
ad0171a
Compare
Oops, it conflicted again...😅 |
ad0171a
to
c677334
Compare
/lgtm @nirrozenbaum or @kfswain mind taking another look? This PR became a pure refactor now, and the change of callers to take into consideration of the stale metrics will be in a follow up PR. |
/hold @nayihz Can you update the PR title to something like 'refactor PodList calls to prepare for making pod metrics staleness configurable"? |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kfswain, nayihz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -28,16 +28,22 @@ import ( | |||
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend" | |||
) | |||
|
|||
func NewPodMetricsFactory(pmc PodMetricsClient, refreshMetricsInterval time.Duration) *PodMetricsFactory { | |||
var ( | |||
AllPodPredicate = func(PodMetrics) bool { return true } |
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.
typo? AllPodsPredicate?
@@ -80,6 +81,7 @@ const ( | |||
DefaultCertPath = "" // default for --cert-path | |||
DefaultConfigFile = "" // default for --config-file | |||
DefaultConfigText = "" // default for --config-text | |||
DefaultMetricsStalenessThreshold = 2 * time.Second |
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.
@liu-cong wasn't this originally 5 seconds (when it was named metricsValidityPeriod)?
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.
Originally there is no threshold enforced (though we highlight metrics older than 5s in logs, never saw that happen though). This PR doesn't enforce the threshold either. But a followup PR is expected to enforce the threshold
Create an issue to track this. @liu-cong
|
fix: #336
changes ref: #336 (comment)