Metrics: Add commit & version to grafana_environment_info (#79823)

This commit is contained in:
Todd Treece 2023-12-22 06:02:52 -05:00 committed by GitHub
parent b2b4d89501
commit feb7b38fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -677,6 +677,13 @@ func (cfg *Cfg) readGrafanaEnvironmentMetrics() error {
keys := environmentMetricsSection.Keys()
cfg.MetricsGrafanaEnvironmentInfo = make(map[string]string, len(keys))
cfg.MetricsGrafanaEnvironmentInfo["version"] = cfg.BuildVersion
cfg.MetricsGrafanaEnvironmentInfo["commit"] = cfg.BuildCommit
if cfg.EnterpriseBuildCommit != "NA" && cfg.EnterpriseBuildCommit != "" {
cfg.MetricsGrafanaEnvironmentInfo["enterprise_commit"] = cfg.EnterpriseBuildCommit
}
for _, key := range keys {
labelName := model.LabelName(key.Name())
labelValue := model.LabelValue(key.Value())