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

v2: Remove deprecated metrics #1004

Merged
merged 1 commit into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,6 @@ Stages about metrics are grouped into three categories:
| STABLE | Metrics which should have very few backwards-incompatible changes outside of major version updates. |
| DEPRECATED | Metrics which will be removed once the deprecation timeline is met. |

## Metrics Deprecation

- **The following non-generic resource metrics for pods are marked deprecated. They will be removed in kube-state-metrics v2.0.0.**
`kube_pod_container_resource_requests` and `kube_pod_container_resource_limits` are the replacements with `resource` labels
representing the resource name and `unit` labels representing the resource unit.
- kube_pod_container_resource_requests_cpu_cores
- kube_pod_container_resource_limits_cpu_cores
- kube_pod_container_resource_requests_memory_bytes
- kube_pod_container_resource_limits_memory_bytes
- **The following non-generic resource metrics for nodes are marked deprecated. They will be removed in kube-state-metrics v2.0.0.**
`kube_node_status_capacity` and `kube_node_status_allocatable` are the replacements with `resource` labels
representing the resource name and `unit` labels representing the resource unit.
- kube_node_status_capacity_pods
- kube_node_status_capacity_cpu_cores
- kube_node_status_capacity_memory_bytes
- kube_node_status_allocatable_pods
- kube_node_status_allocatable_cpu_cores
- kube_node_status_allocatable_memory_bytes

## Exposed Metrics

