mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +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"},
|
||||
)
|
||||
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 }}
|
||||
etcdEventsReceivedCounts = compbasemetrics.NewCounterVec(
|
||||
&compbasemetrics.CounterOpts{
|
||||
@ -288,21 +288,21 @@ func (c *monitorCollector) CollectWithStability(ch chan<- compbasemetrics.Metric
|
||||
}
|
||||
|
||||
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)
|
||||
metrics, err := m.Monitor(ctx)
|
||||
cancel()
|
||||
m.Close()
|
||||
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
|
||||
}
|
||||
|
||||
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 {
|
||||
klog.ErrorS(err, "Failed to create metric", "cluster", cluster)
|
||||
klog.ErrorS(err, "Failed to create metric", "storage_cluster_id", storageClusterID)
|
||||
}
|
||||
ch <- metric
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ func TestStorageSizeCollector(t *testing.T) {
|
||||
err: nil,
|
||||
want: `# HELP apiserver_storage_size_bytes [STABLE] Size of the storage database file physically allocated in bytes.
|
||||
# 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
|
||||
stabilityLevel: ALPHA
|
||||
labels:
|
||||
- cluster
|
||||
- storage_cluster_id
|
||||
- name: terminated_watchers_total
|
||||
namespace: apiserver
|
||||
help: Counter of watchers closed due to unresponsiveness broken by resource type.
|
||||
|
@ -8,7 +8,7 @@ description: >-
|
||||
|
||||
## Metrics (v1.30)
|
||||
|
||||
<!-- (auto-generated 2024 Jan 14) -->
|
||||
<!-- (auto-generated 2024 Apr 11) -->
|
||||
<!-- (auto-generated v1.30) -->
|
||||
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.
|
||||
@ -1094,7 +1094,7 @@ Alpha metrics do not have any API guarantees. These metrics must be used at your
|
||||
<ul>
|
||||
<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 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 class="metric_name">apiserver_storage_transformation_duration_seconds</div>
|
||||
<div class="metric_help">Latencies in seconds of value transformation operations.</div>
|
||||
|
@ -314,7 +314,7 @@
|
||||
type: Custom
|
||||
stabilityLevel: STABLE
|
||||
labels:
|
||||
- cluster
|
||||
- storage_cluster_id
|
||||
- name: container_cpu_usage_seconds_total
|
||||
help: Cumulative cpu time consumed by the container in core-seconds
|
||||
type: Custom
|
||||
|
Loading…
Reference in New Issue
Block a user