Skip to content

Commit

Permalink
Merge pull request kubevirt#11294 from machadovilaca/fix-kubevirt_vm_…
Browse files Browse the repository at this point in the history
…created_total-by-pod

Fix kubevirt_vm_created_total being broken down by virt-api pod
  • Loading branch information
kubevirt-bot authored Apr 5, 2024
2 parents 8190e54 + cf4cbeb commit 4381444
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ The current available memory of the VM containers based on the rss. Type: Gauge.
### kubevirt_vm_container_free_memory_bytes_based_on_working_set_bytes
The current available memory of the VM containers based on the working set. Type: Gauge.

### kubevirt_vm_created_by_pod_total
The total number of VMs created by namespace and virt-api pod, since install. Type: Counter.

### kubevirt_vm_created_total
Amount of VMs created, broken down by namespace, since install. Type: Counter.
The total number of VMs created by namespace, since install. Type: Counter.

### kubevirt_vm_error_status_last_transition_timestamp_seconds
Virtual Machine last transition timestamp to error status. Type: Counter.
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitoring/metrics/virt-api/vm_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ var (

vmsCreatedCounter = operatormetrics.NewCounterVec(
operatormetrics.MetricOpts{
Name: "kubevirt_vm_created_total",
Help: "Amount of VMs created, broken down by namespace, since install.",
Name: "kubevirt_vm_created_by_pod_total",
Help: "The total number of VMs created by namespace and virt-api pod, since install.",
},
[]string{"namespace"},
)
Expand Down
8 changes: 8 additions & 0 deletions pkg/monitoring/rules/recordingrules/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,12 @@ var vmRecordingRules = []operatorrules.RecordingRule{
MetricType: operatormetrics.GaugeType,
Expr: intstr.FromString("sum by (namespace) (count by (name,namespace) (kubevirt_vm_error_status_last_transition_timestamp_seconds + kubevirt_vm_migrating_status_last_transition_timestamp_seconds + kubevirt_vm_non_running_status_last_transition_timestamp_seconds + kubevirt_vm_running_status_last_transition_timestamp_seconds + kubevirt_vm_starting_status_last_transition_timestamp_seconds))"),
},
{
MetricsOpts: operatormetrics.MetricOpts{
Name: "kubevirt_vm_created_total",
Help: "The total number of VMs created by namespace, since install.",
},
MetricType: operatormetrics.CounterType,
Expr: intstr.FromString("sum by (namespace) (kubevirt_vm_created_by_pod_total)"),
},
}

0 comments on commit 4381444

Please sign in to comment.