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
enableDeprecatedNames := b.boolVal(c.Telemetry.EnableDeprecatedNames)
if enableDeprecatedNames {
telemetryAllowedPrefixes = append(telemetryAllowedPrefixes, "consul.consul")
telemetryAllowedPrefixes = append(telemetryAllowedPrefixes, "consul.consul.")
} else {
telemetryBlockedPrefixes = append(telemetryBlockedPrefixes, "consul.consul")
telemetryBlockedPrefixes = append(telemetryBlockedPrefixes, "consul.consul.")
}
// raft performance scaling

View File

@ -1811,7 +1811,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
patch: func(rt *RuntimeConfig) {
rt.DataDir = dataDir
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"`},
},
@ -1829,7 +1829,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
patch: func(rt *RuntimeConfig) {
rt.DataDir = dataDir
rt.TelemetryFilterDefault = false
rt.TelemetryAllowedPrefixes = []string{"consul.consul"}
rt.TelemetryAllowedPrefixes = []string{"consul.consul."}
rt.TelemetryBlockedPrefixes = []string{}
},
},
@ -3633,7 +3633,7 @@ func TestFullConfig(t *testing.T) {
TelemetryDogstatsdAddr: "0wSndumK",
TelemetryDogstatsdTags: []string{"3N81zSUB", "Xtj8AnXZ"},
TelemetryFilterDefault: true,
TelemetryAllowedPrefixes: []string{"oJotS8XJ", "consul.consul"},
TelemetryAllowedPrefixes: []string{"oJotS8XJ", "consul.consul."},
TelemetryBlockedPrefixes: []string{"cazlEhGn"},
TelemetryMetricsPrefix: "ftO6DySn",
TelemetryPrometheusRetentionTime: 15 * time.Second,