Merge pull request #4077 from dlukman/fix/telemetry-prefix

Fix telemetry default prefix filter
This commit is contained in:
Jack Pearkes 2018-05-04 09:11:45 -07:00 committed by GitHub
commit 705b20d9bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -514,9 +514,9 @@ func (b *Builder) Build() (rt RuntimeConfig, err error) {
// Add a filter rule if needed for enabling the deprecated metric names // Add a filter rule if needed for enabling the deprecated metric names
enableDeprecatedNames := b.boolVal(c.Telemetry.EnableDeprecatedNames) enableDeprecatedNames := b.boolVal(c.Telemetry.EnableDeprecatedNames)
if enableDeprecatedNames { if enableDeprecatedNames {
telemetryAllowedPrefixes = append(telemetryAllowedPrefixes, "consul.consul") telemetryAllowedPrefixes = append(telemetryAllowedPrefixes, "consul.consul.")
} else { } else {
telemetryBlockedPrefixes = append(telemetryBlockedPrefixes, "consul.consul") telemetryBlockedPrefixes = append(telemetryBlockedPrefixes, "consul.consul.")
} }
// raft performance scaling // raft performance scaling

View file

@ -1811,7 +1811,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
patch: func(rt *RuntimeConfig) { patch: func(rt *RuntimeConfig) {
rt.DataDir = dataDir rt.DataDir = dataDir
rt.TelemetryAllowedPrefixes = []string{"foo"} rt.TelemetryAllowedPrefixes = []string{"foo"}
rt.TelemetryBlockedPrefixes = []string{"bar", "consul.consul"} rt.TelemetryBlockedPrefixes = []string{"bar", "consul.consul."}
}, },
warns: []string{`Filter rule must begin with either '+' or '-': "nix"`}, warns: []string{`Filter rule must begin with either '+' or '-': "nix"`},
}, },
@ -1829,7 +1829,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
patch: func(rt *RuntimeConfig) { patch: func(rt *RuntimeConfig) {
rt.DataDir = dataDir rt.DataDir = dataDir
rt.TelemetryFilterDefault = false rt.TelemetryFilterDefault = false
rt.TelemetryAllowedPrefixes = []string{"consul.consul"} rt.TelemetryAllowedPrefixes = []string{"consul.consul."}
rt.TelemetryBlockedPrefixes = []string{} rt.TelemetryBlockedPrefixes = []string{}
}, },
}, },
@ -3633,7 +3633,7 @@ func TestFullConfig(t *testing.T) {
TelemetryDogstatsdAddr: "0wSndumK", TelemetryDogstatsdAddr: "0wSndumK",
TelemetryDogstatsdTags: []string{"3N81zSUB", "Xtj8AnXZ"}, TelemetryDogstatsdTags: []string{"3N81zSUB", "Xtj8AnXZ"},
TelemetryFilterDefault: true, TelemetryFilterDefault: true,
TelemetryAllowedPrefixes: []string{"oJotS8XJ", "consul.consul"}, TelemetryAllowedPrefixes: []string{"oJotS8XJ", "consul.consul."},
TelemetryBlockedPrefixes: []string{"cazlEhGn"}, TelemetryBlockedPrefixes: []string{"cazlEhGn"},
TelemetryMetricsPrefix: "ftO6DySn", TelemetryMetricsPrefix: "ftO6DySn",
TelemetryPrometheusRetentionTime: 15 * time.Second, TelemetryPrometheusRetentionTime: 15 * time.Second,