From 9faa0a2a02c8de541f145dc4b2b267669e8e8334 Mon Sep 17 00:00:00 2001 From: Paul Coignet Date: Thu, 23 Jul 2020 11:04:10 +0200 Subject: [PATCH] Fix tests --- agent/config/runtime_test.go | 4 ++-- agent/http.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index b49ee9b67..eaf74b367 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -2263,7 +2263,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) { patch: func(rt *RuntimeConfig) { rt.DataDir = dataDir rt.Telemetry.AllowedPrefixes = []string{"foo"} - rt.Telemetry.BlockedPrefixes = []string{"bar"} + rt.Telemetry.BlockedPrefixes = []string{"consul.api.http", "bar"} }, warns: []string{`Filter rule must begin with either '+' or '-': "nix"`}, }, @@ -6361,7 +6361,7 @@ func TestFullConfig(t *testing.T) { DogstatsdTags: []string{"3N81zSUB", "Xtj8AnXZ"}, FilterDefault: true, AllowedPrefixes: []string{"oJotS8XJ"}, - BlockedPrefixes: []string{"cazlEhGn"}, + BlockedPrefixes: []string{"consul.api.http", "cazlEhGn"}, MetricsPrefix: "ftO6DySn", PrometheusRetentionTime: 15 * time.Second, StatsdAddr: "drce87cy", diff --git a/agent/http.go b/agent/http.go index 0778dd583..8133cbe95 100644 --- a/agent/http.go +++ b/agent/http.go @@ -259,6 +259,8 @@ func (s *HTTPServer) handler(enableDebug bool) http.Handler { start := time.Now() handler(resp, req) + // This new metric is disabled by default with the prefix_filter option. + // It will be enabled by default in a future version. labels := []metrics.Label{{Name: "method", Value: req.Method}, {Name: "path", Value: path_label}} metrics.MeasureSinceWithLabels([]string{"api", "http"}, start, labels)