Skip to content
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

Import k8s metrics stability framework #1844

Merged

Conversation

CatherineF-dev
Copy link
Contributor

What this PR does / why we need it: #1833

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality) No

Which issue(s) this PR fixes:
Fixes #1833

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 27, 2022
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 27, 2022
@CatherineF-dev
Copy link
Contributor Author

cc @dgrisonnet

@logicalhan
Copy link
Member

/assign

@@ -52,6 +56,11 @@ func NewFamilyGenerator(name string, help string, metricType metric.Type, deprec
return f
}

// NewFamilyGenerator creates new FamilyGenerator instances.
func NewFamilyGenerator(name string, help string, metricType metric.Type, deprecatedVersion string, generateFunc func(obj interface{}) *metric.Family) *FamilyGenerator {
return NewFamilyGeneratorWithStability(name, help, metricType, basemetrics.ALPHA, deprecatedVersion, generateFunc)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why all metrics are being set to alpha?

Copy link
Contributor Author

@CatherineF-dev CatherineF-dev Oct 6, 2022

Choose a reason for hiding this comment

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

Not all.
In replacing NewFamilyGenerator with NewFamilyGeneratorWithStability.

For example: https://github.com/kubernetes/kube-state-metrics/pull/1844/files#diff-28c04d8ad4d0fd23a2b14d61e94ca54e757c1e5ab971cea37974fe1b2f260085

NewFamilyGenerator will be deleted once all replacements are done.

Copy link
Member

@rexagod rexagod Oct 6, 2022

Choose a reason for hiding this comment

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

Ah, okay. So is it right to say that for now we are setting just the node metrics to alpha? Also, what state were they in before? Experimental?

Copy link
Member

Choose a reason for hiding this comment

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

It seems only two of these metrics were experimental before. So IIUC, if the node metrics are being set to alpha, should it only be for these two?

| kube_node_annotations        | Gauge       | Kubernetes annotations converted to Prometheus labels
| kube_node_role               | Gauge       | The role of a cluster node

Copy link
Contributor Author

@CatherineF-dev CatherineF-dev Oct 7, 2022

Choose a reason for hiding this comment

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

what state were they in before? Experimental?

Yes, they are mapped into k8s stability level:
Experimental -> Alpha
Stable -> Stable

So IIUC, if the node metrics are being set to alpha, should it only be for these two?

Working in progress for other stable metrics. Because there are many test codes need to be changed.
I planned to create 2+ CLs. The first CL (this CL) to import stability framework, other CLs migrate other NewFamilyGenerator
to NewFamilyGeneratorWithStability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added all STABLE metrics just now.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, if everything got refactored is it possible to keep the old function name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, only stable metrics are using NewFamilyGeneratorWithStability now.

Will create another CL to migrate non-stable metrics to use NewFamilyGeneratorWithStability. Because this way has less merge conflicts in this CL.

go.mod Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 7, 2022
@CatherineF-dev CatherineF-dev force-pushed the import-k8s-metrics-stability branch 2 times, most recently from 35dec67 to dc23fad Compare October 7, 2022 19:39
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 11, 2022
@CatherineF-dev
Copy link
Contributor Author

QQ: do we have other comments? Or could someone approve this CL?

Copy link
Member

@dgrisonnet dgrisonnet left a comment

Choose a reason for hiding this comment

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

One small comment from my side, but otherwise it looks good to me. Great work @CatherineF-dev 👍

go.mod Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 14, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 14, 2022
@dgrisonnet
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 14, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CatherineF-dev, dgrisonnet

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 14, 2022
@k8s-ci-robot k8s-ci-robot merged commit b909c01 into kubernetes:master Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Presubmit checks for stable metrics
6 participants