Skip to content

Commit e165ad9

Browse files
add new metric restic_build_info
1 parent 08f7016 commit e165ad9

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

monitor/prom/metrics.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Metrics struct {
2626
labels prometheus.Labels
2727
registry *prometheus.Registry
2828
info *prometheus.GaugeVec
29+
resticInfo *prometheus.GaugeVec
2930
backup BackupMetrics
3031
}
3132

@@ -47,14 +48,22 @@ func NewMetrics(profile, group, version string, resticversion string, configLabe
4748
Namespace: namespace,
4849
Name: "build_info",
4950
Help: "resticprofile build information.",
50-
}, append(keys, goVersionLabel, versionLabel, resticVersionLabel))
51+
}, append(keys, goVersionLabel, versionLabel))
5152
// send the information about the build right away
52-
p.info.With(mergeLabels(cloneLabels(labels), map[string]string{goVersionLabel: runtime.Version(), versionLabel: version, resticVersionLabel: resticversion})).Set(1)
53+
p.info.With(mergeLabels(cloneLabels(labels), map[string]string{goVersionLabel: runtime.Version(), versionLabel: version})).Set(1)
54+
55+
p.resticInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
56+
Name: "restic_build_info",
57+
Help: "restic build information.",
58+
}, append(keys, versionLabel))
59+
// send the information about the build right away
60+
p.resticInfo.With(mergeLabels(cloneLabels(labels), map[string]string{versionLabel: resticversion})).Set(1)
5361

5462
p.backup = newBackupMetrics(keys)
5563

5664
registry.MustRegister(
5765
p.info,
66+
p.resticInfo,
5867
p.backup.duration,
5968
p.backup.filesNew,
6069
p.backup.filesChanged,

0 commit comments

Comments
 (0)