Read metrics Datasource configuration from config file#2441
Conversation
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @Mohamedma96. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
This PR looks quite good. I have two questions:
|
|
nit: @Mohamedma96 I think PR description comment should say
The command line options are marked deprecated in options.go, so agree with @shmuelk that we should still refer to them.
I presume it is not intentional. @Mohamedma96 ? |
| scheme: {{ .Values.inferenceExtension.metricsDataSource.scheme | default "http" | quote }} | ||
| path: {{ .Values.inferenceExtension.metricsDataSource.path | default "/metrics" | quote }} | ||
| insecureSkipVerify: {{ .Values.inferenceExtension.metricsDataSource.insecureSkipVerify | default true }} | ||
| - type: model-server-protocol-metrics |
There was a problem hiding this comment.
@elevran should we rename the extractor plugin to metrics-extractor?
There was a problem hiding this comment.
It is for a well scoped specific set of metrics so I think the MSP prefix makes sense.
If we need other metrics extracted, they shuold be using a different Extractor over the same source and setting the attributes on the endpoint.
There was a problem hiding this comment.
At least the naming can be consistent with all other plugins suffixed with their main function, in this case suffixed with "metrics-extractor". But then it will be too long model-server-protocol-metrics-extractor, so how about core-metrics-extractor?
There was a problem hiding this comment.
yeah, +1 for consistency. Either core-metrics-extractor or msp-metrics-extractor.
There was a problem hiding this comment.
msp is not a well established/known term, and generally we better avoid abbreviations in ux, so I would lean towards "core" as the prefix with good documentation
There was a problem hiding this comment.
@Mohamedma96 can we pls change the plugin name here in the config and the code from model-server-protocol-metrics to core-metrics-extractor
There was a problem hiding this comment.
Done.
Please re-review.
Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
ef5c1c6 to
5450baa
Compare
Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, Mohamedma96 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold |
… set/unset Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
elevran
left a comment
There was a problem hiding this comment.
left two comments, neither is a blocker. Can be done subsequently from my point of view.
| @@ -115,7 +115,7 @@ func defaultDataSourceConfigParams() (*metricsDatasourceParams, error) { | |||
| // The second return value is false when the flag is not registered; no error is returned in that case. | |||
There was a problem hiding this comment.
nit: comment should be changed to reflect ... false when the flag is not registered or not explicitly set by the user?
| "github.com/spf13/pflag" | ||
| ) | ||
|
|
||
| func resetFlags() { |
There was a problem hiding this comment.
The global pflag.CommandLine is shared. If one test modifies it, subsequent tests will see those changes. It is cleaner to localize the flagset and revert it (e.g., using t.Cleanup()).
func TestSomeFlags(t *testing.T) {
oldCommandLine := flag.CommandLine // save global FlagSet
t.Cleanup(func() { // revert to previous at the end of the test
pflag.CommandLine = oldCommandLine
})
// create a fresh FlagSet for this test
pflag.CommandLine = flag.NewFlagSet("test", flag.ContinueOnError)
... define flags, parse them and validate using test logic
}```|
/lgtm |
|
/hold cancel |
…gs#2441) * Read metrics Datasource configuration from config file Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * Add MetricsDataSource to values, update go.mod Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * rename plugin, keep supporting command line flags for depracated flags Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * revert pflag import alias Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * Add test for config precedence, add f.Changed check to check cli flag set/unset Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * rename factory and New method to match new naming Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> --------- Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
Allow configuring a separate port for scraping model server metrics via EndpointPickerConfig plugin parameters. This addresses the gap left by the deprecation of --model-server-metrics-port (PR kubernetes-sigs#1886, kubernetes-sigs#2441) which had no replacement for the port configuration. When metricsPort is set in the metrics-data-source plugin parameters, it overrides the inference port encoded in the endpoint's MetricsHost. This enables deployments where model servers expose metrics on a separate port (e.g., vLLM with --metrics-port) from inference traffic, which is required in Istio mTLS STRICT environments. Related: kubernetes-sigs#1396, kubernetes-sigs#1556
--model-server-metrics-port was fully removed from options.go in kubernetes-sigs#2441, so pflag.Lookup would always return nil — making fromIntFlag a no-op. metricsPort is now configured exclusively via EndpointPickerConfig parameters. Also tighten NewHTTPDataSource comment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds MetricsPort to metricsDatasourceParams so the metrics-data-source plugin can scrape a port different from the inference port. When metricsPort is non-zero in EndpointPickerConfig plugin parameters, it overrides the port derived from the endpoint's MetricsHost; zero (default) preserves existing behavior. This restores functionality that was available via --model-server-metrics-port but lost when that flag was removed in kubernetes-sigs#2441 without an equivalent plugin config parameter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds MetricsPort to metricsDatasourceParams so the metrics-data-source plugin can scrape a port different from the inference port. When metricsPort is non-zero in EndpointPickerConfig plugin parameters, it overrides the port derived from the endpoint's MetricsHost; zero (default) preserves existing behavior. This restores functionality that was available via --model-server-metrics-port but lost when that flag was removed in kubernetes-sigs#2441 without an equivalent plugin config parameter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds MetricsPort to metricsDatasourceParams so the metrics-data-source plugin can scrape a port different from the inference port. When metricsPort is non-zero in EndpointPickerConfig plugin parameters, it overrides the port derived from the endpoint's MetricsHost; zero (default) preserves existing behavior. This restores functionality that was available via --model-server-metrics-port but lost when that flag was removed in kubernetes-sigs#2441 without an equivalent plugin config parameter.
Adds MetricsPort to metricsDatasourceParams so the metrics-data-source plugin can scrape a port different from the inference port. When metricsPort is non-zero in EndpointPickerConfig plugin parameters, it overrides the port derived from the endpoint's MetricsHost; zero (default) preserves existing behavior. This restores functionality that was available via --model-server-metrics-port but lost when that flag was removed in kubernetes-sigs#2441 without an equivalent plugin config parameter.
…gs/gateway-api-inference-extension#2441) * Read metrics Datasource configuration from config file Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * Add MetricsDataSource to values, update go.mod Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * rename plugin, keep supporting command line flags for depracated flags Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * revert pflag import alias Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * Add test for config precedence, add f.Changed check to check cli flag set/unset Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> * rename factory and New method to match new naming Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com> --------- Signed-off-by: mohamedmahameed <mohamed.mahameed@ibm.com>
Fixes:
issue #2440
What this PR does
the metrics-data-source DataLayer plugin read its configuration (scheme, path, insecureSkipVerify) from CLI flags (--model-server-metrics-scheme, --model-server-metrics-path, --model-server-metrics-https-insecure-skip-verify) via flag.Lookup(). This tightly coupled the plugin to the CLI layer .
This PR decouples the plugin from CLI flags by reading its configuration from the plugin's parameters field in the config.
Changes:
TODO: