From 5e8aae9152ece3462c85bf22c7817bc1679a8aa3 Mon Sep 17 00:00:00 2001 From: Guillermo Sanchez Gavier Date: Wed, 2 Sep 2020 09:20:47 +0200 Subject: [PATCH] remove provider prefix --- internal/integration/spec.go | 3 +-- internal/integration/spec_test.go | 10 +++++----- internal/integration/test/prometheus_ibmmq.yaml | 1 - internal/integration/test/prometheus_ravendb.yml | 1 - internal/integration/test/prometheus_redis.yml | 1 - 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/internal/integration/spec.go b/internal/integration/spec.go index 076b7edd..4674418d 100644 --- a/internal/integration/spec.go +++ b/internal/integration/spec.go @@ -24,7 +24,6 @@ type Specs struct { // SpecDef contains the rules to group metrics into entities type SpecDef struct { - Provider string `yaml:"provider"` Service string `yaml:"service"` Entities []EntityDef `yaml:"entities"` } @@ -98,7 +97,7 @@ func (s *Specs) getEntity(m Metric) (entityName string, entityType string, err e return "", "", fmt.Errorf("metric: %s is not defined in service:%s", m.name, spec.Service) } - entityType = strings.Title(spec.Provider) + strings.Title(spec.Service) + strings.Title(e.Type) + entityType = strings.Title(spec.Service) + strings.Title(e.Type) entityName = e.Type diff --git a/internal/integration/spec_test.go b/internal/integration/spec_test.go index 6dd45da8..2c3e985a 100644 --- a/internal/integration/spec_test.go +++ b/internal/integration/spec_test.go @@ -52,7 +52,7 @@ func TestSpecs_getEntity(t *testing.T) { }, }}, wantEntityName: "database:test", - wantEntityType: "PrometheusRavendbDatabase", + wantEntityType: "RavendbDatabase", wantErr: false, }, { @@ -64,7 +64,7 @@ func TestSpecs_getEntity(t *testing.T) { attributes: labels.Set{}, }}, wantEntityName: "node", - wantEntityType: "PrometheusRavendbNode", + wantEntityType: "RavendbNode", wantErr: false, }, { @@ -79,7 +79,7 @@ func TestSpecs_getEntity(t *testing.T) { }, }}, wantEntityName: "testentity:first:second", - wantEntityType: "PrometheusRavendbTestentity", + wantEntityType: "RavendbTestentity", wantErr: false, }, { @@ -91,7 +91,7 @@ func TestSpecs_getEntity(t *testing.T) { attributes: labels.Set{}, }}, wantEntityName: "instance", - wantEntityType: "PrometheusRedisInstance", + wantEntityType: "RedisInstance", wantErr: false, }, { @@ -103,7 +103,7 @@ func TestSpecs_getEntity(t *testing.T) { attributes: labels.Set{}, }}, wantEntityName: "instance", - wantEntityType: "PrometheusRedisInstance", + wantEntityType: "RedisInstance", wantErr: false, }, { diff --git a/internal/integration/test/prometheus_ibmmq.yaml b/internal/integration/test/prometheus_ibmmq.yaml index 628cb2d1..7b5fa925 100644 --- a/internal/integration/test/prometheus_ibmmq.yaml +++ b/internal/integration/test/prometheus_ibmmq.yaml @@ -1,4 +1,3 @@ -provider: prometheus service: ibmmq display_name: IBM MQ entities: diff --git a/internal/integration/test/prometheus_ravendb.yml b/internal/integration/test/prometheus_ravendb.yml index 89de7e30..3344a99e 100644 --- a/internal/integration/test/prometheus_ravendb.yml +++ b/internal/integration/test/prometheus_ravendb.yml @@ -1,4 +1,3 @@ -provider: prometheus service: ravendb display_name: Raven Db entities: diff --git a/internal/integration/test/prometheus_redis.yml b/internal/integration/test/prometheus_redis.yml index c69bc062..419faf8d 100644 --- a/internal/integration/test/prometheus_redis.yml +++ b/internal/integration/test/prometheus_redis.yml @@ -1,4 +1,3 @@ -provider: prometheus service: redis display_name: Redis entities: