-
Notifications
You must be signed in to change notification settings - Fork 267
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
Refactor metric source for customized protocol, port and path #511
Refactor metric source for customized protocol, port and path #511
Conversation
I noticed with this PR, reading metrics now potentially supports HTTPS. However, the code in cache still hard coded as: func (c *Cache) updatePodMetrics() {
c.mu.Lock()
defer c.mu.Unlock()
for _, pod := range c.Pods {
...
// We should use the primary container port. In the future, we can decide whether to use sidecar container's port
url := fmt.Sprintf("http://%s:%d/metrics", pod.Status.PodIP, podPort)
allMetrics, err := metrics.ParseMetricsURL(url)
if err != nil {
klog.Warningf("Error parsing metric families: %v\n", err)
}
...
}
...
} Will this introduce some inconsistency? Should cache behavior be included in this PR? Or maybe KPA for pod metrics reuse metric loading logic in the cache? |
ff8fd91
to
1ce3333
Compare
Yes, it's a good question. We have multiple metric fetcher implementations scattered across the autoscaler, cache, and model adapter components. @Jeffwan plans to refactor these codes to make them more concise. I have checked the code invocation hierarchy, and I think it's challenging to address this issue within this PR. The cache update process is independent of the metric source defined in pa.yaml, and the port and path are both hard-coded. I haven't yet thought of a straightforward way to resolve this, as the changes in this PR depend on the |
this is good fining! We do not need to care about the metric fetcher in the cache.go at this moment. It will be refactor later. The primary goal of this PR is to
|
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 change looks good to me.
* refactor pa_types.go and modify metric client, fetcher * fix test bug * conduct ./hack/update-codegen.sh * update config/crd/autoscaling, fix function name, update pa.yaml
Pull Request Description
[Please provide a clear and concise description of your changes here]
Related Issues
Resolves: #494
In current version, we cannot which only support http protocol and hard-code the port to 8000.
We aim to accomodate the following metric resource in a unified format:
{http[s]}:{pod_ip}:{port}/{path}
) and domain link(gpu-optimizer.aibrix-system.svc.cluster.local:8080
)To solve it, we enhance the previous metric sources:
MetricSource
,MetricSource
is now distinguished byMetricSourceType
(domain
orpod
). We Further add ProtocolType to specifyhttp
orhttps
.PodAutoscalerSpec.TargetMetric
andPodAutoscalerSpec.TargetValue
intoMetricsSource.TargetMetric
andMetricsSource.TargetValue
.The modified
podautoscaler_types.go
is as follows:The pa yaml example is as follows:
Now We allow user define all metric attributes (domain, port, protocol, path, metricName), and pass them to the bottom function:
Contribution Guidelines (Expand for Details)
We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:
Pull Request Title Format
Your PR title should start with one of these prefixes to indicate the nature of the change:
[Bug]
: Corrections to existing functionality[CI]
: Changes to build process or CI pipeline[Docs]
: Updates or additions to documentation[API]
: Modifications to aibrix's API or interface[CLI]
: Changes or additions to the Command Line Interface[Misc]
: For changes not covered above (use sparingly)Note: For changes spanning multiple categories, use multiple prefixes in order of importance.
Submission Checklist
By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.