Skip to content

Commit

Permalink
Merge pull request #578 from sapcc/report-commitment-duration-as-metric
Browse files Browse the repository at this point in the history
add metric: limes_available_commitment_duration
  • Loading branch information
majewsky authored Oct 9, 2024
2 parents f86b64f + 87680ee commit 9ea9d1f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/collector/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ func (d *DataMetricsReporter) ServeHTTP(w http.ResponseWriter, r *http.Request)
bw := bufio.NewWriter(w)
printDataMetrics(bw, metricsBySeries, "limes_autogrow_growth_multiplier", `For resources with quota distribution model "autogrow", reports the configured growth multiplier.`)
printDataMetrics(bw, metricsBySeries, "limes_autogrow_quota_overcommit_threshold_percent", `For resources with quota distribution model "autogrow", reports the allocation percentage above which quota overcommit is disabled.`)
printDataMetrics(bw, metricsBySeries, "limes_available_commitment_duration", `Reports which commitment durations are available for new commitments on a Limes resource.`)
printDataMetrics(bw, metricsBySeries, "limes_cluster_capacity", `Reported capacity of a Limes resource for an OpenStack cluster.`)
printDataMetrics(bw, metricsBySeries, "limes_cluster_capacity_per_az", "Reported capacity of a Limes resource for an OpenStack cluster in a specific availability zone.")
printDataMetrics(bw, metricsBySeries, "limes_cluster_usage_per_az", "Actual usage of a Limes resource for an OpenStack cluster in a specific availability zone.")
Expand Down Expand Up @@ -771,6 +772,14 @@ func (d *DataMetricsReporter) collectMetricsBySeries() (map[string][]dataMetric,
metric = dataMetric{Labels: labels, Value: qdc.Autogrow.AllowQuotaOvercommitUntilAllocatedPercent}
result["limes_autogrow_quota_overcommit_threshold_percent"] = append(result["limes_autogrow_quota_overcommit_threshold_percent"], metric)
}

for _, duration := range behavior.CommitmentDurations {
labels := fmt.Sprintf(`duration=%q,resource=%q,service=%q,service_name=%q`,
duration.String(), apiIdentity.Name, apiIdentity.ServiceType, serviceNameByType[dbServiceType],
)
metric := dataMetric{Labels: labels, Value: 1.0}
result["limes_available_commitment_duration"] = append(result["limes_available_commitment_duration"], metric)
}
}
}

Expand Down

0 comments on commit 9ea9d1f

Please sign in to comment.