Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.3 AS builder
FROM golang:1.22.4 AS builder

WORKDIR /ebpf_exporter

Expand Down
15 changes: 13 additions & 2 deletions collectors/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type MapCollector struct {
cfg MapCollectorConfig

infoDesc *prometheus.Desc
maxEntriesDesc *prometheus.Desc
currEntriesDesc *prometheus.Desc
}

Expand All @@ -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,
),
}
Expand Down Expand Up @@ -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{}
Expand Down