Per group of metrics there is one file for each metrics. See each file for specific documentation about the exposed metrics:
Expand Down
60 changes: 29 additions & 31 deletions docs/cli-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,33 @@ spec:
```txt
$ kube-state-metrics -h
Usage of ./kube-state-metrics:
--add_dir_header If true, adds the file directory to the header
Copy link
Member

Choose a reason for hiding this comment

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

Besides from here, we also need to remove them from the docs. https://github.com/kubernetes/kube-state-metrics/blob/f09db29f7955e5e628c54130fac1ac116836412c/docs/node-metrics.md

That should fix the CI.

--alsologtostderr log to standard error as well as files
--apiserver string The URL of the apiserver to use as a master
--collectors string Comma-separated list of collectors to be enabled. Defaults to "certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments"
--disable-node-non-generic-resource-metrics Disable node non generic resource request and limit metrics
--disable-pod-non-generic-resource-metrics Disable pod non generic resource request and limit metrics
--enable-gzip-encoding Gzip responses when requested by clients via 'Accept-Encoding: gzip' header.
-h, --help Print Help text
--host string Host to expose metrics on. (default "0.0.0.0")
--kubeconfig string Absolute path to the kubeconfig file
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--log_file string If non-empty, use this log file
--log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files (default true)
--metric-allowlist string Comma-separated list of metrics to be exposed. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
--metric-denylist string Comma-separated list of metrics not to be enabled. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
--namespace string Comma-separated list of namespaces to be enabled. Defaults to ""
--pod string Name of the pod that contains the kube-state-metrics container. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
--pod-namespace string Name of the namespace of the pod specified by --pod. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
--port int Port to expose metrics on. (default 8080)
--shard int32 The instances shard nominal (zero indexed) within the total number of shards. (default 0)
--skip_headers If true, avoid header prefixes in the log messages
--skip_log_headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
--telemetry-host string Host to expose kube-state-metrics self metrics on. (default "0.0.0.0")
--telemetry-port int Port to expose kube-state-metrics self metrics on. (default 8081)
--total-shards int The total number of shards. Sharding is disabled when total shards is set to 1. (default 1)
-v, --v Level number for the log level verbosity
--version kube-state-metrics build version information
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--add_dir_header If true, adds the file directory to the header
--alsologtostderr log to standard error as well as files
--apiserver string The URL of the apiserver to use as a master
--collectors string Comma-separated list of collectors to be enabled. Defaults to "certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments"
--enable-gzip-encoding Gzip responses when requested by clients via 'Accept-Encoding: gzip' header.
-h, --help Print Help text
--host string Host to expose metrics on. (default "0.0.0.0")
--kubeconfig string Absolute path to the kubeconfig file
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--log_file string If non-empty, use this log file
--log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files (default true)
--metric-allowlist string Comma-separated list of metrics to be exposed. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
--metric-denylist string Comma-separated list of metrics not to be enabled. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
--namespace string Comma-separated list of namespaces to be enabled. Defaults to ""
--pod string Name of the pod that contains the kube-state-metrics container. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
--pod-namespace string Name of the namespace of the pod specified by --pod. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
--port int Port to expose metrics on. (default 8080)
--shard int32 The instances shard nominal (zero indexed) within the total number of shards. (default 0)
--skip_headers If true, avoid header prefixes in the log messages
--skip_log_headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
--telemetry-host string Host to expose kube-state-metrics self metrics on. (default "0.0.0.0")
--telemetry-port int Port to expose kube-state-metrics self metrics on. (default 8081)
--total-shards int The total number of shards. Sharding is disabled when total shards is set to 1. (default 1)
-v, --v Level number for the log level verbosity
--version kube-state-metrics build version information
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
```
7 changes: 0 additions & 7 deletions docs/node-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@
| kube_node_role | Gauge | `node`=&lt;node-address&gt; <br> `role`=&lt;NODE_ROLE&gt; | EXPERIMENTAL |
| kube_node_spec_unschedulable | Gauge | `node`=&lt;node-address&gt;|
| kube_node_spec_taint | Gauge | `node`=&lt;node-address&gt; <br> `key`=&lt;taint-key&gt; <br> `value=`&lt;taint-value&gt; <br> `effect=`&lt;taint-effect&gt; | STABLE |
| kube_node_status_phase| Gauge | `node`=&lt;node-address&gt; <br> `phase`=&lt;Pending\|Running\|Terminated&gt; | DEPRECATED |
| kube_node_status_capacity | Gauge | `node`=&lt;node-address&gt; <br> `resource`=&lt;resource-name&gt; <br> `unit=`&lt;resource-unit&gt;| STABLE |
| kube_node_status_capacity_cpu_cores | Gauge | `node`=&lt;node-address&gt;| DEPRECATED |
| kube_node_status_capacity_memory_bytes | Gauge | `node`=&lt;node-address&gt;| DEPRECATED |
| kube_node_status_capacity_pods | Gauge | `node`=&lt;node-address&gt;| DEPRECATED |
| kube_node_status_allocatable | Gauge | `node`=&lt;node-address&gt; <br> `resource`=&lt;resource-name&gt; <br> `unit=`&lt;resource-unit&gt;| STABLE |
| kube_node_status_allocatable_cpu_cores | Gauge | `node`=&lt;node-address&gt;| DEPRECATED |
| kube_node_status_allocatable_memory_bytes | Gauge | `node`=&lt;node-address&gt;| DEPRECATED |
| kube_node_status_allocatable_pods | Gauge | `node`=&lt;node-address&gt;| DEPRECATED |
| kube_node_status_condition | Gauge | `node`=&lt;node-address&gt; <br> `condition`=&lt;node-condition&gt; <br> `status`=&lt;true\|false\|unknown&gt; | STABLE |
| kube_node_created | Gauge | `node`=&lt;node-address&gt;| STABLE |
4 changes: 0 additions & 4 deletions docs/pod-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
| kube_pod_container_status_last_terminated_reason | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;OOMKilled\|Error\|Completed\|ContainerCannotRun\|DeadlineExceeded&gt; | STABLE |
| kube_pod_container_status_ready | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; | STABLE |
| kube_pod_container_status_restarts_total | Counter | `container`=&lt;container-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `pod`=&lt;pod-name&gt; | STABLE |
| kube_pod_container_resource_requests_cpu_cores | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; | DEPRECATED |
| kube_pod_container_resource_requests | Gauge | `resource`=&lt;resource-name&gt; <br> `unit`=&lt;resource-unit&gt; <br> `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; | STABLE |
| kube_pod_container_resource_requests_memory_bytes | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; | DEPRECATED |
| kube_pod_container_resource_limits_cpu_cores | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; | DEPRECATED |
| kube_pod_container_resource_limits | Gauge | `resource`=&lt;resource-name&gt; <br> `unit`=&lt;resource-unit&gt; <br> `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; | STABLE |
| kube_pod_container_resource_limits_memory_bytes | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `node`=&lt; node-name&gt; | DEPRECATED |
| kube_pod_created | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; |
| kube_pod_restart_policy | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `type`=&lt;Always|Never|OnFailure&gt; | STABLE |
| kube_pod_init_container_info | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `image`=&lt;image-name&gt; <br> `image_id`=&lt;image-id&gt; <br> `container_id`=&lt;containerid&gt; | STABLE |
Expand Down
154 changes: 0 additions & 154 deletions internal/store/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,44 +193,6 @@ var (
}
}),
},
{
Name: "kube_node_status_phase",
Type: metric.Gauge,
Help: "The phase the node is currently in.",
GenerateFunc: wrapNodeFunc(func(n *v1.Node) *metric.Family {
p := n.Status.Phase

if p == "" {
return &metric.Family{
Metrics: []*metric.Metric{},
}
}

// Set current phase to 1, others to 0 if it is set.
ms := []*metric.Metric{
{
LabelValues: []string{string(v1.NodePending)},
Value: boolFloat64(p == v1.NodePending),
},
{
LabelValues: []string{string(v1.NodeRunning)},
Value: boolFloat64(p == v1.NodeRunning),
},
{
LabelValues: []string{string(v1.NodeTerminated)},
Value: boolFloat64(p == v1.NodeTerminated),
},
}

for _, metric := range ms {
metric.LabelKeys = []string{"phase"}
}

return &metric.Family{
Metrics: ms,
}
}),
},
{
Name: "kube_node_status_capacity",
Type: metric.Gauge,
Expand Down Expand Up @@ -309,64 +271,6 @@ var (
}
}),
},
{
Name: "kube_node_status_capacity_pods",
Type: metric.Gauge,
Help: "The total pod resources of the node.",
GenerateFunc: wrapNodeFunc(func(n *v1.Node) *metric.Family {
ms := []*metric.Metric{}

// Add capacity and allocatable resources if they are set.
if v, ok := n.Status.Capacity[v1.ResourcePods]; ok {
ms = append(ms, &metric.Metric{

Value: float64(v.MilliValue()) / 1000,
})
}

return &metric.Family{
Metrics: ms,
}
}),
},
{
Name: "kube_node_status_capacity_cpu_cores",
Type: metric.Gauge,
Help: "The total CPU resources of the node.",
GenerateFunc: wrapNodeFunc(func(n *v1.Node) *metric.Family {
ms := []*metric.Metric{}

// Add capacity and allocatable resources if they are set.
if v, ok := n.Status.Capacity[v1.ResourceCPU]; ok {
ms = append(ms, &metric.Metric{
Value: float64(v.MilliValue()) / 1000,
})
}

return &metric.Family{
Metrics: ms,
}
}),
},
{
Name: "kube_node_status_capacity_memory_bytes",
Type: metric.Gauge,
Help: "The total memory resources of the node.",
GenerateFunc: wrapNodeFunc(func(n *v1.Node) *metric.Family {
ms := []*metric.Metric{}

// Add capacity and allocatable resources if they are set.
if v, ok := n.Status.Capacity[v1.ResourceMemory]; ok {
ms = append(ms, &metric.Metric{
Value: float64(v.MilliValue()) / 1000,
})
}

return &metric.Family{
Metrics: ms,
}
}),
},
{
Name: "kube_node_status_allocatable",
Type: metric.Gauge,
Expand Down Expand Up @@ -441,64 +345,6 @@ var (
m.LabelKeys = []string{"resource", "unit"}
}

return &metric.Family{
Metrics: ms,
}
}),
},
{
Name: "kube_node_status_allocatable_pods",
Type: metric.Gauge,
Help: "The pod resources of a node that are available for scheduling.",
GenerateFunc: wrapNodeFunc(func(n *v1.Node) *metric.Family {
ms := []*metric.Metric{}

// Add capacity and allocatable resources if they are set.
if v, ok := n.Status.Allocatable[v1.ResourcePods]; ok {
ms = append(ms, &metric.Metric{
Value: float64(v.MilliValue()) / 1000,
})
}

return &metric.Family{
Metrics: ms,
}
}),
},
{
Name: "kube_node_status_allocatable_cpu_cores",
Type: metric.Gauge,
Help: "The CPU resources of a node that are available for scheduling.",
GenerateFunc: wrapNodeFunc(func(n *v1.Node) *metric.Family {
ms := []*metric.Metric{}

// Add capacity and allocatable resources if they are set.
if v, ok := n.Status.Allocatable[v1.ResourceCPU]; ok {
ms = append(ms, &metric.Metric{
Value: float64(v.MilliValue()) / 1000,
})
}

return &metric.Family{
Metrics: ms,
}
}),
},
{
Name: "kube_node_status_allocatable_memory_bytes",
Type: metric.Gauge,
Help: "The memory resources of a node that are available for scheduling.",
GenerateFunc: wrapNodeFunc(func(n *v1.Node) *metric.Family {
ms := []*metric.Metric{}

// Add capacity and allocatable resources if they are set.
if v, ok := n.Status.Allocatable[v1.ResourceMemory]; ok {
ms = append(ms, &metric.Metric{

Value: float64(v.MilliValue()) / 1000,
})
}

return &metric.Family{
Metrics: ms,
}
Expand Down
Loading