mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Merge pull request #124283 from dims/rename-cluster-to-storage_cluster_id-for-apiserver_storage_size_bytes-metric
Rename Label `cluster` to `storage_cluster_id` for apiserver_storage_size_bytes metric
This commit is contained in:
commit
cae35dba5a
@ -84,7 +84,7 @@ var (
|
|||||||
},
|
},
|
||||||
[]string{"endpoint"},
|
[]string{"endpoint"},
|
||||||
)
|
)
|
||||||
storageSizeDescription = compbasemetrics.NewDesc("apiserver_storage_size_bytes", "Size of the storage database file physically allocated in bytes.", []string{"cluster"}, nil, compbasemetrics.STABLE, "")
|
storageSizeDescription = compbasemetrics.NewDesc("apiserver_storage_size_bytes", "Size of the storage database file physically allocated in bytes.", []string{"storage_cluster_id"}, nil, compbasemetrics.STABLE, "")
|
||||||
storageMonitor = &monitorCollector{monitorGetter: func() ([]Monitor, error) { return nil, nil }}
|
storageMonitor = &monitorCollector{monitorGetter: func() ([]Monitor, error) { return nil, nil }}
|
||||||
etcdEventsReceivedCounts = compbasemetrics.NewCounterVec(
|
etcdEventsReceivedCounts = compbasemetrics.NewCounterVec(
|
||||||
&compbasemetrics.CounterOpts{
|
&compbasemetrics.CounterOpts{
|
||||||
@ -288,21 +288,21 @@ func (c *monitorCollector) CollectWithStability(ch chan<- compbasemetrics.Metric
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, m := range monitors {
|
for i, m := range monitors {
|
||||||
cluster := fmt.Sprintf("etcd-%d", i)
|
storageClusterID := fmt.Sprintf("etcd-%d", i)
|
||||||
|
|
||||||
klog.V(4).InfoS("Start collecting storage metrics", "cluster", cluster)
|
klog.V(4).InfoS("Start collecting storage metrics", "storage_cluster_id", storageClusterID)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
metrics, err := m.Monitor(ctx)
|
metrics, err := m.Monitor(ctx)
|
||||||
cancel()
|
cancel()
|
||||||
m.Close()
|
m.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.InfoS("Failed to get storage metrics", "cluster", cluster, "err", err)
|
klog.InfoS("Failed to get storage metrics", "storage_cluster_id", storageClusterID, "err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
metric, err := compbasemetrics.NewConstMetric(storageSizeDescription, compbasemetrics.GaugeValue, float64(metrics.Size), cluster)
|
metric, err := compbasemetrics.NewConstMetric(storageSizeDescription, compbasemetrics.GaugeValue, float64(metrics.Size), storageClusterID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.ErrorS(err, "Failed to create metric", "cluster", cluster)
|
klog.ErrorS(err, "Failed to create metric", "storage_cluster_id", storageClusterID)
|
||||||
}
|
}
|
||||||
ch <- metric
|
ch <- metric
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ func TestStorageSizeCollector(t *testing.T) {
|
|||||||
err: nil,
|
err: nil,
|
||||||
want: `# HELP apiserver_storage_size_bytes [STABLE] Size of the storage database file physically allocated in bytes.
|
want: `# HELP apiserver_storage_size_bytes [STABLE] Size of the storage database file physically allocated in bytes.
|
||||||
# TYPE apiserver_storage_size_bytes gauge
|
# TYPE apiserver_storage_size_bytes gauge
|
||||||
apiserver_storage_size_bytes{cluster="etcd-0"} 1e+09
|
apiserver_storage_size_bytes{storage_cluster_id="etcd-0"} 1e+09
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3209,7 +3209,7 @@
|
|||||||
type: Custom
|
type: Custom
|
||||||
stabilityLevel: ALPHA
|
stabilityLevel: ALPHA
|
||||||
labels:
|
labels:
|
||||||
- cluster
|
- storage_cluster_id
|
||||||
- name: terminated_watchers_total
|
- name: terminated_watchers_total
|
||||||
namespace: apiserver
|
namespace: apiserver
|
||||||
help: Counter of watchers closed due to unresponsiveness broken by resource type.
|
help: Counter of watchers closed due to unresponsiveness broken by resource type.
|
||||||
|
@ -8,7 +8,7 @@ description: >-
|
|||||||
|
|
||||||
## Metrics (v1.30)
|
## Metrics (v1.30)
|
||||||
|
|
||||||
<!-- (auto-generated 2024 Jan 14) -->
|
<!-- (auto-generated 2024 Apr 11) -->
|
||||||
<!-- (auto-generated v1.30) -->
|
<!-- (auto-generated v1.30) -->
|
||||||
This page details the metrics that different Kubernetes components export. You can query the metrics endpoint for these
|
This page details the metrics that different Kubernetes components export. You can query the metrics endpoint for these
|
||||||
components using an HTTP scrape, and fetch the current metrics data in Prometheus format.
|
components using an HTTP scrape, and fetch the current metrics data in Prometheus format.
|
||||||
@ -1094,7 +1094,7 @@ Alpha metrics do not have any API guarantees. These metrics must be used at your
|
|||||||
<ul>
|
<ul>
|
||||||
<li><label class="metric_detail">Stability Level:</label><span class="metric_stability_level">ALPHA</span></li>
|
<li><label class="metric_detail">Stability Level:</label><span class="metric_stability_level">ALPHA</span></li>
|
||||||
<li data-type="custom"><label class="metric_detail">Type:</label> <span class="metric_type">Custom</span></li>
|
<li data-type="custom"><label class="metric_detail">Type:</label> <span class="metric_type">Custom</span></li>
|
||||||
<li class="metric_labels_varying"><label class="metric_detail">Labels:</label><span class="metric_label">cluster</span></li></ul>
|
<li class="metric_labels_varying"><label class="metric_detail">Labels:</label><span class="metric_label">storage_cluster_id</span></li></ul>
|
||||||
</div><div class="metric" data-stability="alpha">
|
</div><div class="metric" data-stability="alpha">
|
||||||
<div class="metric_name">apiserver_storage_transformation_duration_seconds</div>
|
<div class="metric_name">apiserver_storage_transformation_duration_seconds</div>
|
||||||
<div class="metric_help">Latencies in seconds of value transformation operations.</div>
|
<div class="metric_help">Latencies in seconds of value transformation operations.</div>
|
||||||
|
@ -314,7 +314,7 @@
|
|||||||
type: Custom
|
type: Custom
|
||||||
stabilityLevel: STABLE
|
stabilityLevel: STABLE
|
||||||
labels:
|
labels:
|
||||||
- cluster
|
- storage_cluster_id
|
||||||
- name: container_cpu_usage_seconds_total
|
- name: container_cpu_usage_seconds_total
|
||||||
help: Cumulative cpu time consumed by the container in core-seconds
|
help: Cumulative cpu time consumed by the container in core-seconds
|
||||||
type: Custom
|
type: Custom
|
||||||
|
Loading…
Reference in New Issue
Block a user