diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e8f66b..900e82e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.22.3" + go-version: "1.22.4" - name: Install Linters run: | diff --git a/Dockerfile b/Dockerfile index 78f8b10..5e8e7d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3 AS builder +FROM golang:1.22.4 AS builder WORKDIR /ebpf_exporter diff --git a/collectors/map.go b/collectors/map.go index b0a0221..cd590f0 100644 --- a/collectors/map.go +++ b/collectors/map.go @@ -27,6 +27,7 @@ type MapCollector struct { cfg MapCollectorConfig infoDesc *prometheus.Desc + maxEntriesDesc *prometheus.Desc currEntriesDesc *prometheus.Desc } @@ -37,7 +38,13 @@ func NewMapCollector(cfg MapCollectorConfig) *MapCollector { infoDesc: prometheus.NewDesc( prometheus.BuildFQName(ebpfNamespace, mapSubsystem, "info"), "information on currently loaded eBPF maps", - []string{mapIDLabel, "map_type", "map_name", "key_size", "value_size", "max_entries", "flags"}, + []string{mapIDLabel, "map_type", "map_name", "key_size", "value_size", "flags"}, + nil, + ), + maxEntriesDesc: prometheus.NewDesc( + prometheus.BuildFQName(ebpfNamespace, mapSubsystem, "max_entries"), + "the configured max entries attribute of an eBPF map", + []string{mapIDLabel}, nil, ), } @@ -105,10 +112,14 @@ func (mc *MapCollector) collectForMap(mapID ebpf.MapID, ch chan<- prometheus.Met info.Name, strconv.FormatUint(uint64(info.KeySize), 10), strconv.FormatUint(uint64(info.ValueSize), 10), - strconv.FormatUint(uint64(info.MaxEntries), 10), strconv.FormatUint(uint64(m.Flags()), 10), ) + ch <- prometheus.MustNewConstMetric(mc.maxEntriesDesc, prometheus.GaugeValue, + float64(info.MaxEntries), + strconv.FormatUint(uint64(mapID), 10), + ) + if mc.currEntriesDesc != nil { var count uint64 throwawayKey := discardEncoding{}