From fad537cad73b166093d975d898b95b24e3e6f612 Mon Sep 17 00:00:00 2001 From: Mike Bryant Date: Thu, 23 Feb 2017 11:41:07 +0000 Subject: [PATCH] Add prometheus metrics for pending Allocates and Claims --- prog/weaver/metrics.go | 12 ++++++++++++ site/metrics.md | 2 ++ 2 files changed, 14 insertions(+) diff --git a/prog/weaver/metrics.go b/prog/weaver/metrics.go index 3ab4a4a9..9063f404 100644 --- a/prog/weaver/metrics.go +++ b/prog/weaver/metrics.go @@ -82,6 +82,18 @@ var metrics = []metric{ ch <- intGauge(desc, metrics.Flows) } }}, + {desc("weave_ipam_pending_allocates", "Number of pending allocates."), + func(s WeaveStatus, desc *prometheus.Desc, ch chan<- prometheus.Metric) { + if s.IPAM != nil { + ch <- intGauge(desc, len(s.IPAM.PendingAllocates)) + } + }}, + {desc("weave_ipam_pending_claims", "Number of pending claims."), + func(s WeaveStatus, desc *prometheus.Desc, ch chan<- prometheus.Metric) { + if s.IPAM != nil { + ch <- intGauge(desc, len(s.IPAM.PendingClaims)) + } + }}, } func fastDPMetrics(s WeaveStatus) *weave.FastDPMetrics { diff --git a/site/metrics.md b/site/metrics.md index 068eb953..56c57720 100644 --- a/site/metrics.md +++ b/site/metrics.md @@ -19,6 +19,8 @@ exposed: * `weave_max_ips` - Size of IP address space used by allocator. * `weave_dns_entries` - Number of DNS entries. * `weave_flows` - Number of FastDP flows. +* `weave_ipam_pending_allocates` - Number of pending allocates. +* `weave_ipam_pending_claims` - Number of pending claims. #### Publish Router Metrics Endpoint