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

Add wrappers for prometheus.Counter/CounterVec and prometheus.Registry #77037

Merged
merged 10 commits into from
May 8, 2019

Conversation

logicalhan
Copy link
Member

This PR implements the first part of the metrics control-plane stability KEP. Add initial wrappers around prometheus registry and prometheus counter metrics.

What type of PR is this?

/kind feature

NONE

/sig instrumentation

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 25, 2019
@logicalhan
Copy link
Member Author

/assign @brancz

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

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

This goes in the right direction I think. Could you just make sure that all the comments are full sentences, and are written in third person and present time (while during development the comments make sense as is, they won't make sense if we merge them and read them in 3 months :) ).

type StabilityLevel string

const (
ALPHA StabilityLevel = "ALPHA"
Copy link
Member

Choose a reason for hiding this comment

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

Should these be the only two? I feel like beta would be a useful state, where we say "we think these should be stable metrics, but we'd like to have everyone review this, and test it, and find out if it might still need tweaking".

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I mention beta state in the document. We can add beta state in a future iteration if there is a need for it. It’d be easy given the setup.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed

pkg/util/metrics/metric.go Outdated Show resolved Hide resolved
pkg/util/metrics/metric.go Outdated Show resolved Hide resolved
pkg/util/metrics/registry.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 26, 2019
@logicalhan logicalhan force-pushed the counter-wrapper branch 2 times, most recently from 11fdae4 to 0abbdd1 Compare April 30, 2019 00:28
Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

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

Just want to explicitly have apimachinery sign off on this usage, then we can move forward with this I'd say and implement the other types.

)

const (
versionRegexpString = `^v(\d+\.\d+\.\d+)`
Copy link
Member

Choose a reason for hiding this comment

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

I don't know enough about the apimachineryversion.Info to know if we can rely on this.

@kubernetes/sig-api-machinery-pr-reviews

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is really just legacy that it is actually called apimachineryversion.Info. The relevant scripts are build/release related.

cc/ @BenTheElder

Copy link
Member Author

Choose a reason for hiding this comment

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

It was moved out to remove the pkg/version dependency for apimachinery (I think due to test dependency issues?)

cc/ @sttts (#39943 so he probably has better context)

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Apr 30, 2019
@logicalhan logicalhan marked this pull request as ready for review May 1, 2019 22:08
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 1, 2019
@logicalhan
Copy link
Member Author

/test pull-kubernetes-verify


// DefaultGlobalRegistry is a stub for the global registry which prometheus client
// currently uses.
var DefaultGlobalRegistry = NewKubeRegistry()
Copy link
Contributor

Choose a reason for hiding this comment

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

we should start avoiding global variables. Each component should have such a registry.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I agree. However it's mostly an orthogonal change to this particular effort. Definitely want to do it though.

@k8s-ci-robot k8s-ci-robot added the sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. label May 3, 2019
@logicalhan
Copy link
Member Author

/assign @sttts

@sttts
Copy link
Contributor

sttts commented May 8, 2019

Structure looks fine now.

/approve

Leaving lgtm to @brancz.

/assign @deads2k

for kube-aggregator.

@brancz
Copy link
Member

brancz commented May 8, 2019

Thanks for the great work!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 8, 2019
@deads2k
Copy link
Contributor

deads2k commented May 8, 2019

This PR implements the first part of the metrics control-plane stability KEP. Add initial wrappers around prometheus registry and prometheus counter metrics.

For future readers, the wrappers here appear to be for providing metadata about the metrics.

/approve

@deads2k
Copy link
Contributor

deads2k commented May 8, 2019

/hold

holding for the condition check on second calls. I don't need a second look, feel free to remove the hold after handling it.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 8, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, logicalhan, sttts

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 May 8, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 8, 2019
@deads2k
Copy link
Contributor

deads2k commented May 8, 2019

re-applying

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels May 8, 2019
@k8s-ci-robot k8s-ci-robot merged commit 19431e0 into kubernetes:master May 8, 2019
@logicalhan logicalhan deleted the counter-wrapper branch May 9, 2019 17:01
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. area/apiserver area/cloudprovider area/dependency Issues or PRs related to dependency changes 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. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. 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.

None yet

6 participants