No version metrics when default metrics disabled

This commit is contained in:
SamB 2019-05-10 09:40:13 +02:00 committed by Will Rouesnel
parent 07dd31dea6
commit 0d4af2b71c
1 changed files with 4 additions and 2 deletions

View File

@ -1231,8 +1231,10 @@ func (e *Exporter) checkMapVersions(ch chan<- prometheus.Metric, server *Server)
versionDesc := prometheus.NewDesc(fmt.Sprintf("%s_%s", namespace, staticLabelName),
"Version string as reported by postgres", []string{"version", "short_version"}, server.labels)
if !e.disableDefaultMetrics {
ch <- prometheus.MustNewConstMetric(versionDesc,
prometheus.UntypedValue, 1, versionString, semanticVersion.String())
}
return nil
}