From 9585aa7dcc40186f48632150ff89224961ce4d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= <61736220+Daniel-WWU-IT@users.noreply.github.com> Date: Wed, 1 Jul 2020 18:12:22 +0200 Subject: [PATCH] Added country information to Mentix (#924) --- pkg/mentix/connectors/gocdb.go | 2 ++ pkg/mentix/connectors/gocdb/types.go | 2 ++ pkg/mentix/exporters/promfilesd.go | 1 + pkg/mentix/meshdata/site.go | 3 +++ 4 files changed, 8 insertions(+) diff --git a/pkg/mentix/connectors/gocdb.go b/pkg/mentix/connectors/gocdb.go index 22c5989620..cd6206bc80 100755 --- a/pkg/mentix/connectors/gocdb.go +++ b/pkg/mentix/connectors/gocdb.go @@ -135,6 +135,8 @@ func (connector *GOCDBConnector) querySites(meshData *meshdata.MeshData) error { Homepage: site.Homepage, Email: site.Email, Description: site.Description, + Country: site.Country, + CountryCode: site.CountryCode, Services: nil, Properties: properties, } diff --git a/pkg/mentix/connectors/gocdb/types.go b/pkg/mentix/connectors/gocdb/types.go index cc09e6e107..9448b47f23 100755 --- a/pkg/mentix/connectors/gocdb/types.go +++ b/pkg/mentix/connectors/gocdb/types.go @@ -48,6 +48,8 @@ type Site struct { Homepage string `xml:"HOME_URL"` Email string `xml:"CONTACT_EMAIL"` Domain string `xml:"DOMAIN>DOMAIN_NAME"` + Country string `xml:"COUNTRY"` + CountryCode string `xml:"COUNTRY_CODE"` Extensions Extensions `xml:"EXTENSIONS"` } diff --git a/pkg/mentix/exporters/promfilesd.go b/pkg/mentix/exporters/promfilesd.go index 7c1fe91e40..ec49dd484f 100755 --- a/pkg/mentix/exporters/promfilesd.go +++ b/pkg/mentix/exporters/promfilesd.go @@ -112,6 +112,7 @@ func (exporter *PrometheusFileSDExporter) createScrapeConfigs() []*prometheus.Sc func (exporter *PrometheusFileSDExporter) createScrapeConfig(site *meshdata.Site, host string, endpoint *meshdata.ServiceEndpoint) *prometheus.ScrapeConfig { labels := map[string]string{ "site": site.Name, + "country": site.CountryCode, "service_type": endpoint.Type.Name, } diff --git a/pkg/mentix/meshdata/site.go b/pkg/mentix/meshdata/site.go index 6fba7eced0..8c90ace8e9 100644 --- a/pkg/mentix/meshdata/site.go +++ b/pkg/mentix/meshdata/site.go @@ -27,6 +27,9 @@ type Site struct { Homepage string Email string Description string + Country string + CountryCode string + Location string Services []*Service Properties map[string]string