Skip to content

Commit

Permalink
metrics: replace statsite_prefix with service_prefix
Browse files Browse the repository at this point in the history
The metrics prefix isn't statsite specific and is in fact used
for all metrics providers. Since we are deprecating fields
anyway we should fix this one as well.

Fixes #3293
  • Loading branch information
magiconair committed Sep 26, 2017
1 parent 99246d3 commit 5d78967
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion agent/config/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,9 @@ func (b *Builder) Build() (rt RuntimeConfig, err error) {
TelemetryFilterDefault: b.boolVal(c.Telemetry.FilterDefault),
TelemetryAllowedPrefixes: telemetryAllowedPrefixes,
TelemetryBlockedPrefixes: telemetryBlockedPrefixes,
TelemetryServicePrefix: b.stringVal(c.Telemetry.ServicePrefix),
TelemetryStatsdAddr: b.stringVal(c.Telemetry.StatsdAddr),
TelemetryStatsiteAddr: b.stringVal(c.Telemetry.StatsiteAddr),
TelemetryStatsitePrefix: b.stringVal(c.Telemetry.StatsitePrefix),

// Agent
AdvertiseAddrLAN: advertiseAddrLAN,
Expand Down
2 changes: 1 addition & 1 deletion agent/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ type Telemetry struct {
DogstatsdTags []string `json:"dogstatsd_tags,omitempty" hcl:"dogstatsd_tags" mapstructure:"dogstatsd_tags"`
FilterDefault *bool `json:"filter_default,omitempty" hcl:"filter_default" mapstructure:"filter_default"`
PrefixFilter []string `json:"prefix_filter,omitempty" hcl:"prefix_filter" mapstructure:"prefix_filter"`
ServicePrefix *string `json:"service_prefix,omitempty" hcl:"service_prefix" mapstructure:"service_prefix"`
StatsdAddr *string `json:"statsd_address,omitempty" hcl:"statsd_address" mapstructure:"statsd_address"`
StatsiteAddr *string `json:"statsite_address,omitempty" hcl:"statsite_address" mapstructure:"statsite_address"`
StatsitePrefix *string `json:"statsite_prefix,omitempty" hcl:"statsite_prefix" mapstructure:"statsite_prefix"`
}

type Ports struct {
Expand Down
2 changes: 1 addition & 1 deletion agent/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func DefaultSource() Source {
server = ` + strconv.Itoa(consul.DefaultRPCPort) + `
}
telemetry = {
statsite_prefix = "consul"
service_prefix = "consul"
filter_default = true
}
`,
Expand Down
3 changes: 2 additions & 1 deletion agent/config/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
// * "recursor" is deprecated. Please use "recursors" instead.
// * "statsd_addr" is deprecated. Please use "telemetry.statsd_addr" instead.
// * "statsite_addr" is deprecated. Please use "telemetry.statsite_addr" instead.
// * "statsite_prefix" is deprecated. Please use "telemetry.statsite_prefix" instead.
// * "statsite_prefix" is deprecated. Please use "telemetry.service_prefix" instead.
// * "telemetry.statsite_prefix" is deprecated. Please use "telemetry.service_prefix" instead.
// * "retry_join_azure" is deprecated. Please use "retry_join" instead.
// * "retry_join_ec2" is deprecated. Please use "retry_join" instead.
// * "retry_join_gce" is deprecated. Please use "retry_join" instead.
Expand Down
2 changes: 1 addition & 1 deletion agent/config/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ type RuntimeConfig struct {
TelemetryFilterDefault bool
TelemetryAllowedPrefixes []string
TelemetryBlockedPrefixes []string
TelemetryServicePrefix string
TelemetryStatsdAddr string
TelemetryStatsiteAddr string
TelemetryStatsitePrefix string

AdvertiseAddrLAN *net.IPAddr
AdvertiseAddrWAN *net.IPAddr
Expand Down
8 changes: 4 additions & 4 deletions agent/config/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2254,9 +2254,9 @@ func TestFullConfig(t *testing.T) {
"dogstatsd_tags": [ "3N81zSUB","Xtj8AnXZ" ],
"filter_default": true,
"prefix_filter": [ "+oJotS8XJ","-cazlEhGn" ],
"service_prefix": "ftO6DySn",
"statsd_address": "drce87cy",
"statsite_address": "HpFwKB8R",
"statsite_prefix": "ftO6DySn"
"statsite_address": "HpFwKB8R"
},
"tls_cipher_suites": "TLS_RSA_WITH_RC4_128_SHA,TLS_RSA_WITH_3DES_EDE_CBC_SHA",
"tls_min_version": "pAOWafkR",
Expand Down Expand Up @@ -2674,9 +2674,9 @@ func TestFullConfig(t *testing.T) {
dogstatsd_tags = [ "3N81zSUB","Xtj8AnXZ" ]
filter_default = true
prefix_filter = [ "+oJotS8XJ","-cazlEhGn" ]
service_prefix = "ftO6DySn"
statsd_address = "drce87cy"
statsite_address = "HpFwKB8R"
statsite_prefix = "ftO6DySn"
}
tls_cipher_suites = "TLS_RSA_WITH_RC4_128_SHA,TLS_RSA_WITH_3DES_EDE_CBC_SHA"
tls_min_version = "pAOWafkR"
Expand Down Expand Up @@ -3213,9 +3213,9 @@ func TestFullConfig(t *testing.T) {
TelemetryFilterDefault: true,
TelemetryAllowedPrefixes: []string{"oJotS8XJ"},
TelemetryBlockedPrefixes: []string{"cazlEhGn"},
TelemetryServicePrefix: "ftO6DySn",
TelemetryStatsdAddr: "drce87cy",
TelemetryStatsiteAddr: "HpFwKB8R",
TelemetryStatsitePrefix: "ftO6DySn",
TLSCipherSuites: []uint16{tls.TLS_RSA_WITH_RC4_128_SHA, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA},
TLSMinVersion: "pAOWafkR",
TLSPreferServerCipherSuites: true,
Expand Down
2 changes: 1 addition & 1 deletion command/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func startupTelemetry(conf *config.RuntimeConfig) (*metrics.InmemSink, error) {
// metrics over stderr when there is a SIGUSR1 received.
memSink := metrics.NewInmemSink(10*time.Second, time.Minute)
metrics.DefaultInmemSignal(memSink)
metricsConf := metrics.DefaultConfig(conf.TelemetryStatsitePrefix)
metricsConf := metrics.DefaultConfig(conf.TelemetryServicePrefix)
metricsConf.EnableHostname = !conf.TelemetryDisableHostname
metricsConf.FilterDefault = conf.TelemetryFilterDefault

Expand Down

0 comments on commit 5d78967

Please sign in to comment.