Skip to content

Commit

Permalink
adapt to metal-api v0.35.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mwennrich committed Sep 16, 2024
1 parent 9d43e0d commit 0e80be1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/metal-stack/metal-metrics-exporter
go 1.23

require (
github.com/metal-stack/metal-go v0.35.0
github.com/metal-stack/metal-go v0.35.2
github.com/prometheus/client_golang v1.20.3
k8s.io/klog/v2 v2.130.1
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNB
github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/metal-stack/metal-go v0.35.0 h1:Ixj2iB3bc3jvveeCcSSdYosyt7nP2/3Mg6tf8Ks7YmU=
github.com/metal-stack/metal-go v0.35.0/go.mod h1:3MJTYCS4YJz8D8oteTKhjpaAKNMMjMKYDrIy9awHGtQ=
github.com/metal-stack/metal-go v0.35.2 h1:brTbmPUiYSH9IdbnCkrcRWFRlIfc0H/53f2phsB+5kY=
github.com/metal-stack/metal-go v0.35.2/go.mod h1:3MJTYCS4YJz8D8oteTKhjpaAKNMMjMKYDrIy9awHGtQ=
github.com/metal-stack/metal-lib v0.18.2 h1:EAmZkZeKpenAvxZRSKsA6gj9Jd8XLR6Z0/QhABFCCDE=
github.com/metal-stack/metal-lib v0.18.2/go.mod h1:GJjipRpHmpd2vjBtsaw9gGk5ZFan7NlShyjIsTdY1x4=
github.com/metal-stack/security v0.8.1 h1:4zmVUxZvDWShVvVIxM3XhIv7pTmPe9DvACRIHW6YTsk=
Expand Down
16 changes: 8 additions & 8 deletions metalCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type metalCollector struct {
capacityTotal *prometheus.Desc
capacityWaiting *prometheus.Desc
capacityFree *prometheus.Desc
capacityFreeAvailable *prometheus.Desc
capacityAllocatable *prometheus.Desc
capacityPhonedHome *prometheus.Desc
capacityUnavailable *prometheus.Desc
capacityOther *prometheus.Desc
Expand Down Expand Up @@ -93,12 +93,12 @@ func newMetalCollector(client metalgo.Client) *metalCollector {
),
capacityFree: prometheus.NewDesc(
"metal_partition_capacity_free",
"(DEPRECATED) The total number of waiting machines in the partition",
"(DEPRECATED) The total number of allocatable machines in the partition, use metal_partition_capacity_allocatable",
[]string{"partition", "size"}, nil,
),
capacityFreeAvailable: prometheus.NewDesc(
"metal_partition_capacity_free_available",
"The total number of free available (waiting and unreserved) machines in the partition",
capacityAllocatable: prometheus.NewDesc(
"metal_partition_capacity_allocatable",
"The total number of waiting allocatable machines in the partition",
[]string{"partition", "size"}, nil,
),
capacityAllocated: prometheus.NewDesc(
Expand Down Expand Up @@ -199,7 +199,7 @@ func (collector *metalCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- collector.availablePrefixes
ch <- collector.capacityTotal
ch <- collector.capacityFree
ch <- collector.capacityFreeAvailable
ch <- collector.capacityAllocatable
ch <- collector.capacityPhonedHome
ch <- collector.capacityUnavailable
ch <- collector.capacityOther
Expand Down Expand Up @@ -261,8 +261,8 @@ func (collector *metalCollector) Collect(ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(collector.capacityTotal, prometheus.GaugeValue, float64(s.Total), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityAllocated, prometheus.GaugeValue, float64(s.Allocated), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityWaiting, prometheus.GaugeValue, float64(s.Waiting), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityFree, prometheus.GaugeValue, float64(s.Free+s.Reservations-s.Usedreservations), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityFreeAvailable, prometheus.GaugeValue, float64(s.Free), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityFree, prometheus.GaugeValue, float64(s.Allocatable), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityAllocatable, prometheus.GaugeValue, float64(s.Allocatable), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityFaulty, prometheus.GaugeValue, float64(s.Faulty), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityReservationsTotal, prometheus.GaugeValue, float64(s.Reservations), *p.ID, *s.Size)
ch <- prometheus.MustNewConstMetric(collector.capacityReservationsUsed, prometheus.GaugeValue, float64(s.Usedreservations), *p.ID, *s.Size)
Expand Down

0 comments on commit 0e80be1

Please sign in to comment.