Skip to content

feature: add MetricsUpdateIntervalSeconds args option in trimaran plugins #905

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

googs1025
Copy link
Member

@googs1025 googs1025 commented May 1, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

This change introduces a new field MetricsUpdateIntervalSeconds, in the TrimaranSpecArgs. This allows users to define their own interval for periodic metrics updates instead of relying on a hardcoded value.

Benefits:

  • Enhanced flexibility: Users can now customize how often metrics are updated based on their specific requirements.
  • Better user experience: Providing configuration options improves the overall usability of the collector."

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 1, 2025
@k8s-ci-robot k8s-ci-robot requested a review from seanmalloy May 1, 2025 13:12
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: googs1025
Once this PR has been reviewed and has the lgtm label, please assign huang-wei for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from zwpaper May 1, 2025 13:12
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 1, 2025
Copy link

netlify bot commented May 1, 2025

Deploy Preview for kubernetes-sigs-scheduler-plugins canceled.

Name Link
🔨 Latest commit f653d07
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-scheduler-plugins/deploys/681385e45f1213000841cd4c

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 1, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 1, 2025
@googs1025
Copy link
Member Author

/cc @ffromani @Huang-Wei

@k8s-ci-robot k8s-ci-robot requested review from ffromani and Huang-Wei May 2, 2025 00:45
Copy link
Contributor

@ffromani ffromani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR. I see the reason and makes sense, but more code means more maintenance burden, so: do we have user request for this change or is it a "just in case" change?
in addition, I think we need unit tests and please please integration tests somehow

@@ -88,6 +88,8 @@ type TrimaranSpec struct {
MetricProvider MetricProviderSpec
// Address of load watcher service
WatcherAddress string
// Interval in seconds for periodic metrics updates. Default is 30 seconds if not set.
MetricsUpdateIntervalSeconds int32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually optional values are pointers to let disambiguate between "value not set" and "value explicitely set to zero". In this case, does the zero value make sense? do we have the possible ambiguity? if not we can probably use the value (vs the pointer) but the API side will need more consideration.

@@ -69,6 +69,11 @@ func NewCollector(logger klog.Logger, trimaranSpec *pluginConfig.TrimaranSpec) (
client, _ = loadwatcherapi.NewLibraryClient(opts)
}

metricsUpdateIntervalSeconds := trimaranSpec.MetricsUpdateIntervalSeconds
if metricsUpdateIntervalSeconds == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int32 can be negative. Do we have some validation preventing negative values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants