-
Notifications
You must be signed in to change notification settings - Fork 17
/
service_discovery_collector_metrics.go
57 lines (53 loc) · 1.49 KB
/
service_discovery_collector_metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package collectors
import (
"github.com/prometheus/client_golang/prometheus"
)
type ServiceDiscoveryCollectorMetrics struct {
namespace string
environment string
boshName string
boshUUID string
}
func NewServiceDiscoveryCollectorMetrics(
namespace string,
environment string,
boshName string,
boshUUID string,
) *ServiceDiscoveryCollectorMetrics {
return &ServiceDiscoveryCollectorMetrics{
namespace: namespace,
environment: environment,
boshName: boshName,
boshUUID: boshUUID,
}
}
func (m *ServiceDiscoveryCollectorMetrics) NewLastServiceDiscoveryScrapeTimestampMetric() prometheus.Gauge {
return prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "",
Name: "last_service_discovery_scrape_timestamp",
Help: "Number of seconds since 1970 since last scrape of Service Discovery from BOSH.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
)
}
func (m *ServiceDiscoveryCollectorMetrics) NewLastServiceDiscoveryScrapeDurationSecondsMetric() prometheus.Gauge {
return prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "",
Name: "last_service_discovery_scrape_duration_seconds",
Help: "Duration of the last scrape of Service Discovery from BOSH.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
)
}