-
Notifications
You must be signed in to change notification settings - Fork 17
/
deployments_collector_metrics.go
143 lines (133 loc) · 4.14 KB
/
deployments_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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package collectors
import (
"github.com/prometheus/client_golang/prometheus"
)
type DeploymentsCollectorMetrics struct {
namespace string
environment string
boshName string
boshUUID string
}
func NewDeploymentsCollectorMetrics(
namespace string,
environment string,
boshName string,
boshUUID string,
) *DeploymentsCollectorMetrics {
return &DeploymentsCollectorMetrics{
namespace: namespace,
environment: environment,
boshName: boshName,
boshUUID: boshUUID,
}
}
func (m *DeploymentsCollectorMetrics) NewLastDeploymentsScrapeDurationSecondsMetric() prometheus.Gauge {
return prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "",
Name: "last_deployments_scrape_duration_seconds",
Help: "Duration of the last scrape of Deployments metrics from BOSH.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
)
}
func (m *DeploymentsCollectorMetrics) NewLastDeploymentsScrapeTimestampMetric() prometheus.Gauge {
return prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "",
Name: "last_deployments_scrape_timestamp",
Help: "Number of seconds since 1970 since last scrape of Deployments metrics from BOSH.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
)
}
func (m *DeploymentsCollectorMetrics) NewDeploymentInstancesMetric() *prometheus.GaugeVec {
return prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "deployment",
Name: "instances",
Help: "Number of instances in this deployment",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
[]string{"bosh_deployment", "bosh_vm_type"},
)
}
func (m *DeploymentsCollectorMetrics) NewDeploymentStemcellInfoMetric() *prometheus.GaugeVec {
return prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "deployment",
Name: "stemcell_info",
Help: "Labeled BOSH Deployment Stemcell Info with a constant '1' value.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
[]string{"bosh_deployment", "bosh_stemcell_name", "bosh_stemcell_version", "bosh_stemcell_os_name"},
)
}
func (m *DeploymentsCollectorMetrics) NewDeploymentReleasePackageInfoMetric() *prometheus.GaugeVec {
return prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "deployment",
Name: "release_package_info",
Help: "Labeled BOSH Deployment Release Package Info with a constant '1' value.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
[]string{"bosh_deployment", "bosh_release_name", "bosh_release_version", "bosh_release_package_name"},
)
}
func (m *DeploymentsCollectorMetrics) NewDeploymentReleaseJobInfoMetric() *prometheus.GaugeVec {
return prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "deployment",
Name: "release_job_info",
Help: "Labeled BOSH Deployment Release Job Info with a constant '1' value.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
[]string{"bosh_deployment", "bosh_release_name", "bosh_release_version", "bosh_release_job_name"},
)
}
func (m *DeploymentsCollectorMetrics) NewDeploymentReleaseInfoMetric() *prometheus.GaugeVec {
return prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: m.namespace,
Subsystem: "deployment",
Name: "release_info",
Help: "Labeled BOSH Deployment Release Info with a constant '1' value.",
ConstLabels: prometheus.Labels{
"environment": m.environment,
"bosh_name": m.boshName,
"bosh_uuid": m.boshUUID,
},
},
[]string{"bosh_deployment", "bosh_release_name", "bosh_release_version"},
)
}