Skip to content

Commit

Permalink
Telemetry metrics - minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy authored and ahadas committed Jun 27, 2024
1 parent 0887c14 commit 50a2566
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: kubev2v/forkliftci
ref: v15.0
ref: v16.0

- name: Build and setup everything with bazel
id: forkliftci
Expand Down
38 changes: 19 additions & 19 deletions pkg/monitoring/metrics/forklift-controller/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const (
)

var (
// 'status' - [ succeeded, failed, Executing, Canceled]
// 'provider' - [oVirt, vSphere, Openstack, OVA, openshift]
// 'status' - [ Succeeded, Failed, Executing, Canceled]
// 'provider' - [oVirt, VSphere, Openstack, OVA, Openshift]
// 'mode' - [Cold, Warm]
// 'target' - [Local, Remote]
migratioStatusCounter = promauto.NewGaugeVec(prometheus.GaugeOpts{
migrationStatusGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "mtv_migrations_status",
Help: "VM Migrations sorted by status status, provider, mode and destination",
Help: "VM Migrations sorted by status, provider, mode and destination",
},
[]string{
"status",
Expand All @@ -38,11 +38,11 @@ var (
},
)

// 'status' - [ succeeded, failed, Executing, Running, Pending, Canceled, Blocked, Deleted]
// 'provider' - [oVirt, vSphere, Openstack, OVA, openshift]
// 'status' - [ Succeeded, Failed, Executing, Running, Pending, Canceled, Blocked, Deleted]
// 'provider' - [oVirt, VSphere, Openstack, OVA, Openshift]
// 'mode' - [Cold, Warm]
// 'target' - [Local, Remote]
planStatusCounter = promauto.NewGaugeVec(prometheus.GaugeOpts{
planStatusGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "mtv_plans_status",
Help: "VM migration Plans sorted by status, provider, mode and destination",
},
Expand All @@ -54,24 +54,24 @@ var (
},
)

// 'status' - [ succeeded, failed, Executing, Canceled]
// 'provider' - [oVirt, vSphere, Openstack, OVA, openshift]
// 'status' - [ Succeeded, Failed, Executing, Canceled]
// 'provider' - [oVirt, VSphere, Openstack, OVA, Openshift]
// 'mode' - [Cold, Warm]
// 'target' - [Local, Remote]
// 'plan' - [Id]
migrationDurationGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "mtv_migration_duration_in_seconds",
Name: "mtv_migration_duration_seconds",
Help: "Duration of VM migrations in seconds",
},
[]string{"provider", "mode", "target", "plan"},
)

// 'provider' - [oVirt, vSphere, Openstack, OVA, openshift]
// 'provider' - [oVirt, VSphere, Openstack, OVA, Openshift]
// 'mode' - [Cold, Warm]
// 'target' - [Local, Remote]
// 'plan' - [Id]
dataTransferredGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "mtv_data_transferred_in_bytes",
Name: "mtv_migration_data_transferred_bytes",
Help: "Total data transferred during VM migrations in bytes",
},
[]string{
Expand All @@ -82,14 +82,14 @@ var (
},
)

// 'status' - [ succeeded, failed, Executing, Canceled]
// 'provider' - [oVirt, vSphere, Openstack, OVA, openshift]
// 'status' - [ Succeeded, Failed, Executing, Canceled]
// 'provider' - [oVirt, VSphere, Openstack, OVA, Openshift]
// 'mode' - [Cold, Warm]
// 'target' - [Local, Remote]
// 'plan' - [Id]
migratioPlanCorolationStatusnCounter = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "mtv_workload_migrations_status_plan_correlation",
Help: "VM Migrations by status, provider type and plan",
migrationPlanCorrelationStatusGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "mtv_workload_migrations_status",
Help: "VM Migrations status by provider, mode, destination and plan",
},
[]string{
"status",
Expand All @@ -100,11 +100,11 @@ var (
},
)

// 'provider' - [oVirt, vSphere, Openstack, OVA, openshift]
// 'provider' - [oVirt, VSphere, Openstack, OVA, Openshift]
// 'mode' - [Cold, Warm]
// 'target' - [Local, Remote]
migrationDurationHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "mtv_migration_duration_in_seconds_bucket",
Name: "mtv_migrations_duration_seconds",
Help: "Histogram of VM migrations duration in seconds",
Buckets: []float64{1 * 3600, 2 * 3600, 5 * 3600, 10 * 3600, 24 * 3600, 48 * 3600}, // 1, 2, 5, 10, 24, 48 hours in seconds
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func RecordMigrationMetrics(c client.Client) {

for key, value := range counterMap {
parts := strings.Split(key, "|")
migratioStatusCounter.With(prometheus.Labels{"status": parts[0], "provider": parts[1], "mode": parts[2], "target": parts[3]}).Set(value)
migratioPlanCorolationStatusnCounter.With(prometheus.Labels{"status": parts[0], "provider": parts[1], "mode": parts[2], "target": parts[3], "plan": parts[4]}).Set(value)
migrationStatusGauge.With(prometheus.Labels{"status": parts[0], "provider": parts[1], "mode": parts[2], "target": parts[3]}).Set(value)
migrationPlanCorrelationStatusGauge.With(prometheus.Labels{"status": parts[0], "provider": parts[1], "mode": parts[2], "target": parts[3], "plan": parts[4]}).Set(value)
}
}
}()
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitoring/metrics/forklift-controller/plan_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func RecordPlanMetrics(c client.Client) {
for {
time.Sleep(10 * time.Second)

// get all migration objects
// get all plans objects
plans := api.PlanList{}
err := c.List(context.TODO(), &plans)

Expand Down Expand Up @@ -96,7 +96,7 @@ func RecordPlanMetrics(c client.Client) {

for key, value := range plansCounterMap {
parts := strings.Split(key, "|")
planStatusCounter.With(prometheus.Labels{"status": parts[0], "provider": parts[1], "mode": parts[2], "target": parts[3]}).Set(value)
planStatusGauge.With(prometheus.Labels{"status": parts[0], "provider": parts[1], "mode": parts[2], "target": parts[3]}).Set(value)
}
}
}()
Expand Down

0 comments on commit 50a2566

Please sign in to comment.