feat: also export app-exporter version
All checks were successful
Build package / typos (push) Successful in 1m22s
All checks were successful
Build package / typos (push) Successful in 1m22s
This commit is contained in:
parent
f0f1213dbc
commit
6136e08bbd
2 changed files with 8 additions and 0 deletions
|
@ -55,6 +55,9 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecordMetrics(m apps.Metrics) {
|
func RecordMetrics(m apps.Metrics) {
|
||||||
|
// export the app-exporter version
|
||||||
|
m.Version.With(prometheus.Labels{"version": VERSION})
|
||||||
|
|
||||||
for {
|
for {
|
||||||
m.Reset()
|
m.Reset()
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ type Metrics struct {
|
||||||
Odoo prometheus.GaugeVec
|
Odoo prometheus.GaugeVec
|
||||||
Postgres prometheus.GaugeVec
|
Postgres prometheus.GaugeVec
|
||||||
Vaultwarden prometheus.GaugeVec
|
Vaultwarden prometheus.GaugeVec
|
||||||
|
Version prometheus.GaugeVec
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMetrics(reg prometheus.Registerer) *Metrics {
|
func NewMetrics(reg prometheus.Registerer) *Metrics {
|
||||||
|
@ -27,6 +28,7 @@ func NewMetrics(reg prometheus.Registerer) *Metrics {
|
||||||
Odoo: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "odoo", Help: ""}, []string{"version", "version_date"}),
|
Odoo: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "odoo", Help: ""}, []string{"version", "version_date"}),
|
||||||
Postgres: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "postgres", Help: ""}, []string{"version"}),
|
Postgres: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "postgres", Help: ""}, []string{"version"}),
|
||||||
Vaultwarden: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "vaultwarden", Help: ""}, []string{"version"}),
|
Vaultwarden: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "app", Subsystem: "version", Name: "vaultwarden", Help: ""}, []string{"version"}),
|
||||||
|
Version: *prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "appexporter", Name: "version", Help: "The version of this exporter"}, []string{"version"}),
|
||||||
}
|
}
|
||||||
|
|
||||||
reg.MustRegister(
|
reg.MustRegister(
|
||||||
|
@ -39,6 +41,7 @@ func NewMetrics(reg prometheus.Registerer) *Metrics {
|
||||||
metrics.Odoo,
|
metrics.Odoo,
|
||||||
metrics.Postgres,
|
metrics.Postgres,
|
||||||
metrics.Vaultwarden,
|
metrics.Vaultwarden,
|
||||||
|
metrics.Version,
|
||||||
)
|
)
|
||||||
|
|
||||||
return metrics
|
return metrics
|
||||||
|
@ -46,6 +49,8 @@ func NewMetrics(reg prometheus.Registerer) *Metrics {
|
||||||
|
|
||||||
// Reset all metrics
|
// Reset all metrics
|
||||||
//
|
//
|
||||||
|
// Reset all except app-exporter version
|
||||||
|
//
|
||||||
// This should be called on every loop iteration.
|
// This should be called on every loop iteration.
|
||||||
func (m *Metrics) Reset() {
|
func (m *Metrics) Reset() {
|
||||||
m.Cubebackup.Reset()
|
m.Cubebackup.Reset()
|
||||||
|
|
Loading…
Reference in a new issue