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 Metrics About StorageClass #777

Merged
merged 2 commits into from
Jun 7, 2019
Merged

Add Metrics About StorageClass #777

merged 2 commits into from
Jun 7, 2019

Conversation

xieyanker
Copy link
Contributor

What this PR does / why we need it:

Add Some Metrics About StorageClass

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #775

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 3, 2019
@@ -0,0 +1,124 @@
/*
Copyright 2017 The Kubernetes Authors All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Copyright 2017 The Kubernetes Authors All rights reserved.
Copyright 2019 The Kubernetes Authors All rights reserved.

Metrics: []*metric.Metric{
{
LabelKeys: []string{"resource_version"},
LabelValues: []string{string(s.ObjectMeta.ResourceVersion)},
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know ResourceVersion is increased for each change propagated from etcd. Thus this metric would create a new timeseries for each change of the object. How often do you expect this Kubernetes object to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ResourceVersion can be changed only when object is updated, but we won't update it usually, so I think it will not change freequently.

@tariq1890
Copy link
Contributor

You need to add storageclasses to the list of allowed resources in the kube-state-metrics-cluster-role.yaml file.

@xieyanker
Copy link
Contributor Author

You need to add storageclasses to the list of allowed resources in the kube-state-metrics-cluster-role.yaml file.

Thank you, got it

@tariq1890
Copy link
Contributor

Can you address @mxinden's comment and also squash the commit history once this is good to merge?

Metrics: []*metric.Metric{
{
LabelKeys: []string{"resource_version"},
LabelValues: []string{s.ObjectMeta.ResourceVersion},
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 still a little sceptic about this. If at all, why wouldn't this be the metric's value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refer to other code which use ResourceVersion as metric, I found all of them use 1 as metric's value.
for example: kube_secret_metadata_resource_version, kube_configmap_metadata_resource_version and kube_ingress_metadata_resource_version.

Copy link
Member

Choose a reason for hiding this comment

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

Wow, you're totally right the other metrics do that, but it's wrong, we should have never merged those. Thanks for noticing! We should add these to the breaking release issue.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should skip this one or model it in a different way for now. Do you have a concrete alerting use case in mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remove resource_version for the time being, and I think it's not necessary to alert about storageclass, I only want to monitor its info.

@brancz
Copy link
Member

brancz commented Jun 7, 2019

Thanks!

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brancz, xieyanker

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 Jun 7, 2019
@k8s-ci-robot k8s-ci-robot merged commit 9520c99 into kubernetes:master Jun 7, 2019
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

storageclass metrics can be supported?
5 participants