mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-05-04 17:08:02 +00:00
Merge ce2f9089bd
into 6526065fbc
This commit is contained in:
commit
24555d7728
@ -655,9 +655,15 @@ func (e *Exporter) checkMapVersions(ch chan<- prometheus.Metric, server *Server)
|
|||||||
versionDesc := prometheus.NewDesc(fmt.Sprintf("%s_%s", namespace, staticLabelName),
|
versionDesc := prometheus.NewDesc(fmt.Sprintf("%s_%s", namespace, staticLabelName),
|
||||||
"Version string as reported by postgres", []string{"version", "short_version"}, server.labels)
|
"Version string as reported by postgres", []string{"version", "short_version"}, server.labels)
|
||||||
|
|
||||||
|
var semanticVersionShort = semanticVersion.String()
|
||||||
|
if semanticVersion.GE(semver.MustParse("10.0.0")) {
|
||||||
|
var versionSplit = strings.Split(semanticVersion.String(), ".")
|
||||||
|
semanticVersionShort = versionSplit[0] + "." + versionSplit[1]
|
||||||
|
|
||||||
|
}
|
||||||
if !e.disableDefaultMetrics && server.master {
|
if !e.disableDefaultMetrics && server.master {
|
||||||
ch <- prometheus.MustNewConstMetric(versionDesc,
|
ch <- prometheus.MustNewConstMetric(versionDesc,
|
||||||
prometheus.UntypedValue, 1, versionString, semanticVersion.String())
|
prometheus.UntypedValue, 1, versionString, semanticVersionShort)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user