diff --git a/agent/config/builder.go b/agent/config/builder.go index a98ab39585f3..4afbebb2ea98 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -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, diff --git a/agent/config/config.go b/agent/config/config.go index 916031e92827..eff332757b5e 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -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 { diff --git a/agent/config/default.go b/agent/config/default.go index 9bb8ea81df12..1c8e73abbc0e 100644 --- a/agent/config/default.go +++ b/agent/config/default.go @@ -76,7 +76,7 @@ func DefaultSource() Source { server = ` + strconv.Itoa(consul.DefaultRPCPort) + ` } telemetry = { - statsite_prefix = "consul" + service_prefix = "consul" filter_default = true } `, diff --git a/agent/config/doc.go b/agent/config/doc.go index bea218c92a61..0146ca79bec7 100644 --- a/agent/config/doc.go +++ b/agent/config/doc.go @@ -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. diff --git a/agent/config/runtime.go b/agent/config/runtime.go index 6248bc910f79..812bac8009a7 100644 --- a/agent/config/runtime.go +++ b/agent/config/runtime.go @@ -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 diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index 29c3fb1f1ed0..1f309f876af0 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -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", @@ -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" @@ -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, diff --git a/command/agent.go b/command/agent.go index a01de8f7e33a..f4074b20512b 100644 --- a/command/agent.go +++ b/command/agent.go @@ -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