From 5521be526b5925adfb0a3a2a7d73c76e62b3959a Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 16 Nov 2020 15:22:24 +0000 Subject: [PATCH 01/36] ui: Replace NaN and undefined metrics values with `-` (#9200) * ui: Add functionality to metrics mocks: 1. More randomness during blocking queries 2. NaN and undefined values that come from prometheus 3. General trivial amends to bring things closer to the style of the project * Provider should always provide data as a string or undefined * Use a placeholder `-` if the metrics endpoint responds with undefined data --- .../v1/internal/ui/metrics-proxy/api/v1/query | 170 ++++++++++-------- .../ui/metrics-proxy/api/v1/query_range | 65 +++---- .../v1/internal/ui/service-topology/_ | 95 +++++----- .../vendor/metrics-providers/prometheus.js | 5 +- 4 files changed, 171 insertions(+), 164 deletions(-) diff --git a/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query b/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query index d70e09653a..83bbb78908 100644 --- a/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query +++ b/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query @@ -4,23 +4,50 @@ "resultType": "vector", "result": [ ${ - [1].map(function(_){ - var type = "service"; - var proto = "tcp"; + [1].map(item => { + const dc = 'dc1'; + const generateTargets = function(num) { + // Seed faker by the number of results we want to make it deterministic + // here and in other correlated endpoints. + fake.seed(num); + return range(num).map(i => { + const nspace = i === 0 ? `default` : `${fake.hacker.noun()}-ns-${i}`; + return { + Name: `service-${fake.random.number({min:0, max:99})}`, + Datacenter: `${dc}`, + Namespace: `${nspace}` + } + }) + }; - var q = location.search.query; + // little helper to get a deterministic number from the target service + // name string. NOTE: this should be the same as in metrics-proxy/.../query + // endpoint so metrics match what is requested. + const hashStr = function(s) { + for(var i = 0, h = 0xdeadbeef; i < s.length; i++) + h = Math.imul(h ^ s.charCodeAt(i), 2654435761); + return (h ^ h >>> 16) >>> 0; + }; + + const randExp = function(max, lambda) { + return (-Math.log(1-(1-Math.exp(-lambda))*Math.random())/lambda) * max; + }; + + const q = location.search.query; + let type = 'service'; + let proto = 'tcp'; // Match the relabel arguments since "downstream" appears in both // "service" and "upstream" type queries' metric names while // "upstream" appears in downstream query metric names (confusingly). if (q.match('"upstream"')) { - type = "upstream"; + type = 'upstream'; } else if (q.match('"downstream"')) { - type = "downstream"; + type = 'downstream'; } if (q.match('envoy_http_')) { - proto = "http"; + proto = 'http'; } // NOTE!!! The logic below to pick the upstream/downstream service @@ -30,151 +57,136 @@ // Pick a number of down/upstreams to return based on the cookie variable. // If you change anything about this variable or it's default, you'll need // to change the topology endpoint to match. - var numResults = 1; - if (type === "upstream") { - numResults = env("CONSUL_UPSTREAM_COUNT", 3); + let numResults = 1; + if (type === 'upstream') { + numResults = parseInt(env('CONSUL_UPSTREAM_COUNT', 3)); } - if (type === "downstream") { - numResults = env("CONSUL_DOWNSTREAM_COUNT", 5); + if (type === 'downstream') { + numResults = parseInt(env('CONSUL_DOWNSTREAM_COUNT', 5)); } - var genFakeServiceNames = function(num) { - // Seed faker by the number of results we want to make it deterministic - // here and in other correlated endpoints. - fake.seed(num); - var serviceNames = []; - for (var i = 0; i < num; i++) { - serviceNames.push(`service-${fake.random.number({min:0, max:99})}`) - } - return serviceNames - }; - // Figure out the actual name for the target service - var targetService = "invalid-local-cluster"; - var m = q.match(/local_cluster="([^"]*)"/); - if (m && m.length >= 2 && m[1] != "") { + let targetService = 'invalid-local-cluster'; + let m = q.match(/local_cluster="([^"]*)"/); + if (m && m.length >= 2 && m[1] !== '') { targetService = m[1]; } m = q.match(/consul_service="([^"]*)"/); - if (type == "downstream" && m && m.length >= 2 && m[1] != "") { + if (type === 'downstream' && m && m.length >= 2 && m[1] !== '') { // downstreams don't have the same selector for the main service // name. targetService = m[1]; } - var serviceNames = []; + let targets = []; switch(type) { - case "downstream": // fallthrough - case "upstream": - serviceNames = genFakeServiceNames(numResults); + case 'downstream': // fallthrough + case 'upstream': + targets = generateTargets(numResults); break; default: // fallthrough - case "service": - serviceNames = [targetService]; + case 'service': + targets = [targetService]; break; } - // little helper to get a deterministic number from the target service - // name string. NOTE: this should be the same as in service-topology - // endpoint so metrics match what is requested. - var hashStr = function(s) { - for(var i = 0, h = 0xdeadbeef; i < s.length; i++) - h = Math.imul(h ^ s.charCodeAt(i), 2654435761); - return (h ^ h >>> 16) >>> 0; - }; - - var serviceProto = "tcp" + let serviceProto = 'tcp'; // Randomly pick the serviceProtocol which will affect which types of // stats we return for downstream clusters. But we need it to be // deterministic for a given service name so that all the downstream // stats are consistently typed. fake.seed(hashStr(targetService)) if (fake.random.number(1) > 0.5) { - serviceProto = "http"; + serviceProto = 'http'; } // For up/downstreams only return HTTP metrics half of the time. // For upstreams it's based on the upstream's protocol which might be // mixed so alternate protocols for upstreams. - if (type == "upstream") { + if (type === "upstream") { // Pretend all odd service indexes are tcp and even are http - var wantMod = 0; - if (proto == "tcp") { - wantMod = 1; - } - serviceNames = serviceNames.filter(function(x, i){ return i%2 == wantMod }) + const wantMod = proto === 'tcp' ? 1 : 0; + targets = targets.filter((item, i) => i % 2 === wantMod); } // For downstreams it's based on the target's protocol which we // don't really know but all downstreams should be the same type // so only return metrics for that protocol. - if (type == "downstream" && proto == "http" && serviceProto != "http") { - serviceNames = []; + if (type === 'downstream' && proto === 'http' && serviceProto !== 'http') { + targets = []; } // Work out which metric is being queried to make them more realistic. - var range = 100; + let max = 100; switch(proto) { - case "http": + case 'http': if (q.match('envoy_response_code_class="5"')) { // It's error rate make it a percentage - range = 30; + max = 30; } else if (q.match("rq_completed")) { // Requests per second - range = 1000; + max = 1000; } else if (q.match("quantile\\(0.99")) { // 99 percentile time in ms make it longer than 50 percentile - range = 5000; + max = 5000; } else if (q.match("quantile\\(0.5")) { // 50th percentile - range = 500; + max = 500; } break; - case "tcp": + case 'tcp': if (q.match('cx_total')) { // New conns per second - range = 100; + max = 100; } else if (q.match('cx_rx_bytes')) { // inbound data rate tends to be lower than outbound - range = 0.5 * 1e9; + max = 0.5 * 1e9; } else if (q.match('cx_tx_bytes')) { // inbound data rate - range = 1e9; + max = 1e9; } - // no route/connect faile are OK with default 0-100 + // no route/connect failed are OK with default 0-100 break; } - var randExp = function(max, lambda) { - return (-Math.log(1-(1-Math.exp(-lambda))*Math.random())/lambda) * max; - } // Now generate the data points - return serviceNames.map(function(name, i){ - var metric = `{}`; + return targets.map((item, i) => { + let metric = `{}`; switch(type) { - default: - break; - case "upstream": + case 'upstream': // TODO: this should really return tcp proxy label for tcp // metrics but we don't look at that for now. - metric = `{"upstream": "${name}", "envoy_http_conn_manager_prefix": "${name}"}`; + metric = `{"upstream": "${item.Name}", "envoy_http_conn_manager_prefix": "${item.Name}"}`; break; - case "downstream": - metric = `{"downstream": "${name}", "local_cluster": "${name}"}`; + case 'downstream': + metric = `{"downstream": "${item.Name}", "local_cluster": "${item.Name}"}`; + break; + } + const timestamp = Date.now() / 1000; + let value = randExp(max, 20); + + // prometheus can sometimes generate NaN and undefined strings, so + // replicate that randomly + const num = fake.random.number({min: 0, max: 10}); + switch(true) { + case num > 8: + value = 'NaN'; + break; + case num > 5: + value = 'undefined'; break; } return `{ "metric": ${metric}, "value": [ - ${Date.now()/1000}, - "${randExp(range, 20)}" + ${timestamp}, + "${value}" ] }`; - }).join(",") - - })[0] + }) + }) } ] } diff --git a/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query_range b/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query_range index 6d7ed26083..357dbc866d 100644 --- a/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query_range +++ b/ui/packages/consul-ui/mock-api/v1/internal/ui/metrics-proxy/api/v1/query_range @@ -6,73 +6,74 @@ ${ // We need 15 minutes worth of data at 10 second resoution. Currently we // always query for two series together so loop twice over this. - [0, 1].map(function(i){ - var timePeriodMins = 15; - var resolutionSecs = 10; - var numPoints = (timePeriodMins*60)/resolutionSecs; - var time = (Date.now()/1000) - (timePeriodMins*60); + [0, 1].map((i) => { + const timePeriodMins = 15; + const resolutionSecs = 10; + const numPoints = (timePeriodMins * 60) / resolutionSecs; + let time = (Date.now() / 1000) - (timePeriodMins * 60); - var q = location.search.query; - var proto = "tcp"; - var range = 1000; - var riseBias = 10; - var fallBias = 10; - var volatility = 0.2; - var label = ""; + const q = location.search.query; + let proto = 'tcp'; + let max = 1000; + let riseBias = 10; + let fallBias = 10; + let volatility = 0.2; + let label = ''; if (q.match('envoy_listener_http_downstream_rq_xx')) { - proto = "http" + proto = 'http' // Switch random value ranges for total vs error rates switch(i) { case 0: - range = 1000; // up to 1000 rps for success - label = "Successes"; + max = 1000; // up to 1000 rps for success + label = 'Successes'; break; case 1: - range = 500; // up to 500 errors per second + max = 500; // up to 500 errors per second fallBias = 1; // fall quicker than we rise riseBias = 30; // start low generally volatility = 1; - label = "Errors"; + label = 'Errors'; break; } } else { // Type tcp switch(i) { case 0: - range = 0.5 * 1e9; // up to 500 mbps recieved - label = "Inbound"; + max = 0.5 * 1e9; // up to 500 mbps recieved + label = 'Inbound'; break; case 1: - range = 1e9; // up to 1 gbps - label = "Outbound" + max = 1e9; // up to 1 gbps + label = 'Outbound'; break; } } - var randExp = function(max, lambda) { + const randExp = function(max, lambda) { return (-Math.log(1-(1-Math.exp(-lambda))*Math.random())/lambda) * max; } // Starting value - var value = randExp(range, riseBias); - if (value > range) { - value = range; + let value = randExp(max, riseBias); + if (value > max) { + value = max; } - var points = []; + const points = []; + let rising; for (var i = 0; i < numPoints; i++) { points.push(`[${time}, "${value}"]`); time = time + resolutionSecs; - var rising = (Math.random() > 0.5); - delta = volatility * randExp(range, rising ? riseBias : fallBias); + rising = (Math.random() > 0.5); + delta = volatility * randExp(max, rising ? riseBias : fallBias); if (!rising) { // Make it a negative change - delta = 0-delta; + delta = 0 - delta; } value = value + delta - if (value > range) { - value = range; + if (value > max) { + value = max; } if (value < 0) { value = 0; @@ -87,4 +88,4 @@ } ] } -} \ No newline at end of file +} diff --git a/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ b/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ index 5ee71195d5..339adee51e 100644 --- a/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ +++ b/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ @@ -1,6 +1,29 @@ ${ [1].map(() => { const dc = location.search.dc; + const generateTargets = function(num) { + // Seed faker by the number of results we want to make it deterministic + // here and in other correlated endpoints. + fake.seed(num); + return range(num).map(i => { + const nspace = i === 0 ? `default` : `${fake.hacker.noun()}-ns-${i}`; + return { + Name: `service-${fake.random.number({min:0, max:99})}`, + Datacenter: `${dc}`, + Namespace: `${nspace}` + } + }) + }; + + // little helper to get a deterministic number from the target service + // name string. NOTE: this should be the same as in metrics-proxy/.../query + // endpoint so metrics match what is requested. + const hashStr = function(s) { + for(var i = 0, h = 0xdeadbeef; i < s.length; i++) + h = Math.imul(h ^ s.charCodeAt(i), 2654435761); + return (h ^ h >>> 16) >>> 0; + }; + // NOTE!!! The logic below to pick the upstream/downstream service // names must exactly match the logic in internal/ui/metrics-proxy/.../query @@ -9,64 +32,41 @@ ${ // Pick a number of down/upstreams to return based on the cookie variable. // If you change anything about this variable or it's default, you'll need // to change the topology endpoint to match. - var numUp = env("CONSUL_UPSTREAM_COUNT", 3); - var numDown = env("CONSUL_DOWNSTREAM_COUNT", 5); + const numUp = parseInt(env('CONSUL_UPSTREAM_COUNT', 3)); + const numDown = parseInt(env('CONSUL_DOWNSTREAM_COUNT', 5)); - var genFakeServiceNames = function(num) { - // Seed faker by the number of results we want to make it deterministic - // here and in other correlated endpoints. - fake.seed(num); - var serviceNames = []; - for (var i = 0; i < num; i++) { - serviceNames.push(`service-${fake.random.number({min:0, max:99})}`) - } - return serviceNames - }; + const index = parseInt(location.search.index || 0); + const targetService = location.pathname.get(4) - var upstreams = genFakeServiceNames(numUp); - var downstreams = genFakeServiceNames(numDown); + const upstreams = generateTargets(numUp); + const downstreams = generateTargets(numDown); - const targetService = location.pathname.toString().replace('/v1/internal/ui/service-topology/', '') - - // little helper to get a deterministic number from the target service - // name string. NOTE: this should be the same as in metrics-proxy/.../query - // endpoint so metrics match what is requested. - var hashStr = function(s) { - for(var i = 0, h = 0xdeadbeef; i < s.length; i++) - h = Math.imul(h ^ s.charCodeAt(i), 2654435761); - return (h ^ h >>> 16) >>> 0; - }; - - var serviceProto = "tcp" // Randomly pick the serviceProtocol which will affect which types of // stats we return for downstream clusters. But we need it to be // deterministic for a given service name so that all the downstream // stats are consistently typed. + let serviceProto = 'tcp'; fake.seed(hashStr(targetService)) if (fake.random.number(1) > 0.5) { - serviceProto = "http"; + serviceProto = 'http'; } + fake.seed(index); return ` { "Protocol": "${serviceProto}", "FilteredByACLs": ${fake.random.boolean()}, - "Upstreams": - [ + "Upstreams": [ ${ upstreams.map((item, i) => { - let hasPerms = fake.random.boolean(); + const hasPerms = fake.random.boolean(); // if hasPerms is true allowed is always false as some restrictions apply - let allowed = hasPerms ? false : fake.random.boolean(); + const allowed = hasPerms ? false : fake.random.boolean(); return ` { - "Name": "${item}", - "Datacenter": "${dc}", - ${i === 1 ? ` - "Namespace": "default", - ` : ` - "Namespace": "${fake.hacker.noun()}-ns-${i}", - `} + "Name": "${item.Name}", + "Datacenter": "${item.Datacenter}", + "Namespace": "${item.Namespace}", "ChecksPassing":${fake.random.number({min: 1, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksWarning":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksCritical":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, @@ -79,22 +79,17 @@ ${ } `})} ], - "Downstreams": - [ + "Downstreams": [ ${ downstreams.map((item, i) => { - let hasPerms = fake.random.boolean(); + const hasPerms = fake.random.boolean(); // if hasPerms is true allowed is always false as some restrictions apply - let allowed = hasPerms ? false : fake.random.boolean(); + const allowed = hasPerms ? false : fake.random.boolean(); return ` { - "Name": "${item}", - "Datacenter": "${dc}", - ${i === 1 ? ` - "Namespace": "default", - ` : ` - "Namespace": "${fake.hacker.noun()}-ns-${i}", - `} + "Name": "${item.Name}", + "Datacenter": "${item.Datacenter}", + "Namespace": "${item.Namespace}", "ChecksPassing":${fake.random.number({min: 1, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksWarning":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksCritical":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, @@ -110,4 +105,4 @@ ${ }` }) -} \ No newline at end of file +} diff --git a/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js b/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js index 586edbef48..0d25629bf2 100644 --- a/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js +++ b/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js @@ -659,7 +659,6 @@ // no result as a zero not a missing stat. promql += ' OR on() vector(0)'; } - //console.log(promql) var params = { query: promql, time: new Date().getTime() / 1000, @@ -671,7 +670,7 @@ return { label: label, desc: desc, - value: formatter(v), + value: isNaN(v) ? '-' : formatter(v), }; } @@ -683,7 +682,7 @@ data[groupName] = { label: label, desc: desc.replace('{{GROUP}}', groupName), - value: formatter(v), + value: isNaN(v) ? '-' : formatter(v), }; } return data; From 9b904de406967568ea3755128a07b9afbf762321 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 16 Nov 2020 14:20:07 -0500 Subject: [PATCH 02/36] Merge pull request #9114 from hashicorp/dnephin/filtering-in-stream stream: improve naming of Payload methods --- agent/consul/state/catalog_events.go | 11 +- agent/consul/state/catalog_events_test.go | 2 +- agent/consul/state/store_integration_test.go | 6 +- agent/consul/stream/event.go | 117 +++++++------ agent/consul/stream/event_publisher.go | 3 +- agent/consul/stream/event_publisher_test.go | 13 +- agent/consul/stream/event_test.go | 160 ++++++++++++++++++ agent/consul/stream/subscription.go | 18 +- agent/consul/stream/subscription_test.go | 166 +++---------------- agent/rpc/subscribe/auth.go | 22 --- agent/rpc/subscribe/logger.go | 14 +- agent/rpc/subscribe/subscribe.go | 10 +- agent/rpc/subscribe/subscribe_test.go | 13 +- 13 files changed, 308 insertions(+), 247 deletions(-) delete mode 100644 agent/rpc/subscribe/auth.go diff --git a/agent/consul/state/catalog_events.go b/agent/consul/state/catalog_events.go index 0a11a94360..526eca3549 100644 --- a/agent/consul/state/catalog_events.go +++ b/agent/consul/state/catalog_events.go @@ -3,6 +3,7 @@ package state import ( memdb "github.com/hashicorp/go-memdb" + "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/stream" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/proto/pbsubscribe" @@ -10,6 +11,10 @@ import ( // EventPayloadCheckServiceNode is used as the Payload for a stream.Event to // indicates changes to a CheckServiceNode for service health. +// +// The stream.Payload methods implemented by EventPayloadCheckServiceNode are +// do not mutate the payload, making it safe to use in an Event sent to +// stream.EventPublisher.Publish. type EventPayloadCheckServiceNode struct { Op pbsubscribe.CatalogOp Value *structs.CheckServiceNode @@ -19,7 +24,11 @@ type EventPayloadCheckServiceNode struct { key string } -func (e EventPayloadCheckServiceNode) FilterByKey(key, namespace string) bool { +func (e EventPayloadCheckServiceNode) HasReadPermission(authz acl.Authorizer) bool { + return e.Value.CanRead(authz) == acl.Allow +} + +func (e EventPayloadCheckServiceNode) MatchesKey(key, namespace string) bool { if key == "" && namespace == "" { return true } diff --git a/agent/consul/state/catalog_events_test.go b/agent/consul/state/catalog_events_test.go index 7019c9254f..f9a2e1af21 100644 --- a/agent/consul/state/catalog_events_test.go +++ b/agent/consul/state/catalog_events_test.go @@ -1476,7 +1476,7 @@ func TestEventPayloadCheckServiceNode_FilterByKey(t *testing.T) { t.Skip("cant test namespace matching without namespace support") } - require.Equal(t, tc.expected, tc.payload.FilterByKey(tc.key, tc.namespace)) + require.Equal(t, tc.expected, tc.payload.MatchesKey(tc.key, tc.namespace)) } var testCases = []testCase{ diff --git a/agent/consul/state/store_integration_test.go b/agent/consul/state/store_integration_test.go index d75512195e..fc4d05591e 100644 --- a/agent/consul/state/store_integration_test.go +++ b/agent/consul/state/store_integration_test.go @@ -410,10 +410,14 @@ type nodePayload struct { node *structs.ServiceNode } -func (p nodePayload) FilterByKey(key, _ string) bool { +func (p nodePayload) MatchesKey(key, _ string) bool { return p.key == key } +func (p nodePayload) HasReadPermission(acl.Authorizer) bool { + return true +} + func createTokenAndWaitForACLEventPublish(t *testing.T, s *Store) *structs.ACLToken { token := &structs.ACLToken{ AccessorID: "3af117a9-2233-4cf4-8ff8-3c749c9906b4", diff --git a/agent/consul/stream/event.go b/agent/consul/stream/event.go index 09d96ee6db..74df46b5e1 100644 --- a/agent/consul/stream/event.go +++ b/agent/consul/stream/event.go @@ -4,7 +4,11 @@ to the state store. */ package stream -import "fmt" +import ( + "fmt" + + "github.com/hashicorp/consul/acl" +) // Topic is an identifier that partitions events. A subscription will only receive // events which match the Topic. @@ -18,72 +22,81 @@ type Event struct { Payload Payload } +// A Payload contains the topic-specific data in an event. The payload methods +// should not modify the state of the payload if the Event is being submitted to +// EventPublisher.Publish. type Payload interface { - // FilterByKey must return true if the Payload should be included in a subscription + // MatchesKey must return true if the Payload should be included in a subscription // requested with the key and namespace. // Generally this means that the payload matches the key and namespace or // the payload is a special framing event that should be returned to every // subscription. - FilterByKey(key, namespace string) bool + MatchesKey(key, namespace string) bool + + // HasReadPermission uses the acl.Authorizer to determine if the items in the + // Payload are visible to the request. It returns true if the payload is + // authorized for Read, otherwise returns false. + HasReadPermission(authz acl.Authorizer) bool } -// Len returns the number of events contained within this event. If the Payload -// is a []Event, the length of that slice is returned. Otherwise 1 is returned. -func (e Event) Len() int { - if batch, ok := e.Payload.(PayloadEvents); ok { - return len(batch) - } - return 1 +// PayloadEvents is a Payload that may be returned by Subscription.Next when +// there are multiple events at an index. +// +// Note that unlike most other Payload, PayloadEvents is mutable and it is NOT +// safe to send to EventPublisher.Publish. +type PayloadEvents struct { + Items []Event } -// Filter returns an Event filtered to only those Events where f returns true. -// If the second return value is false, every Event was removed by the filter. -func (e Event) Filter(f func(Event) bool) (Event, bool) { - batch, ok := e.Payload.(PayloadEvents) - if !ok { - return e, f(e) - } +func newPayloadEvents(items ...Event) *PayloadEvents { + return &PayloadEvents{Items: items} +} + +func (p *PayloadEvents) filter(f func(Event) bool) bool { + items := p.Items // To avoid extra allocations, iterate over the list of events first and // get a count of the total desired size. This trades off some extra cpu // time in the worse case (when not all items match the filter), for // fewer memory allocations. var size int - for idx := range batch { - if f(batch[idx]) { + for idx := range items { + if f(items[idx]) { size++ } } - if len(batch) == size || size == 0 { - return e, size != 0 + if len(items) == size || size == 0 { + return size != 0 } - filtered := make(PayloadEvents, 0, size) - for idx := range batch { - event := batch[idx] + filtered := make([]Event, 0, size) + for idx := range items { + event := items[idx] if f(event) { filtered = append(filtered, event) } } - if len(filtered) == 0 { - return e, false - } - e.Payload = filtered - return e, true -} - -// PayloadEvents is an Payload which contains multiple Events. -type PayloadEvents []Event - -// TODO: this method is not called, but needs to exist so that we can store -// a slice of events as a payload. In the future we should be able to refactor -// Event.Filter so that this FilterByKey includes the re-slicing. -func (e PayloadEvents) FilterByKey(_, _ string) bool { + p.Items = filtered return true } -func (e PayloadEvents) Events() []Event { - return e +// MatchesKey filters the PayloadEvents to those which match the key and namespace. +func (p *PayloadEvents) MatchesKey(key, namespace string) bool { + return p.filter(func(event Event) bool { + return event.Payload.MatchesKey(key, namespace) + }) +} + +func (p *PayloadEvents) Len() int { + return len(p.Items) +} + +// HasReadPermission filters the PayloadEvents to those which are authorized +// for reading by authz. +func (p *PayloadEvents) HasReadPermission(authz acl.Authorizer) bool { + return p.filter(func(event Event) bool { + return event.Payload.HasReadPermission(authz) + }) } // IsEndOfSnapshot returns true if this is a framing event that indicates the @@ -100,24 +113,34 @@ func (e Event) IsNewSnapshotToFollow() bool { return e.Payload == newSnapshotToFollow{} } -type endOfSnapshot struct{} +type framingEvent struct{} -func (endOfSnapshot) FilterByKey(string, string) bool { +func (framingEvent) MatchesKey(string, string) bool { return true } -type newSnapshotToFollow struct{} - -func (newSnapshotToFollow) FilterByKey(string, string) bool { +func (framingEvent) HasReadPermission(acl.Authorizer) bool { return true } +type endOfSnapshot struct { + framingEvent +} + +type newSnapshotToFollow struct { + framingEvent +} + type closeSubscriptionPayload struct { tokensSecretIDs []string } -func (closeSubscriptionPayload) FilterByKey(string, string) bool { - return true +func (closeSubscriptionPayload) MatchesKey(string, string) bool { + return false +} + +func (closeSubscriptionPayload) HasReadPermission(acl.Authorizer) bool { + return false } // NewCloseSubscriptionEvent returns a special Event that is handled by the diff --git a/agent/consul/stream/event_publisher.go b/agent/consul/stream/event_publisher.go index 379bfdfa8d..769e875d83 100644 --- a/agent/consul/stream/event_publisher.go +++ b/agent/consul/stream/event_publisher.go @@ -91,7 +91,8 @@ func NewEventPublisher(handlers SnapshotHandlers, snapCacheTTL time.Duration) *E return e } -// Publish events to all subscribers of the event Topic. +// Publish events to all subscribers of the event Topic. The events will be shared +// with all subscriptions, so the Payload used in Event.Payload must be immutable. func (e *EventPublisher) Publish(events []Event) { if len(events) > 0 { e.publishCh <- events diff --git a/agent/consul/stream/event_publisher_test.go b/agent/consul/stream/event_publisher_test.go index f2a9e43a36..576d4ccc35 100644 --- a/agent/consul/stream/event_publisher_test.go +++ b/agent/consul/stream/event_publisher_test.go @@ -7,6 +7,8 @@ import ( "time" "github.com/stretchr/testify/require" + + "github.com/hashicorp/consul/acl" ) type intTopic int @@ -63,17 +65,22 @@ var testSnapshotEvent = Event{ } type simplePayload struct { - key string - value string + key string + value string + noReadPerm bool } -func (p simplePayload) FilterByKey(key, _ string) bool { +func (p simplePayload) MatchesKey(key, _ string) bool { if key == "" { return true } return p.key == key } +func (p simplePayload) HasReadPermission(acl.Authorizer) bool { + return !p.noReadPerm +} + func newTestSnapshotHandlers() SnapshotHandlers { return SnapshotHandlers{ testTopic: func(req SubscribeRequest, buf SnapshotAppender) (uint64, error) { diff --git a/agent/consul/stream/event_test.go b/agent/consul/stream/event_test.go index 182f0d5122..8b36ee8d15 100644 --- a/agent/consul/stream/event_test.go +++ b/agent/consul/stream/event_test.go @@ -15,3 +15,163 @@ func TestEvent_IsEndOfSnapshot(t *testing.T) { require.False(t, e.IsEndOfSnapshot()) }) } + +func newSimpleEvent(key string, index uint64) Event { + return Event{Index: index, Payload: simplePayload{key: key}} +} + +func TestPayloadEvents_FilterByKey(t *testing.T) { + type testCase struct { + name string + req SubscribeRequest + events []Event + expectEvent bool + expected *PayloadEvents + expectedCap int + } + + fn := func(t *testing.T, tc testCase) { + events := make([]Event, 0, 5) + events = append(events, tc.events...) + + pe := &PayloadEvents{Items: events} + ok := pe.MatchesKey(tc.req.Key, tc.req.Namespace) + require.Equal(t, tc.expectEvent, ok) + if !tc.expectEvent { + return + } + + require.Equal(t, tc.expected, pe) + // test if there was a new array allocated or not + require.Equal(t, tc.expectedCap, cap(pe.Items)) + } + + var testCases = []testCase{ + { + name: "all events match, no key or namespace", + req: SubscribeRequest{Topic: testTopic}, + events: []Event{ + newSimpleEvent("One", 102), + newSimpleEvent("Two", 102)}, + expectEvent: true, + expected: newPayloadEvents( + newSimpleEvent("One", 102), + newSimpleEvent("Two", 102)), + expectedCap: 5, + }, + { + name: "all events match, no namespace", + req: SubscribeRequest{Topic: testTopic, Key: "Same"}, + events: []Event{ + newSimpleEvent("Same", 103), + newSimpleEvent("Same", 103)}, + expectEvent: true, + expected: newPayloadEvents( + newSimpleEvent("Same", 103), + newSimpleEvent("Same", 103)), + expectedCap: 5, + }, + { + name: "all events match, no key", + req: SubscribeRequest{Topic: testTopic, Namespace: "apps"}, + events: []Event{ + newNSEvent("Something", "apps"), + newNSEvent("Other", "apps")}, + expectEvent: true, + expected: newPayloadEvents( + newNSEvent("Something", "apps"), + newNSEvent("Other", "apps")), + expectedCap: 5, + }, + { + name: "some evens match, no namespace", + req: SubscribeRequest{Topic: testTopic, Key: "Same"}, + events: []Event{ + newSimpleEvent("Same", 104), + newSimpleEvent("Other", 104), + newSimpleEvent("Same", 104)}, + expectEvent: true, + expected: newPayloadEvents( + newSimpleEvent("Same", 104), + newSimpleEvent("Same", 104)), + expectedCap: 2, + }, + { + name: "some events match, no key", + req: SubscribeRequest{Topic: testTopic, Namespace: "apps"}, + events: []Event{ + newNSEvent("app1", "apps"), + newNSEvent("db1", "dbs"), + newNSEvent("app2", "apps")}, + expectEvent: true, + expected: newPayloadEvents( + newNSEvent("app1", "apps"), + newNSEvent("app2", "apps")), + expectedCap: 2, + }, + { + name: "no events match key", + req: SubscribeRequest{Topic: testTopic, Key: "Other"}, + events: []Event{ + newSimpleEvent("Same", 0), + newSimpleEvent("Same", 0)}, + }, + { + name: "no events match namespace", + req: SubscribeRequest{Topic: testTopic, Namespace: "apps"}, + events: []Event{ + newNSEvent("app1", "group1"), + newNSEvent("app2", "group2")}, + expectEvent: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + fn(t, tc) + }) + } +} + +func newNSEvent(key, namespace string) Event { + return Event{Index: 22, Payload: nsPayload{key: key, namespace: namespace}} +} + +type nsPayload struct { + framingEvent + key string + namespace string + value string +} + +func (p nsPayload) MatchesKey(key, namespace string) bool { + return (key == "" || key == p.key) && (namespace == "" || namespace == p.namespace) +} + +func TestPayloadEvents_HasReadPermission(t *testing.T) { + t.Run("some events filtered", func(t *testing.T) { + ep := newPayloadEvents( + Event{Payload: simplePayload{key: "one", noReadPerm: true}}, + Event{Payload: simplePayload{key: "two", noReadPerm: false}}, + Event{Payload: simplePayload{key: "three", noReadPerm: true}}, + Event{Payload: simplePayload{key: "four", noReadPerm: false}}) + + require.True(t, ep.HasReadPermission(nil)) + expected := []Event{ + {Payload: simplePayload{key: "two"}}, + {Payload: simplePayload{key: "four"}}, + } + require.Equal(t, expected, ep.Items) + }) + + t.Run("all events filtered", func(t *testing.T) { + ep := newPayloadEvents( + Event{Payload: simplePayload{key: "one", noReadPerm: true}}, + Event{Payload: simplePayload{key: "two", noReadPerm: true}}, + Event{Payload: simplePayload{key: "three", noReadPerm: true}}, + Event{Payload: simplePayload{key: "four", noReadPerm: true}}) + + require.False(t, ep.HasReadPermission(nil)) + }) + +} diff --git a/agent/consul/stream/subscription.go b/agent/consul/stream/subscription.go index 472b0ce90d..03069ea931 100644 --- a/agent/consul/stream/subscription.go +++ b/agent/consul/stream/subscription.go @@ -101,8 +101,8 @@ func (s *Subscription) Next(ctx context.Context) (Event, error) { if len(next.Events) == 0 { continue } - event, ok := filterByKey(s.req, next.Events) - if !ok { + event := newEventFromBatch(s.req, next.Events) + if !event.Payload.MatchesKey(s.req.Key, s.req.Namespace) { continue } return event, nil @@ -128,22 +128,10 @@ func newEventFromBatch(req SubscribeRequest, events []Event) Event { return Event{ Topic: req.Topic, Index: first.Index, - Payload: PayloadEvents(events), + Payload: newPayloadEvents(events...), } } -func filterByKey(req SubscribeRequest, events []Event) (Event, bool) { - event := newEventFromBatch(req, events) - if req.Key == "" && req.Namespace == "" { - return event, true - } - - fn := func(e Event) bool { - return e.Payload.FilterByKey(req.Key, req.Namespace) - } - return event.Filter(fn) -} - // Close the subscription. Subscribers will receive an error when they call Next, // and will need to perform a new Subscribe request. // It is safe to call from any goroutine. diff --git a/agent/consul/stream/subscription_test.go b/agent/consul/stream/subscription_test.go index 2c192b1840..02368f61d7 100644 --- a/agent/consul/stream/subscription_test.go +++ b/agent/consul/stream/subscription_test.go @@ -138,147 +138,29 @@ func publishTestEvent(index uint64, b *eventBuffer, key string) { b.Append([]Event{e}) } -func newSimpleEvent(key string, index uint64) Event { - return Event{Index: index, Payload: simplePayload{key: key}} -} - -func TestFilterByKey(t *testing.T) { - type testCase struct { - name string - req SubscribeRequest - events []Event - expectEvent bool - expected Event - expectedCap int - } - - fn := func(t *testing.T, tc testCase) { - events := make(PayloadEvents, 0, 5) - events = append(events, tc.events...) - - actual, ok := filterByKey(tc.req, events) - require.Equal(t, tc.expectEvent, ok) - if !tc.expectEvent { - return +func TestNewEventsFromBatch(t *testing.T) { + t.Run("single item", func(t *testing.T) { + first := Event{ + Topic: testTopic, + Index: 1234, + Payload: simplePayload{key: "key"}, } - - require.Equal(t, tc.expected, actual) - // test if there was a new array allocated or not - require.Equal(t, tc.expectedCap, cap(actual.Payload.(PayloadEvents))) - } - - var testCases = []testCase{ - { - name: "all events match, no key or namespace", - req: SubscribeRequest{Topic: testTopic}, - events: []Event{ - newSimpleEvent("One", 102), - newSimpleEvent("Two", 102)}, - expectEvent: true, - expected: Event{ - Topic: testTopic, - Index: 102, - Payload: PayloadEvents{ - newSimpleEvent("One", 102), - newSimpleEvent("Two", 102)}}, - expectedCap: 5, - }, - { - name: "all events match, no namespace", - req: SubscribeRequest{Topic: testTopic, Key: "Same"}, - events: []Event{ - newSimpleEvent("Same", 103), - newSimpleEvent("Same", 103)}, - expectEvent: true, - expected: Event{ - Topic: testTopic, - Index: 103, - Payload: PayloadEvents{ - newSimpleEvent("Same", 103), - newSimpleEvent("Same", 103)}}, - expectedCap: 5, - }, - { - name: "all events match, no key", - req: SubscribeRequest{Topic: testTopic, Namespace: "apps"}, - events: []Event{ - newNSEvent("Something", "apps"), - newNSEvent("Other", "apps")}, - expectEvent: true, - expected: Event{ - Topic: testTopic, - Index: 22, - Payload: PayloadEvents{ - newNSEvent("Something", "apps"), - newNSEvent("Other", "apps")}}, - expectedCap: 5, - }, - { - name: "some evens match, no namespace", - req: SubscribeRequest{Topic: testTopic, Key: "Same"}, - events: []Event{ - newSimpleEvent("Same", 104), - newSimpleEvent("Other", 104), - newSimpleEvent("Same", 104)}, - expectEvent: true, - expected: Event{ - Topic: testTopic, - Index: 104, - Payload: PayloadEvents{ - newSimpleEvent("Same", 104), - newSimpleEvent("Same", 104)}}, - expectedCap: 2, - }, - { - name: "some events match, no key", - req: SubscribeRequest{Topic: testTopic, Namespace: "apps"}, - events: []Event{ - newNSEvent("app1", "apps"), - newNSEvent("db1", "dbs"), - newNSEvent("app2", "apps")}, - expectEvent: true, - expected: Event{ - Topic: testTopic, - Index: 22, - Payload: PayloadEvents{ - newNSEvent("app1", "apps"), - newNSEvent("app2", "apps")}}, - expectedCap: 2, - }, - { - name: "no events match key", - req: SubscribeRequest{Topic: testTopic, Key: "Other"}, - events: []Event{ - newSimpleEvent("Same", 0), - newSimpleEvent("Same", 0)}, - }, - { - name: "no events match namespace", - req: SubscribeRequest{Topic: testTopic, Namespace: "apps"}, - events: []Event{ - newNSEvent("app1", "group1"), - newNSEvent("app2", "group2")}, - expectEvent: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - fn(t, tc) - }) - } -} - -func newNSEvent(key, namespace string) Event { - return Event{Index: 22, Payload: nsPayload{key: key, namespace: namespace}} -} - -type nsPayload struct { - key string - namespace string - value string -} - -func (p nsPayload) FilterByKey(key, namespace string) bool { - return (key == "" || key == p.key) && (namespace == "" || namespace == p.namespace) + e := newEventFromBatch(SubscribeRequest{}, []Event{first}) + require.Equal(t, first, e) + }) + t.Run("many items", func(t *testing.T) { + events := []Event{ + newSimpleEvent("foo", 9999), + newSimpleEvent("foo", 9999), + newSimpleEvent("zee", 9999), + } + req := SubscribeRequest{Topic: testTopic} + e := newEventFromBatch(req, events) + expected := Event{ + Topic: testTopic, + Index: 9999, + Payload: newPayloadEvents(events...), + } + require.Equal(t, expected, e) + }) } diff --git a/agent/rpc/subscribe/auth.go b/agent/rpc/subscribe/auth.go deleted file mode 100644 index b41b1fdc40..0000000000 --- a/agent/rpc/subscribe/auth.go +++ /dev/null @@ -1,22 +0,0 @@ -package subscribe - -import ( - "github.com/hashicorp/consul/acl" - "github.com/hashicorp/consul/agent/consul/state" - "github.com/hashicorp/consul/agent/consul/stream" -) - -// EnforceACL takes an acl.Authorizer and returns the decision for whether the -// event is allowed to be sent to this client or not. -func enforceACL(authz acl.Authorizer, e stream.Event) acl.EnforcementDecision { - switch { - case e.IsEndOfSnapshot(), e.IsNewSnapshotToFollow(): - return acl.Allow - } - - switch p := e.Payload.(type) { - case state.EventPayloadCheckServiceNode: - return p.Value.CanRead(authz) - } - return acl.Deny -} diff --git a/agent/rpc/subscribe/logger.go b/agent/rpc/subscribe/logger.go index ddddb20ca5..99394f5465 100644 --- a/agent/rpc/subscribe/logger.go +++ b/agent/rpc/subscribe/logger.go @@ -58,12 +58,20 @@ func (l *eventLogger) Trace(e stream.Event) { case e.IsEndOfSnapshot(): l.snapshotDone = true l.logger.Trace("snapshot complete", "index", e.Index, "sent", l.count) + return case e.IsNewSnapshotToFollow(): l.logger.Trace("starting new snapshot", "sent", l.count) return - case l.snapshotDone: - l.logger.Trace("sending events", "index", e.Index, "sent", l.count, "batch_size", e.Len()) } - l.count += uint64(e.Len()) + size := 1 + if l, ok := e.Payload.(length); ok { + size = l.Len() + } + l.logger.Trace("sending events", "index", e.Index, "sent", l.count, "batch_size", size) + l.count += uint64(size) +} + +type length interface { + Len() int } diff --git a/agent/rpc/subscribe/subscribe.go b/agent/rpc/subscribe/subscribe.go index 71919babab..0e98893f92 100644 --- a/agent/rpc/subscribe/subscribe.go +++ b/agent/rpc/subscribe/subscribe.go @@ -132,10 +132,8 @@ func filterByAuth(authz acl.Authorizer, event stream.Event) (stream.Event, bool) if authz == nil { return event, true } - fn := func(e stream.Event) bool { - return enforceACL(authz, e) == acl.Allow - } - return event.Filter(fn) + + return event, event.Payload.HasReadPermission(authz) } func newEventFromStreamEvent(event stream.Event) *pbsubscribe.Event { @@ -154,10 +152,10 @@ func newEventFromStreamEvent(event stream.Event) *pbsubscribe.Event { func setPayload(e *pbsubscribe.Event, payload stream.Payload) { switch p := payload.(type) { - case stream.PayloadEvents: + case *stream.PayloadEvents: e.Payload = &pbsubscribe.Event_EventBatch{ EventBatch: &pbsubscribe.EventBatch{ - Events: batchEventsFromEventSlice(p), + Events: batchEventsFromEventSlice(p.Items), }, } case state.EventPayloadCheckServiceNode: diff --git a/agent/rpc/subscribe/subscribe_test.go b/agent/rpc/subscribe/subscribe_test.go index bc41ed1e88..cf37e75bbc 100644 --- a/agent/rpc/subscribe/subscribe_test.go +++ b/agent/rpc/subscribe/subscribe_test.go @@ -917,8 +917,8 @@ func TestNewEventFromSteamEvent(t *testing.T) { name: "event batch", event: stream.Event{ Index: 2002, - Payload: stream.PayloadEvents{ - { + Payload: newPayloadEvents( + stream.Event{ Index: 2002, Payload: state.EventPayloadCheckServiceNode{ Op: pbsubscribe.CatalogOp_Register, @@ -928,7 +928,7 @@ func TestNewEventFromSteamEvent(t *testing.T) { }, }, }, - { + stream.Event{ Index: 2002, Payload: state.EventPayloadCheckServiceNode{ Op: pbsubscribe.CatalogOp_Deregister, @@ -937,8 +937,7 @@ func TestNewEventFromSteamEvent(t *testing.T) { Service: &structs.NodeService{Service: "web1"}, }, }, - }, - }, + }), }, expected: pbsubscribe.Event{ Index: 2002, @@ -1008,6 +1007,10 @@ func TestNewEventFromSteamEvent(t *testing.T) { } } +func newPayloadEvents(items ...stream.Event) *stream.PayloadEvents { + return &stream.PayloadEvents{Items: items} +} + // newEventFromSubscription is used to return framing events. EndOfSnapshot and // NewSnapshotToFollow are not exported, but we can get them from a subscription. func newEventFromSubscription(t *testing.T, index uint64) stream.Event { From c88ada194f36908f1459cf553ee48195acd08766 Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Mon, 16 Nov 2020 15:45:55 -0500 Subject: [PATCH 03/36] Add changelog entry for namespace licensing fix (#9203) --- .changelog/_683.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/_683.txt diff --git a/.changelog/_683.txt b/.changelog/_683.txt new file mode 100644 index 0000000000..02e9ade1ed --- /dev/null +++ b/.changelog/_683.txt @@ -0,0 +1,3 @@ +```release-note:bug +license: **(Enterprise only)** Fixed an issue where warnings about Namespaces being unlicensed would be emitted erroneously. +``` From e421da3b594ae3a54327e2b256cb8d3cef176c6a Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Mon, 16 Nov 2020 17:08:17 -0500 Subject: [PATCH 04/36] Prevent panic if autopilot health is requested prior to leader establishment finishing. (#9204) --- .changelog/9204.txt | 3 +++ agent/consul/operator_autopilot_endpoint.go | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .changelog/9204.txt diff --git a/.changelog/9204.txt b/.changelog/9204.txt new file mode 100644 index 0000000000..42789c3581 --- /dev/null +++ b/.changelog/9204.txt @@ -0,0 +1,3 @@ +```release-note:bug +autopilot: Prevent panic when requesting the autopilot health immediately after a leader is elected. +``` diff --git a/agent/consul/operator_autopilot_endpoint.go b/agent/consul/operator_autopilot_endpoint.go index a153231612..2b122e522f 100644 --- a/agent/consul/operator_autopilot_endpoint.go +++ b/agent/consul/operator_autopilot_endpoint.go @@ -100,6 +100,12 @@ func (op *Operator) ServerHealth(args *structs.DCSpecificRequest, reply *structs state := op.srv.autopilot.GetState() + if state == nil { + // this behavior seems odd but its functionally equivalent to 1.8.5 where if + // autopilot didn't have a health reply yet it would just return no error + return nil + } + health := structs.AutopilotHealthReply{ Healthy: state.Healthy, FailureTolerance: state.FailureTolerance, From 4d39305442e8a96ba81daab86d9d623800818a6b Mon Sep 17 00:00:00 2001 From: Freddy Date: Mon, 16 Nov 2020 16:37:19 -0700 Subject: [PATCH 05/36] Add DC and NS support for Envoy metrics (#9207) This PR updates the tags that we generate for Envoy stats. Several of these come with breaking changes, since we can't keep two stats prefixes for a filter. --- .changelog/9207.txt | 3 + agent/xds/listeners.go | 87 +++-- agent/xds/listeners_test.go | 6 +- ...th-chain-and-overrides.envoy-1-13-x.golden | 6 +- ...th-chain-and-overrides.envoy-1-14-x.golden | 6 +- ...th-chain-and-overrides.envoy-1-15-x.golden | 6 +- ...th-chain-and-overrides.envoy-1-16-x.golden | 6 +- ...ith-chain-external-sni.envoy-1-13-x.golden | 6 +- ...ith-chain-external-sni.envoy-1-14-x.golden | 6 +- ...ith-chain-external-sni.envoy-1-15-x.golden | 6 +- ...ith-chain-external-sni.envoy-1-16-x.golden | 6 +- ...-proxy-with-grpc-chain.envoy-1-13-x.golden | 6 +- ...-proxy-with-grpc-chain.envoy-1-14-x.golden | 6 +- ...-proxy-with-grpc-chain.envoy-1-15-x.golden | 6 +- ...-proxy-with-grpc-chain.envoy-1-16-x.golden | 6 +- ...-proxy-with-http-chain.envoy-1-13-x.golden | 6 +- ...-proxy-with-http-chain.envoy-1-14-x.golden | 6 +- ...-proxy-with-http-chain.envoy-1-15-x.golden | 6 +- ...-proxy-with-http-chain.envoy-1-16-x.golden | 6 +- ...proxy-with-http2-chain.envoy-1-13-x.golden | 6 +- ...proxy-with-http2-chain.envoy-1-14-x.golden | 6 +- ...proxy-with-http2-chain.envoy-1-15-x.golden | 6 +- ...proxy-with-http2-chain.envoy-1-16-x.golden | 6 +- ...-through-local-gateway.envoy-1-13-x.golden | 6 +- ...-through-local-gateway.envoy-1-14-x.golden | 6 +- ...-through-local-gateway.envoy-1-15-x.golden | 6 +- ...-through-local-gateway.envoy-1-16-x.golden | 6 +- ...through-remote-gateway.envoy-1-13-x.golden | 6 +- ...through-remote-gateway.envoy-1-14-x.golden | 6 +- ...through-remote-gateway.envoy-1-15-x.golden | 6 +- ...through-remote-gateway.envoy-1-16-x.golden | 6 +- ...t-proxy-with-tcp-chain.envoy-1-13-x.golden | 6 +- ...t-proxy-with-tcp-chain.envoy-1-14-x.golden | 6 +- ...t-proxy-with-tcp-chain.envoy-1-15-x.golden | 6 +- ...t-proxy-with-tcp-chain.envoy-1-16-x.golden | 6 +- ...-listener-http-2-typed.envoy-1-13-x.golden | 4 +- ...-listener-http-2-typed.envoy-1-14-x.golden | 4 +- ...-listener-http-2-typed.envoy-1-15-x.golden | 4 +- ...-listener-http-2-typed.envoy-1-16-x.golden | 4 +- ...public-listener-http-2.envoy-1-13-x.golden | 4 +- ...public-listener-http-2.envoy-1-14-x.golden | 4 +- ...public-listener-http-2.envoy-1-15-x.golden | 4 +- ...public-listener-http-2.envoy-1-16-x.golden | 4 +- ...-listener-http-missing.envoy-1-13-x.golden | 4 +- ...-listener-http-missing.envoy-1-14-x.golden | 4 +- ...-listener-http-missing.envoy-1-15-x.golden | 4 +- ...-listener-http-missing.envoy-1-16-x.golden | 4 +- ...ic-listener-http-typed.envoy-1-13-x.golden | 4 +- ...ic-listener-http-typed.envoy-1-14-x.golden | 4 +- ...ic-listener-http-typed.envoy-1-15-x.golden | 4 +- ...ic-listener-http-typed.envoy-1-16-x.golden | 4 +- ...m-public-listener-http.envoy-1-13-x.golden | 4 +- ...m-public-listener-http.envoy-1-14-x.golden | 4 +- ...m-public-listener-http.envoy-1-15-x.golden | 4 +- ...m-public-listener-http.envoy-1-16-x.golden | 4 +- ...custom-public-listener.envoy-1-13-x.golden | 4 +- ...custom-public-listener.envoy-1-14-x.golden | 4 +- ...custom-public-listener.envoy-1-15-x.golden | 4 +- ...custom-public-listener.envoy-1-16-x.golden | 4 +- ...nored-with-disco-chain.envoy-1-13-x.golden | 6 +- ...nored-with-disco-chain.envoy-1-14-x.golden | 6 +- ...nored-with-disco-chain.envoy-1-15-x.golden | 6 +- ...nored-with-disco-chain.envoy-1-16-x.golden | 6 +- .../custom-upstream.envoy-1-13-x.golden | 4 +- .../custom-upstream.envoy-1-14-x.golden | 4 +- .../custom-upstream.envoy-1-15-x.golden | 4 +- .../custom-upstream.envoy-1-16-x.golden | 4 +- .../listeners/defaults.envoy-1-13-x.golden | 6 +- .../listeners/defaults.envoy-1-14-x.golden | 6 +- .../listeners/defaults.envoy-1-15-x.golden | 6 +- .../listeners/defaults.envoy-1-16-x.golden | 6 +- ...-paths-local-app-paths.envoy-1-13-x.golden | 6 +- ...-paths-local-app-paths.envoy-1-14-x.golden | 6 +- ...-paths-local-app-paths.envoy-1-15-x.golden | 6 +- ...-paths-local-app-paths.envoy-1-16-x.golden | 6 +- ...aths-new-cluster-http2.envoy-1-13-x.golden | 6 +- ...aths-new-cluster-http2.envoy-1-14-x.golden | 6 +- ...aths-new-cluster-http2.envoy-1-15-x.golden | 6 +- ...aths-new-cluster-http2.envoy-1-16-x.golden | 6 +- .../http-public-listener.envoy-1-13-x.golden | 6 +- .../http-public-listener.envoy-1-14-x.golden | 6 +- .../http-public-listener.envoy-1-15-x.golden | 6 +- .../http-public-listener.envoy-1-16-x.golden | 6 +- .../http-upstream.envoy-1-13-x.golden | 8 +- .../http-upstream.envoy-1-14-x.golden | 8 +- .../http-upstream.envoy-1-15-x.golden | 8 +- .../http-upstream.envoy-1-16-x.golden | 8 +- ...ess-gateway-bind-addrs.envoy-1-13-x.golden | 6 +- ...ess-gateway-bind-addrs.envoy-1-14-x.golden | 6 +- ...ess-gateway-bind-addrs.envoy-1-15-x.golden | 6 +- ...ess-gateway-bind-addrs.envoy-1-16-x.golden | 6 +- .../ingress-gateway.envoy-1-13-x.golden | 2 +- .../ingress-gateway.envoy-1-14-x.golden | 2 +- .../ingress-gateway.envoy-1-15-x.golden | 2 +- .../ingress-gateway.envoy-1-16-x.golden | 2 +- ...http-multiple-services.envoy-1-13-x.golden | 4 +- ...http-multiple-services.envoy-1-14-x.golden | 4 +- ...http-multiple-services.envoy-1-15-x.golden | 4 +- ...http-multiple-services.envoy-1-16-x.golden | 4 +- ...with-resolver-redirect.envoy-1-13-x.golden | 2 +- ...with-resolver-redirect.envoy-1-14-x.golden | 2 +- ...with-resolver-redirect.envoy-1-15-x.golden | 2 +- ...with-resolver-redirect.envoy-1-16-x.golden | 2 +- ...th-chain-and-overrides.envoy-1-13-x.golden | 2 +- ...th-chain-and-overrides.envoy-1-14-x.golden | 2 +- ...th-chain-and-overrides.envoy-1-15-x.golden | 2 +- ...th-chain-and-overrides.envoy-1-16-x.golden | 2 +- ...ith-chain-external-sni.envoy-1-13-x.golden | 2 +- ...ith-chain-external-sni.envoy-1-14-x.golden | 2 +- ...ith-chain-external-sni.envoy-1-15-x.golden | 2 +- ...ith-chain-external-sni.envoy-1-16-x.golden | 2 +- ...-through-local-gateway.envoy-1-13-x.golden | 2 +- ...-through-local-gateway.envoy-1-14-x.golden | 2 +- ...-through-local-gateway.envoy-1-15-x.golden | 2 +- ...-through-local-gateway.envoy-1-16-x.golden | 2 +- ...through-remote-gateway.envoy-1-13-x.golden | 2 +- ...through-remote-gateway.envoy-1-14-x.golden | 2 +- ...through-remote-gateway.envoy-1-15-x.golden | 2 +- ...through-remote-gateway.envoy-1-16-x.golden | 2 +- ...ress-with-tls-listener.envoy-1-13-x.golden | 2 +- ...ress-with-tls-listener.envoy-1-14-x.golden | 2 +- ...ress-with-tls-listener.envoy-1-15-x.golden | 2 +- ...ress-with-tls-listener.envoy-1-16-x.golden | 2 +- ...ener-bind-address-port.envoy-1-13-x.golden | 6 +- ...ener-bind-address-port.envoy-1-14-x.golden | 6 +- ...ener-bind-address-port.envoy-1-15-x.golden | 6 +- ...ener-bind-address-port.envoy-1-16-x.golden | 6 +- .../listener-bind-address.envoy-1-13-x.golden | 6 +- .../listener-bind-address.envoy-1-14-x.golden | 6 +- .../listener-bind-address.envoy-1-15-x.golden | 6 +- .../listener-bind-address.envoy-1-16-x.golden | 6 +- .../listener-bind-port.envoy-1-13-x.golden | 6 +- .../listener-bind-port.envoy-1-14-x.golden | 6 +- .../listener-bind-port.envoy-1-15-x.golden | 6 +- .../listener-bind-port.envoy-1-16-x.golden | 6 +- ...teway-custom-addresses.envoy-1-13-x.golden | 32 +- ...teway-custom-addresses.envoy-1-14-x.golden | 32 +- ...teway-custom-addresses.envoy-1-15-x.golden | 32 +- ...teway-custom-addresses.envoy-1-16-x.golden | 32 +- ...sh-gateway-no-services.envoy-1-13-x.golden | 2 +- ...sh-gateway-no-services.envoy-1-14-x.golden | 2 +- ...sh-gateway-no-services.envoy-1-15-x.golden | 2 +- ...sh-gateway-no-services.envoy-1-16-x.golden | 2 +- ...teway-tagged-addresses.envoy-1-13-x.golden | 16 +- ...teway-tagged-addresses.envoy-1-14-x.golden | 16 +- ...teway-tagged-addresses.envoy-1-15-x.golden | 16 +- ...teway-tagged-addresses.envoy-1-16-x.golden | 16 +- ...sing-federation-states.envoy-1-13-x.golden | 8 +- ...sing-federation-states.envoy-1-14-x.golden | 8 +- ...sing-federation-states.envoy-1-15-x.golden | 8 +- ...sing-federation-states.envoy-1-16-x.golden | 8 +- .../mesh-gateway.envoy-1-13-x.golden | 8 +- .../mesh-gateway.envoy-1-14-x.golden | 8 +- .../mesh-gateway.envoy-1-15-x.golden | 8 +- .../mesh-gateway.envoy-1-16-x.golden | 8 +- ...with-resolver-redirect.envoy-1-13-x.golden | 6 +- ...with-resolver-redirect.envoy-1-14-x.golden | 6 +- ...with-resolver-redirect.envoy-1-15-x.golden | 6 +- ...with-resolver-redirect.envoy-1-16-x.golden | 6 +- ...m-and-tagged-addresses.envoy-1-13-x.golden | 20 +- ...m-and-tagged-addresses.envoy-1-14-x.golden | 20 +- ...m-and-tagged-addresses.envoy-1-15-x.golden | 20 +- ...m-and-tagged-addresses.envoy-1-16-x.golden | 20 +- ...ng-gateway-no-api-cert.envoy-1-13-x.golden | 8 +- ...ng-gateway-no-api-cert.envoy-1-14-x.golden | 8 +- ...ng-gateway-no-api-cert.envoy-1-15-x.golden | 8 +- ...ng-gateway-no-api-cert.envoy-1-16-x.golden | 8 +- ...ng-gateway-no-services.envoy-1-13-x.golden | 2 +- ...ng-gateway-no-services.envoy-1-14-x.golden | 2 +- ...ng-gateway-no-services.envoy-1-15-x.golden | 2 +- ...ng-gateway-no-services.envoy-1-16-x.golden | 2 +- ...ateway-service-subsets.envoy-1-13-x.golden | 14 +- ...ateway-service-subsets.envoy-1-14-x.golden | 14 +- ...ateway-service-subsets.envoy-1-15-x.golden | 14 +- ...ateway-service-subsets.envoy-1-16-x.golden | 14 +- .../terminating-gateway.envoy-1-13-x.golden | 10 +- .../terminating-gateway.envoy-1-14-x.golden | 10 +- .../terminating-gateway.envoy-1-15-x.golden | 10 +- .../terminating-gateway.envoy-1-16-x.golden | 10 +- api/api.go | 2 +- command/connect/envoy/bootstrap_config.go | 257 ++++++++++---- .../connect/envoy/bootstrap_config_test.go | 321 +++++++++++++++++- command/connect/envoy/bootstrap_tpl.go | 13 +- command/connect/envoy/envoy.go | 77 ++++- command/connect/envoy/envoy_oss_test.go | 9 + command/connect/envoy/envoy_test.go | 163 +++++++-- ..._ADDR-with-https-scheme-enables-tls.golden | 60 ++++ .../envoy/testdata/access-log-path.golden | 60 ++++ .../connect/envoy/testdata/defaults.golden | 60 ++++ .../envoy/testdata/existing-ca-file.golden | 60 ++++ .../envoy/testdata/existing-ca-path.golden | 60 ++++ .../envoy/testdata/extra_-multiple.golden | 60 ++++ .../envoy/testdata/extra_-single.golden | 60 ++++ .../envoy/testdata/grpc-addr-config.golden | 60 ++++ .../envoy/testdata/grpc-addr-env.golden | 60 ++++ .../envoy/testdata/grpc-addr-flag.golden | 60 ++++ .../envoy/testdata/grpc-addr-unix.golden | 60 ++++ .../ingress-gateway-address-specified.golden | 60 ++++ .../ingress-gateway-no-auto-register.golden | 60 ++++ ...-register-with-service-and-proxy-id.golden | 60 ++++ ...ister-with-service-without-proxy-id.golden | 60 ++++ .../envoy/testdata/ingress-gateway.golden | 60 ++++ .../connect/envoy/testdata/token-arg.golden | 60 ++++ .../connect/envoy/testdata/token-env.golden | 60 ++++ .../envoy/testdata/token-file-arg.golden | 60 ++++ .../envoy/testdata/token-file-env.golden | 60 ++++ .../testdata/zipkin-tracing-config.golden | 60 ++++ .../integration/connect/envoy/Dockerfile-bats | 4 +- .../connect/envoy/Dockerfile-consul-envoy | 2 +- .../connect/envoy/case-centralconf/capture.sh | 3 + .../envoy/case-centralconf/verify.bats | 6 +- .../connect/envoy/case-prometheus/capture.sh | 3 + .../connect/envoy/case-prometheus/verify.bats | 6 +- .../envoy/case-stats-proxy/verify.bats | 4 +- test/integration/connect/envoy/helpers.bash | 1 + .../app/components/topology-metrics/index.hbs | 4 +- .../topology-metrics/stats/index.js | 6 +- .../app/services/repository/metrics.js | 10 +- .../v1/internal/ui/metrics-proxy/api/v1/query | 54 ++- .../vendor/metrics-providers/prometheus.js | 281 +++++++-------- 220 files changed, 2794 insertions(+), 916 deletions(-) create mode 100644 .changelog/9207.txt create mode 100644 command/connect/envoy/envoy_oss_test.go create mode 100644 test/integration/connect/envoy/case-centralconf/capture.sh create mode 100644 test/integration/connect/envoy/case-prometheus/capture.sh diff --git a/.changelog/9207.txt b/.changelog/9207.txt new file mode 100644 index 0000000000..a29bbdb3c3 --- /dev/null +++ b/.changelog/9207.txt @@ -0,0 +1,3 @@ +```release-note:breaking-change +connect: Update Envoy metrics names and labels for proxy listeners so that attributes like datacenter and namespace can be extracted. +``` \ No newline at end of file diff --git a/agent/xds/listeners.go b/agent/xds/listeners.go index 64ea872680..dcf8f76d21 100644 --- a/agent/xds/listeners.go +++ b/agent/xds/listeners.go @@ -319,7 +319,7 @@ func (s *Server) makeIngressGatewayListeners(address string, cfgSnap *proxycfg.C filterName: listenerKey.RouteName(), routeName: listenerKey.RouteName(), cluster: "", - statPrefix: "ingress_upstream_", + statPrefix: "ingress_upstream.", routePath: "", ingress: false, httpAuthzFilter: nil, @@ -771,7 +771,7 @@ func (s *Server) makeTerminatingGatewayListener( // This fallback catch-all filter ensures a listener will be present for health checks to pass // Envoy will reset these connections since known endpoints are caught by filter chain matches above - tcpProxy, err := makeTCPProxyFilter(name, "", "terminating_gateway_") + tcpProxy, err := makeTCPProxyFilter(name, "", "terminating_gateway.") if err != nil { return nil, err } @@ -821,7 +821,7 @@ func (s *Server) makeFilterChainTerminatingGateway( // Lastly we setup the actual proxying component. For L4 this is a straight // tcp proxy. For L7 this is a very hands-off HTTP proxy just to inject an // HTTP filter to do intention checks here instead. - statPrefix := fmt.Sprintf("terminating_gateway_%s_%s_", service.NamespaceOrDefault(), service.Name) + statPrefix := fmt.Sprintf("terminating_gateway.%s.%s.", service.NamespaceOrDefault(), service.Name) opts := listenerFilterOpts{ protocol: protocol, filterName: listener, @@ -868,7 +868,7 @@ func (s *Server) makeMeshGatewayListener(name, addr string, port int, cfgSnap *p // The cluster name here doesn't matter as the sni_cluster // filter will fill it in for us. - tcpProxy, err := makeTCPProxyFilter(name, "", "mesh_gateway_local_") + tcpProxy, err := makeTCPProxyFilter(name, "", "mesh_gateway_local.") if err != nil { return nil, err } @@ -891,8 +891,8 @@ func (s *Server) makeMeshGatewayListener(name, addr string, port int, cfgSnap *p continue // skip local } clusterName := connect.DatacenterSNI(dc, cfgSnap.Roots.TrustDomain) - filterName := fmt.Sprintf("%s_%s", name, dc) - dcTCPProxy, err := makeTCPProxyFilter(filterName, clusterName, "mesh_gateway_remote_") + filterName := fmt.Sprintf("%s.%s", name, dc) + dcTCPProxy, err := makeTCPProxyFilter(filterName, clusterName, "mesh_gateway_remote.") if err != nil { return nil, err } @@ -913,8 +913,8 @@ func (s *Server) makeMeshGatewayListener(name, addr string, port int, cfgSnap *p continue // skip local } clusterName := cfgSnap.ServerSNIFn(dc, "") - filterName := fmt.Sprintf("%s_%s", name, dc) - dcTCPProxy, err := makeTCPProxyFilter(filterName, clusterName, "mesh_gateway_remote_") + filterName := fmt.Sprintf("%s.%s", name, dc) + dcTCPProxy, err := makeTCPProxyFilter(filterName, clusterName, "mesh_gateway_remote.") if err != nil { return nil, err } @@ -933,8 +933,8 @@ func (s *Server) makeMeshGatewayListener(name, addr string, port int, cfgSnap *p for _, srv := range cfgSnap.MeshGateway.ConsulServers { clusterName := cfgSnap.ServerSNIFn(cfgSnap.Datacenter, srv.Node.Node) - filterName := fmt.Sprintf("%s_%s", name, cfgSnap.Datacenter) - dcTCPProxy, err := makeTCPProxyFilter(filterName, clusterName, "mesh_gateway_local_server_") + filterName := fmt.Sprintf("%s.%s", name, cfgSnap.Datacenter) + dcTCPProxy, err := makeTCPProxyFilter(filterName, clusterName, "mesh_gateway_local_server.") if err != nil { return nil, err } @@ -976,38 +976,61 @@ func (s *Server) makeUpstreamListenerForDiscoveryChain( } useRDS := true - clusterName := "" + var ( + clusterName string + destination, datacenter, namespace string + ) if chain == nil || chain.IsDefault() { + useRDS = false + dc := u.Datacenter if dc == "" { dc = cfgSnap.Datacenter } - sni := connect.UpstreamSNI(u, "", dc, cfgSnap.Roots.TrustDomain) + destination, datacenter, namespace = u.DestinationName, dc, u.DestinationNamespace - useRDS = false + sni := connect.UpstreamSNI(u, "", dc, cfgSnap.Roots.TrustDomain) clusterName = CustomizeClusterName(sni, chain) - } else if cfg.Protocol == "tcp" { - startNode := chain.Nodes[chain.StartNode] - if startNode == nil { - return nil, fmt.Errorf("missing first node in compiled discovery chain for: %s", chain.ServiceName) - } else if startNode.Type != structs.DiscoveryGraphNodeTypeResolver { - return nil, fmt.Errorf("unexpected first node in discovery chain using protocol=%q: %s", cfg.Protocol, startNode.Type) - } - targetID := startNode.Resolver.Target - target := chain.Targets[targetID] + } else { + destination, datacenter, namespace = chain.ServiceName, chain.Datacenter, chain.Namespace - useRDS = false - clusterName = CustomizeClusterName(target.Name, chain) + if cfg.Protocol == "tcp" { + useRDS = false + + startNode := chain.Nodes[chain.StartNode] + if startNode == nil { + return nil, fmt.Errorf("missing first node in compiled discovery chain for: %s", chain.ServiceName) + } + if startNode.Type != structs.DiscoveryGraphNodeTypeResolver { + return nil, fmt.Errorf("unexpected first node in discovery chain using protocol=%q: %s", cfg.Protocol, startNode.Type) + } + targetID := startNode.Resolver.Target + target := chain.Targets[targetID] + + clusterName = CustomizeClusterName(target.Name, chain) + } + } + + // Default the namespace to match how SNIs are generated + if namespace == "" { + namespace = structs.IntentionDefaultNamespace + } + filterName := fmt.Sprintf("%s.%s.%s", destination, namespace, datacenter) + + if u.DestinationType == structs.UpstreamDestTypePreparedQuery { + // Avoid encoding dc and namespace for prepared queries. + // Those are defined in the query itself and are not available here. + filterName = upstreamID } opts := listenerFilterOpts{ useRDS: useRDS, protocol: cfg.Protocol, - filterName: upstreamID, + filterName: filterName, routeName: upstreamID, cluster: clusterName, - statPrefix: "upstream_", + statPrefix: "upstream.", routePath: "", ingress: false, httpAuthzFilter: nil, @@ -1120,17 +1143,17 @@ func makeSNIClusterFilter() (*envoylistener.Filter, error) { func makeTCPProxyFilter(filterName, cluster, statPrefix string) (*envoylistener.Filter, error) { cfg := &envoytcp.TcpProxy{ - StatPrefix: makeStatPrefix("tcp", statPrefix, filterName), + StatPrefix: makeStatPrefix(statPrefix, filterName), ClusterSpecifier: &envoytcp.TcpProxy_Cluster{Cluster: cluster}, } return makeFilter("envoy.tcp_proxy", cfg, false) } -func makeStatPrefix(protocol, prefix, filterName string) string { +func makeStatPrefix(prefix, filterName string) string { // Replace colons here because Envoy does that in the metrics for the actual // clusters but doesn't in the stat prefix here while dashboards assume they // will match. - return fmt.Sprintf("%s%s_%s", prefix, strings.Replace(filterName, ":", "_", -1), protocol) + return fmt.Sprintf("%s%s", prefix, strings.Replace(filterName, ":", "_", -1)) } func makeHTTPFilter(opts listenerFilterOpts) (*envoylistener.Filter, error) { @@ -1138,13 +1161,9 @@ func makeHTTPFilter(opts listenerFilterOpts) (*envoylistener.Filter, error) { if !opts.ingress { op = envoyhttp.HttpConnectionManager_Tracing_EGRESS } - proto := "http" - if opts.protocol == "grpc" { - proto = opts.protocol - } cfg := &envoyhttp.HttpConnectionManager{ - StatPrefix: makeStatPrefix(proto, opts.statPrefix, opts.filterName), + StatPrefix: makeStatPrefix(opts.statPrefix, opts.filterName), CodecType: envoyhttp.HttpConnectionManager_AUTO, HttpFilters: []*envoyhttp.HttpFilter{ { diff --git a/agent/xds/listeners_test.go b/agent/xds/listeners_test.go index 5b08ab6372..d04c118d06 100644 --- a/agent/xds/listeners_test.go +++ b/agent/xds/listeners_test.go @@ -577,7 +577,7 @@ func expectListenerJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot) ma "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] @@ -600,7 +600,7 @@ func expectListenerJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot) ma "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -623,7 +623,7 @@ func expectListenerJSONResources(t *testing.T, snap *proxycfg.ConfigSnapshot) ma "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-13-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-13-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-14-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-14-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-15-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-15-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-16-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-and-overrides.envoy-1-16-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-13-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-14-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-15-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-16-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-chain-external-sni.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-13-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-13-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-14-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-14-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-15-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-15-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-16-x.golden index e835edf4d1..9440dc5fee 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-grpc-chain.envoy-1-16-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-13-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-13-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-14-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-14-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-15-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-15-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-16-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http-chain.envoy-1-16-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-13-x.golden index 11d1ddf64f..d8cffd7c57 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-13-x.golden @@ -30,7 +30,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -58,7 +58,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -112,7 +112,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-14-x.golden index 11d1ddf64f..d8cffd7c57 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-14-x.golden @@ -30,7 +30,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -58,7 +58,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -112,7 +112,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-15-x.golden index 11d1ddf64f..d8cffd7c57 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-15-x.golden @@ -30,7 +30,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -58,7 +58,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -112,7 +112,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-16-x.golden index 11d1ddf64f..d8cffd7c57 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-http2-chain.envoy-1-16-x.golden @@ -30,7 +30,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -58,7 +58,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -112,7 +112,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-13-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-13-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-14-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-14-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-15-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-15-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-16-x.golden b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-16-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/connect-proxy-with-tcp-chain.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-13-x.golden index 21137f9ebb..447ad21fee 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-13-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-14-x.golden index 21137f9ebb..447ad21fee 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-14-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-15-x.golden index 21137f9ebb..447ad21fee 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-15-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-16-x.golden index 21137f9ebb..447ad21fee 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2-typed.envoy-1-16-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-13-x.golden index 301330c589..d7454bfc65 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-13-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-14-x.golden index 301330c589..d7454bfc65 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-14-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-15-x.golden index 301330c589..d7454bfc65 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-15-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-16-x.golden index 301330c589..d7454bfc65 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-2.envoy-1-16-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-13-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-13-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-14-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-14-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-15-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-15-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-16-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-missing.envoy-1-16-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-13-x.golden index 0743cf8c84..7a0a773716 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-13-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-14-x.golden index 0743cf8c84..7a0a773716 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-14-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-15-x.golden index 0743cf8c84..7a0a773716 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-15-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-16-x.golden index 0743cf8c84..7a0a773716 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http-typed.envoy-1-16-x.golden @@ -95,7 +95,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -118,7 +118,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-13-x.golden index e94c7711fc..f512fda8d4 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-13-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-14-x.golden index e94c7711fc..f512fda8d4 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-14-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-15-x.golden index e94c7711fc..f512fda8d4 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-15-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-16-x.golden index e94c7711fc..f512fda8d4 100644 --- a/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener-http.envoy-1-16-x.golden @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-13-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-13-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-14-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-14-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-15-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-15-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-16-x.golden index 23cf9572e0..463afd84d2 100644 --- a/agent/xds/testdata/listeners/custom-public-listener.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-public-listener.envoy-1-16-x.golden @@ -71,7 +71,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-13-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-14-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-15-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-16-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream-typed-ignored-with-disco-chain.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream.envoy-1-13-x.golden b/agent/xds/testdata/listeners/custom-upstream.envoy-1-13-x.golden index 2a10b9b05d..5352d5dcea 100644 --- a/agent/xds/testdata/listeners/custom-upstream.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream.envoy-1-13-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream.envoy-1-14-x.golden b/agent/xds/testdata/listeners/custom-upstream.envoy-1-14-x.golden index 2a10b9b05d..5352d5dcea 100644 --- a/agent/xds/testdata/listeners/custom-upstream.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream.envoy-1-14-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream.envoy-1-15-x.golden b/agent/xds/testdata/listeners/custom-upstream.envoy-1-15-x.golden index 2a10b9b05d..5352d5dcea 100644 --- a/agent/xds/testdata/listeners/custom-upstream.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream.envoy-1-15-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/custom-upstream.envoy-1-16-x.golden b/agent/xds/testdata/listeners/custom-upstream.envoy-1-16-x.golden index 2a10b9b05d..5352d5dcea 100644 --- a/agent/xds/testdata/listeners/custom-upstream.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/custom-upstream.envoy-1-16-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/defaults.envoy-1-13-x.golden b/agent/xds/testdata/listeners/defaults.envoy-1-13-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/defaults.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/defaults.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/defaults.envoy-1-14-x.golden b/agent/xds/testdata/listeners/defaults.envoy-1-14-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/defaults.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/defaults.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/defaults.envoy-1-15-x.golden b/agent/xds/testdata/listeners/defaults.envoy-1-15-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/defaults.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/defaults.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/defaults.envoy-1-16-x.golden b/agent/xds/testdata/listeners/defaults.envoy-1-16-x.golden index d43380ee1a..fd505a15cd 100644 --- a/agent/xds/testdata/listeners/defaults.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/defaults.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-13-x.golden b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-13-x.golden index 485f366fe1..8a98dc9eaa 100644 --- a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-13-x.golden @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -94,7 +94,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health2_21501_http", + "stat_prefix": "exposed_path_filter_health2_21501", "tracing": { "random_sampling": { } @@ -132,7 +132,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-14-x.golden b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-14-x.golden index 485f366fe1..8a98dc9eaa 100644 --- a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-14-x.golden @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -94,7 +94,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health2_21501_http", + "stat_prefix": "exposed_path_filter_health2_21501", "tracing": { "random_sampling": { } @@ -132,7 +132,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-15-x.golden b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-15-x.golden index 485f366fe1..8a98dc9eaa 100644 --- a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-15-x.golden @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -94,7 +94,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health2_21501_http", + "stat_prefix": "exposed_path_filter_health2_21501", "tracing": { "random_sampling": { } @@ -132,7 +132,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-16-x.golden b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-16-x.golden index 485f366fe1..8a98dc9eaa 100644 --- a/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-local-app-paths.envoy-1-16-x.golden @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -94,7 +94,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health2_21501_http", + "stat_prefix": "exposed_path_filter_health2_21501", "tracing": { "random_sampling": { } @@ -132,7 +132,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-13-x.golden b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-13-x.golden index d16f93c993..6e02409272 100644 --- a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-13-x.golden @@ -44,7 +44,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501_http", + "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501", "tracing": { "random_sampling": { } @@ -96,7 +96,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -134,7 +134,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-14-x.golden b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-14-x.golden index d16f93c993..6e02409272 100644 --- a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-14-x.golden @@ -44,7 +44,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501_http", + "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501", "tracing": { "random_sampling": { } @@ -96,7 +96,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -134,7 +134,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-15-x.golden b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-15-x.golden index d16f93c993..6e02409272 100644 --- a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-15-x.golden @@ -44,7 +44,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501_http", + "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501", "tracing": { "random_sampling": { } @@ -96,7 +96,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -134,7 +134,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-16-x.golden b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-16-x.golden index d16f93c993..6e02409272 100644 --- a/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/expose-paths-new-cluster-http2.envoy-1-16-x.golden @@ -44,7 +44,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501_http", + "stat_prefix": "exposed_path_filter_grpchealthv1HealthCheck_21501", "tracing": { "random_sampling": { } @@ -96,7 +96,7 @@ } ] }, - "stat_prefix": "exposed_path_filter_health1_21500_http", + "stat_prefix": "exposed_path_filter_health1_21500", "tracing": { "random_sampling": { } @@ -134,7 +134,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/http-public-listener.envoy-1-13-x.golden b/agent/xds/testdata/listeners/http-public-listener.envoy-1-13-x.golden index f8eb24c538..71a1d33ef7 100644 --- a/agent/xds/testdata/listeners/http-public-listener.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/http-public-listener.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -118,7 +118,7 @@ } ] }, - "stat_prefix": "public_listener_http", + "stat_prefix": "public_listener", "tracing": { "random_sampling": { } diff --git a/agent/xds/testdata/listeners/http-public-listener.envoy-1-14-x.golden b/agent/xds/testdata/listeners/http-public-listener.envoy-1-14-x.golden index f8eb24c538..71a1d33ef7 100644 --- a/agent/xds/testdata/listeners/http-public-listener.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/http-public-listener.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -118,7 +118,7 @@ } ] }, - "stat_prefix": "public_listener_http", + "stat_prefix": "public_listener", "tracing": { "random_sampling": { } diff --git a/agent/xds/testdata/listeners/http-public-listener.envoy-1-15-x.golden b/agent/xds/testdata/listeners/http-public-listener.envoy-1-15-x.golden index f8eb24c538..71a1d33ef7 100644 --- a/agent/xds/testdata/listeners/http-public-listener.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/http-public-listener.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -118,7 +118,7 @@ } ] }, - "stat_prefix": "public_listener_http", + "stat_prefix": "public_listener", "tracing": { "random_sampling": { } diff --git a/agent/xds/testdata/listeners/http-public-listener.envoy-1-16-x.golden b/agent/xds/testdata/listeners/http-public-listener.envoy-1-16-x.golden index f8eb24c538..71a1d33ef7 100644 --- a/agent/xds/testdata/listeners/http-public-listener.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/http-public-listener.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -118,7 +118,7 @@ } ] }, - "stat_prefix": "public_listener_http", + "stat_prefix": "public_listener", "tracing": { "random_sampling": { } diff --git a/agent/xds/testdata/listeners/http-upstream.envoy-1-13-x.golden b/agent/xds/testdata/listeners/http-upstream.envoy-1-13-x.golden index 2acb211dc5..36465d5cbd 100644 --- a/agent/xds/testdata/listeners/http-upstream.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/http-upstream.envoy-1-13-x.golden @@ -28,7 +28,7 @@ "domains": [ "*" ], - "name": "db", + "name": "db.default.dc1", "routes": [ { "match": { @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -70,7 +70,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -124,7 +124,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/http-upstream.envoy-1-14-x.golden b/agent/xds/testdata/listeners/http-upstream.envoy-1-14-x.golden index 2acb211dc5..36465d5cbd 100644 --- a/agent/xds/testdata/listeners/http-upstream.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/http-upstream.envoy-1-14-x.golden @@ -28,7 +28,7 @@ "domains": [ "*" ], - "name": "db", + "name": "db.default.dc1", "routes": [ { "match": { @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -70,7 +70,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -124,7 +124,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/http-upstream.envoy-1-15-x.golden b/agent/xds/testdata/listeners/http-upstream.envoy-1-15-x.golden index 2acb211dc5..36465d5cbd 100644 --- a/agent/xds/testdata/listeners/http-upstream.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/http-upstream.envoy-1-15-x.golden @@ -28,7 +28,7 @@ "domains": [ "*" ], - "name": "db", + "name": "db.default.dc1", "routes": [ { "match": { @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -70,7 +70,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -124,7 +124,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/http-upstream.envoy-1-16-x.golden b/agent/xds/testdata/listeners/http-upstream.envoy-1-16-x.golden index 2acb211dc5..36465d5cbd 100644 --- a/agent/xds/testdata/listeners/http-upstream.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/http-upstream.envoy-1-16-x.golden @@ -28,7 +28,7 @@ "domains": [ "*" ], - "name": "db", + "name": "db.default.dc1", "routes": [ { "match": { @@ -42,7 +42,7 @@ } ] }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -70,7 +70,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -124,7 +124,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-13-x.golden index edf9167e36..7dc99eceba 100644 --- a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-14-x.golden index edf9167e36..7dc99eceba 100644 --- a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-15-x.golden index edf9167e36..7dc99eceba 100644 --- a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-16-x.golden index edf9167e36..7dc99eceba 100644 --- a/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway-bind-addrs.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -63,7 +63,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-13-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-14-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-15-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-16-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-gateway.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-gateway.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-13-x.golden index 637d583200..d3ce4a744d 100644 --- a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-13-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "443" }, - "stat_prefix": "ingress_upstream_443_http", + "stat_prefix": "ingress_upstream.443", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -67,7 +67,7 @@ }, "route_config_name": "8080" }, - "stat_prefix": "ingress_upstream_8080_http", + "stat_prefix": "ingress_upstream.8080", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-14-x.golden index 637d583200..d3ce4a744d 100644 --- a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-14-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "443" }, - "stat_prefix": "ingress_upstream_443_http", + "stat_prefix": "ingress_upstream.443", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -67,7 +67,7 @@ }, "route_config_name": "8080" }, - "stat_prefix": "ingress_upstream_8080_http", + "stat_prefix": "ingress_upstream.8080", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-15-x.golden index 637d583200..d3ce4a744d 100644 --- a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-15-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "443" }, - "stat_prefix": "ingress_upstream_443_http", + "stat_prefix": "ingress_upstream.443", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -67,7 +67,7 @@ }, "route_config_name": "8080" }, - "stat_prefix": "ingress_upstream_8080_http", + "stat_prefix": "ingress_upstream.8080", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-16-x.golden index 637d583200..d3ce4a744d 100644 --- a/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-http-multiple-services.envoy-1-16-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "443" }, - "stat_prefix": "ingress_upstream_443_http", + "stat_prefix": "ingress_upstream.443", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -67,7 +67,7 @@ }, "route_config_name": "8080" }, - "stat_prefix": "ingress_upstream_8080_http", + "stat_prefix": "ingress_upstream.8080", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-13-x.golden index a6e98cd85d..eff9534906 100644 --- a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-13-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "9191" }, - "stat_prefix": "ingress_upstream_9191_http", + "stat_prefix": "ingress_upstream.9191", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-14-x.golden index a6e98cd85d..eff9534906 100644 --- a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-14-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "9191" }, - "stat_prefix": "ingress_upstream_9191_http", + "stat_prefix": "ingress_upstream.9191", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-15-x.golden index a6e98cd85d..eff9534906 100644 --- a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-15-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "9191" }, - "stat_prefix": "ingress_upstream_9191_http", + "stat_prefix": "ingress_upstream.9191", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-16-x.golden index a6e98cd85d..eff9534906 100644 --- a/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-splitter-with-resolver-redirect.envoy-1-16-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "9191" }, - "stat_prefix": "ingress_upstream_9191_http", + "stat_prefix": "ingress_upstream.9191", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-13-x.golden index a3965f01ae..1fb580b673 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-13-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-14-x.golden index a3965f01ae..1fb580b673 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-14-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-15-x.golden index a3965f01ae..1fb580b673 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-15-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-16-x.golden index a3965f01ae..1fb580b673 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-and-overrides.envoy-1-16-x.golden @@ -35,7 +35,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_grpc", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { diff --git a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-13-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-14-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-15-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-16-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-chain-external-sni.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-local-gateway.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden index c91167dfad..0af41618d5 100644 --- a/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tcp-chain-failover-through-remote-gateway.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-13-x.golden b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-13-x.golden index fcddd66348..30ebdc0368 100644 --- a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-13-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-14-x.golden b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-14-x.golden index fcddd66348..30ebdc0368 100644 --- a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-14-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-15-x.golden b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-15-x.golden index fcddd66348..30ebdc0368 100644 --- a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-15-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-16-x.golden b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-16-x.golden index fcddd66348..30ebdc0368 100644 --- a/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/ingress-with-tls-listener.envoy-1-16-x.golden @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-13-x.golden b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-13-x.golden index 2dbd28ccd2..4e7ede85ac 100644 --- a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-14-x.golden b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-14-x.golden index 2dbd28ccd2..4e7ede85ac 100644 --- a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-15-x.golden b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-15-x.golden index 2dbd28ccd2..4e7ede85ac 100644 --- a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-16-x.golden b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-16-x.golden index 2dbd28ccd2..4e7ede85ac 100644 --- a/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address-port.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-13-x.golden b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-13-x.golden index 3340f9ca1c..3dc403fd3f 100644 --- a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-14-x.golden b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-14-x.golden index 3340f9ca1c..3dc403fd3f 100644 --- a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-15-x.golden b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-15-x.golden index 3340f9ca1c..3dc403fd3f 100644 --- a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-16-x.golden b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-16-x.golden index 3340f9ca1c..3dc403fd3f 100644 --- a/agent/xds/testdata/listeners/listener-bind-address.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-address.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-13-x.golden b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-13-x.golden index ead52f0a5c..c7e07a6d8f 100644 --- a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-13-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-14-x.golden b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-14-x.golden index ead52f0a5c..c7e07a6d8f 100644 --- a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-14-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-15-x.golden b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-15-x.golden index ead52f0a5c..c7e07a6d8f 100644 --- a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-15-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-16-x.golden b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-16-x.golden index ead52f0a5c..c7e07a6d8f 100644 --- a/agent/xds/testdata/listeners/listener-bind-port.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/listener-bind-port.envoy-1-16-x.golden @@ -17,7 +17,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_db_tcp" + "stat_prefix": "upstream.db.default.dc1" } } ] @@ -40,7 +40,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -94,7 +94,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-13-x.golden b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-13-x.golden index 9db1af2fca..0322a5b7f0 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-13-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_bar_tcp" + "stat_prefix": "mesh_gateway_local.bar" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_baz_tcp" + "stat_prefix": "mesh_gateway_local.baz" } } ] @@ -180,7 +180,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -196,7 +196,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -212,7 +212,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -226,7 +226,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] @@ -259,7 +259,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc2" } } ] @@ -275,7 +275,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc4" } } ] @@ -291,7 +291,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc6" } } ] @@ -305,7 +305,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_foo_tcp" + "stat_prefix": "mesh_gateway_local.foo" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-14-x.golden b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-14-x.golden index 9db1af2fca..0322a5b7f0 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-14-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_bar_tcp" + "stat_prefix": "mesh_gateway_local.bar" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_baz_tcp" + "stat_prefix": "mesh_gateway_local.baz" } } ] @@ -180,7 +180,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -196,7 +196,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -212,7 +212,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -226,7 +226,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] @@ -259,7 +259,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc2" } } ] @@ -275,7 +275,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc4" } } ] @@ -291,7 +291,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc6" } } ] @@ -305,7 +305,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_foo_tcp" + "stat_prefix": "mesh_gateway_local.foo" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-15-x.golden b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-15-x.golden index 9db1af2fca..0322a5b7f0 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-15-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_bar_tcp" + "stat_prefix": "mesh_gateway_local.bar" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_baz_tcp" + "stat_prefix": "mesh_gateway_local.baz" } } ] @@ -180,7 +180,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -196,7 +196,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -212,7 +212,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -226,7 +226,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] @@ -259,7 +259,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc2" } } ] @@ -275,7 +275,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc4" } } ] @@ -291,7 +291,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc6" } } ] @@ -305,7 +305,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_foo_tcp" + "stat_prefix": "mesh_gateway_local.foo" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-16-x.golden b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-16-x.golden index 9db1af2fca..0322a5b7f0 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-custom-addresses.envoy-1-16-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_bar_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.bar.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_bar_tcp" + "stat_prefix": "mesh_gateway_local.bar" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_baz_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.baz.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_baz_tcp" + "stat_prefix": "mesh_gateway_local.baz" } } ] @@ -180,7 +180,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -196,7 +196,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -212,7 +212,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -226,7 +226,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] @@ -259,7 +259,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc2" } } ] @@ -275,7 +275,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc4" } } ] @@ -291,7 +291,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_foo_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.foo.dc6" } } ] @@ -305,7 +305,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_foo_tcp" + "stat_prefix": "mesh_gateway_local.foo" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-13-x.golden b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-13-x.golden index f020c5a2a1..87612918a3 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-13-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-14-x.golden b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-14-x.golden index f020c5a2a1..87612918a3 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-14-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-15-x.golden b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-15-x.golden index f020c5a2a1..87612918a3 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-15-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-16-x.golden b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-16-x.golden index f020c5a2a1..87612918a3 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-no-services.envoy-1-16-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-13-x.golden b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-13-x.golden index ee5588e97e..d964d207a5 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-13-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_lan_tcp" + "stat_prefix": "mesh_gateway_local.lan" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_wan_tcp" + "stat_prefix": "mesh_gateway_local.wan" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-14-x.golden b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-14-x.golden index ee5588e97e..d964d207a5 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-14-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_lan_tcp" + "stat_prefix": "mesh_gateway_local.lan" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_wan_tcp" + "stat_prefix": "mesh_gateway_local.wan" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-15-x.golden b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-15-x.golden index ee5588e97e..d964d207a5 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-15-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_lan_tcp" + "stat_prefix": "mesh_gateway_local.lan" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_wan_tcp" + "stat_prefix": "mesh_gateway_local.wan" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-16-x.golden b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-16-x.golden index ee5588e97e..d964d207a5 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-tagged-addresses.envoy-1-16-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_lan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.lan.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_lan_tcp" + "stat_prefix": "mesh_gateway_local.lan" } } ] @@ -101,7 +101,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc2" } } ] @@ -117,7 +117,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc4" } } ] @@ -133,7 +133,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_wan_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.wan.dc6" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_wan_tcp" + "stat_prefix": "mesh_gateway_local.wan" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-13-x.golden b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-13-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-13-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-14-x.golden b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-14-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-14-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-15-x.golden b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-15-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-15-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-16-x.golden b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-16-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway-using-federation-states.envoy-1-16-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-13-x.golden b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-13-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-13-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-14-x.golden b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-14-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-14-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-15-x.golden b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-15-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-15-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-16-x.golden b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-16-x.golden index e2250d535b..3b5c85a43b 100644 --- a/agent/xds/testdata/listeners/mesh-gateway.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/mesh-gateway.envoy-1-16-x.golden @@ -22,7 +22,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc2.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc2_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc2" } } ] @@ -38,7 +38,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc4.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc4_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc4" } } ] @@ -54,7 +54,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "dc6.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "mesh_gateway_remote_default_dc6_tcp" + "stat_prefix": "mesh_gateway_remote.default.dc6" } } ] @@ -68,7 +68,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "mesh_gateway_local_default_tcp" + "stat_prefix": "mesh_gateway_local.default" } } ] diff --git a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-13-x.golden b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-13-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-13-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-14-x.golden b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-14-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-14-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-15-x.golden b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-15-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-15-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-16-x.golden b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-16-x.golden index a2ecc48cd9..2e1467d67a 100644 --- a/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/splitter-with-resolver-redirect.envoy-1-16-x.golden @@ -28,7 +28,7 @@ }, "route_config_name": "db" }, - "stat_prefix": "upstream_db_http", + "stat_prefix": "upstream.db.default.dc1", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -56,7 +56,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "geo-cache.default.dc1.query.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "upstream_prepared_query_geo-cache_tcp" + "stat_prefix": "upstream.prepared_query_geo-cache" } } ] @@ -110,7 +110,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "local_app", - "stat_prefix": "public_listener_tcp" + "stat_prefix": "public_listener" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-13-x.golden b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-13-x.golden index 0164fc6359..6175ab5627 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-13-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_foo_tcp" + "stat_prefix": "terminating_gateway.default.api.foo" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_foo_tcp" + "stat_prefix": "terminating_gateway.default.cache.foo" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_foo_tcp" + "stat_prefix": "terminating_gateway.default.db.foo" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_foo_tcp" + "stat_prefix": "terminating_gateway.default.web.foo" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_foo_tcp" + "stat_prefix": "terminating_gateway.foo" } } ] @@ -272,7 +272,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_wan_tcp" + "stat_prefix": "terminating_gateway.default.api.wan" } } ] @@ -319,7 +319,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_wan_tcp" + "stat_prefix": "terminating_gateway.default.cache.wan" } } ] @@ -366,7 +366,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_wan_tcp" + "stat_prefix": "terminating_gateway.default.db.wan" } } ] @@ -413,7 +413,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_wan_tcp" + "stat_prefix": "terminating_gateway.default.web.wan" } } ] @@ -427,7 +427,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_wan_tcp" + "stat_prefix": "terminating_gateway.wan" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-14-x.golden b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-14-x.golden index 0164fc6359..6175ab5627 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-14-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_foo_tcp" + "stat_prefix": "terminating_gateway.default.api.foo" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_foo_tcp" + "stat_prefix": "terminating_gateway.default.cache.foo" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_foo_tcp" + "stat_prefix": "terminating_gateway.default.db.foo" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_foo_tcp" + "stat_prefix": "terminating_gateway.default.web.foo" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_foo_tcp" + "stat_prefix": "terminating_gateway.foo" } } ] @@ -272,7 +272,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_wan_tcp" + "stat_prefix": "terminating_gateway.default.api.wan" } } ] @@ -319,7 +319,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_wan_tcp" + "stat_prefix": "terminating_gateway.default.cache.wan" } } ] @@ -366,7 +366,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_wan_tcp" + "stat_prefix": "terminating_gateway.default.db.wan" } } ] @@ -413,7 +413,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_wan_tcp" + "stat_prefix": "terminating_gateway.default.web.wan" } } ] @@ -427,7 +427,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_wan_tcp" + "stat_prefix": "terminating_gateway.wan" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-15-x.golden b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-15-x.golden index 0164fc6359..6175ab5627 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-15-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_foo_tcp" + "stat_prefix": "terminating_gateway.default.api.foo" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_foo_tcp" + "stat_prefix": "terminating_gateway.default.cache.foo" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_foo_tcp" + "stat_prefix": "terminating_gateway.default.db.foo" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_foo_tcp" + "stat_prefix": "terminating_gateway.default.web.foo" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_foo_tcp" + "stat_prefix": "terminating_gateway.foo" } } ] @@ -272,7 +272,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_wan_tcp" + "stat_prefix": "terminating_gateway.default.api.wan" } } ] @@ -319,7 +319,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_wan_tcp" + "stat_prefix": "terminating_gateway.default.cache.wan" } } ] @@ -366,7 +366,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_wan_tcp" + "stat_prefix": "terminating_gateway.default.db.wan" } } ] @@ -413,7 +413,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_wan_tcp" + "stat_prefix": "terminating_gateway.default.web.wan" } } ] @@ -427,7 +427,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_wan_tcp" + "stat_prefix": "terminating_gateway.wan" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-16-x.golden b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-16-x.golden index 0164fc6359..6175ab5627 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-custom-and-tagged-addresses.envoy-1-16-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_foo_tcp" + "stat_prefix": "terminating_gateway.default.api.foo" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_foo_tcp" + "stat_prefix": "terminating_gateway.default.cache.foo" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_foo_tcp" + "stat_prefix": "terminating_gateway.default.db.foo" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_foo_tcp" + "stat_prefix": "terminating_gateway.default.web.foo" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_foo_tcp" + "stat_prefix": "terminating_gateway.foo" } } ] @@ -272,7 +272,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_wan_tcp" + "stat_prefix": "terminating_gateway.default.api.wan" } } ] @@ -319,7 +319,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_wan_tcp" + "stat_prefix": "terminating_gateway.default.cache.wan" } } ] @@ -366,7 +366,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_wan_tcp" + "stat_prefix": "terminating_gateway.default.db.wan" } } ] @@ -413,7 +413,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_wan_tcp" + "stat_prefix": "terminating_gateway.default.web.wan" } } ] @@ -427,7 +427,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_wan_tcp" + "stat_prefix": "terminating_gateway.wan" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-13-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-13-x.golden index bfb7ab050a..9fadea4d9a 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-13-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -161,7 +161,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-14-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-14-x.golden index bfb7ab050a..9fadea4d9a 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-14-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -161,7 +161,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-15-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-15-x.golden index bfb7ab050a..9fadea4d9a 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-15-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -161,7 +161,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-16-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-16-x.golden index bfb7ab050a..9fadea4d9a 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-api-cert.envoy-1-16-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -161,7 +161,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-13-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-13-x.golden index 47c7d163a6..437033b6b8 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-13-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-14-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-14-x.golden index 47c7d163a6..437033b6b8 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-14-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-15-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-15-x.golden index 47c7d163a6..437033b6b8 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-15-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-16-x.golden b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-16-x.golden index 47c7d163a6..437033b6b8 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-no-services.envoy-1-16-x.golden @@ -20,7 +20,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-13-x.golden b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-13-x.golden index 9947e4838b..b38648e3eb 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-13-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -204,7 +204,7 @@ }, "route_config_name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -266,7 +266,7 @@ }, "route_config_name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -328,7 +328,7 @@ }, "route_config_name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -347,7 +347,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-14-x.golden b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-14-x.golden index 9947e4838b..b38648e3eb 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-14-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -204,7 +204,7 @@ }, "route_config_name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -266,7 +266,7 @@ }, "route_config_name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -328,7 +328,7 @@ }, "route_config_name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -347,7 +347,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-15-x.golden b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-15-x.golden index 9947e4838b..b38648e3eb 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-15-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -204,7 +204,7 @@ }, "route_config_name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -266,7 +266,7 @@ }, "route_config_name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -328,7 +328,7 @@ }, "route_config_name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -347,7 +347,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-16-x.golden b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-16-x.golden index 9947e4838b..b38648e3eb 100644 --- a/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway-service-subsets.envoy-1-16-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -204,7 +204,7 @@ }, "route_config_name": "v1.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -266,7 +266,7 @@ }, "route_config_name": "v2.web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -328,7 +328,7 @@ }, "route_config_name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" }, - "stat_prefix": "terminating_gateway_default_web_default_http", + "stat_prefix": "terminating_gateway.default.web.default", "tracing": { "operation_name": "EGRESS", "random_sampling": { @@ -347,7 +347,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-13-x.golden b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-13-x.golden index eba577e6ce..173be72c15 100644 --- a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-13-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-13-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-14-x.golden b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-14-x.golden index eba577e6ce..173be72c15 100644 --- a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-14-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-14-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-15-x.golden b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-15-x.golden index eba577e6ce..173be72c15 100644 --- a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-15-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-15-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-16-x.golden b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-16-x.golden index eba577e6ce..173be72c15 100644 --- a/agent/xds/testdata/listeners/terminating-gateway.envoy-1-16-x.golden +++ b/agent/xds/testdata/listeners/terminating-gateway.envoy-1-16-x.golden @@ -53,7 +53,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_api_default_tcp" + "stat_prefix": "terminating_gateway.default.api.default" } } ] @@ -100,7 +100,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "cache.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_cache_default_tcp" + "stat_prefix": "terminating_gateway.default.cache.default" } } ] @@ -147,7 +147,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_db_default_tcp" + "stat_prefix": "terminating_gateway.default.db.default" } } ] @@ -194,7 +194,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", - "stat_prefix": "terminating_gateway_default_web_default_tcp" + "stat_prefix": "terminating_gateway.default.web.default" } } ] @@ -208,7 +208,7 @@ "name": "envoy.tcp_proxy", "config": { "cluster": "", - "stat_prefix": "terminating_gateway_default_tcp" + "stat_prefix": "terminating_gateway.default" } } ] diff --git a/api/api.go b/api/api.go index 4de3e77c80..08f00c4069 100644 --- a/api/api.go +++ b/api/api.go @@ -310,7 +310,7 @@ type Config struct { TokenFile string // Namespace is the name of the namespace to send along for the request - // when no other Namespace ispresent in the QueryOptions + // when no other Namespace is present in the QueryOptions Namespace string TLSConfig TLSConfig diff --git a/command/connect/envoy/bootstrap_config.go b/command/connect/envoy/bootstrap_config.go index f2d696e216..99c2b1f1a5 100644 --- a/command/connect/envoy/bootstrap_config.go +++ b/command/connect/envoy/bootstrap_config.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + "github.com/hashicorp/consul/api" "net" "net/url" "os" @@ -157,8 +158,8 @@ func (c *BootstrapConfig) Template() string { return bootstrapTemplate } -func (c *BootstrapConfig) GenerateJSON(args *BootstrapTplArgs) ([]byte, error) { - if err := c.ConfigureArgs(args); err != nil { +func (c *BootstrapConfig) GenerateJSON(args *BootstrapTplArgs, omitDeprecatedTags bool) ([]byte, error) { + if err := c.ConfigureArgs(args, omitDeprecatedTags); err != nil { return nil, err } t, err := template.New("bootstrap").Parse(c.Template()) @@ -182,7 +183,7 @@ func (c *BootstrapConfig) GenerateJSON(args *BootstrapTplArgs) ([]byte, error) { // ConfigureArgs takes the basic template arguments generated from the command // arguments and environment and modifies them according to the BootstrapConfig. -func (c *BootstrapConfig) ConfigureArgs(args *BootstrapTplArgs) error { +func (c *BootstrapConfig) ConfigureArgs(args *BootstrapTplArgs, omitDeprecatedTags bool) error { // Attempt to setup sink(s) from high-level config. Note the args are passed // by ref and modified in place. @@ -196,9 +197,11 @@ func (c *BootstrapConfig) ConfigureArgs(args *BootstrapTplArgs) error { } else { // Attempt to setup tags from high-level config. Note the args are passed by // ref and modified in place. - if err := c.generateStatsConfig(args); err != nil { + stats, err := generateStatsTags(args, c.StatsTags, omitDeprecatedTags) + if err != nil { return err } + args.StatsConfigJSON = formatStatsTags(stats) } if c.StaticClustersJSON != "" { @@ -305,36 +308,127 @@ func (c *BootstrapConfig) generateStatsSinkJSON(name string, addr string) (strin }`, nil } -var sniTagJSONs []string +// resourceTagSpecifiers returns patterns used to generate tags from cluster and filter metric names. +func resourceTagSpecifiers(omitDeprecatedTags bool) ([]string, error) { + const ( + reSegment = `[^.]+` + ) -func init() { - // ......consul - // - cluster.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 - // - cluster.f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 - // - cluster.v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 - // - cluster.f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 - const PART = `[^.]+` + // For all rules: + // - The outer capture group is removed from the final metric name. + // - The inner capture group is extracted into labels. rules := [][]string{ - {"consul.custom_hash", - fmt.Sprintf(`^cluster\.((?:(%s)~)?(?:%s\.)?%s\.%s\.%s\.%s\.%s\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, - {"consul.service_subset", - fmt.Sprintf(`^cluster\.((?:%s~)?(?:(%s)\.)?%s\.%s\.%s\.%s\.%s\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, - {"consul.service", - fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?(%s)\.%s\.%s\.%s\.%s\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, - {"consul.namespace", - fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.(%s)\.%s\.%s\.%s\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, - {"consul.datacenter", - fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.(%s)\.%s\.%s\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, - {"consul.routing_type", - fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.%s\.(%s)\.%s\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, // internal:true/false would be idea - {"consul.trust_domain", - fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.%s\.%s\.(%s)\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, - {"consul.target", - fmt.Sprintf(`^cluster\.(((?:%s~)?(?:%s\.)?%s\.%s\.%s)\.%s\.%s\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, - {"consul.full_target", - fmt.Sprintf(`^cluster\.(((?:%s~)?(?:%s\.)?%s\.%s\.%s\.%s\.%s)\.consul\.)`, PART, PART, PART, PART, PART, PART, PART)}, + // Cluster metrics are prefixed by consul.destination + // + // Cluster metric name format: + // ......consul + // + // Examples: + // - cluster.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 + // - cluster.f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 + // - cluster.v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 + // - cluster.f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors: 0 + {"consul.destination.custom_hash", + fmt.Sprintf(`^cluster\.((?:(%s)~)?(?:%s\.)?%s\.%s\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.service_subset", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:(%s)\.)?%s\.%s\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.service", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?(%s)\.%s\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.namespace", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.(%s)\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.datacenter", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.(%s)\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.routing_type", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.%s\.(%s)\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.trust_domain", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.%s\.%s\.(%s)\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.target", + fmt.Sprintf(`^cluster\.(((?:%s~)?(?:%s\.)?%s\.%s\.%s)\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.destination.full_target", + fmt.Sprintf(`^cluster\.(((?:%s~)?(?:%s\.)?%s\.%s\.%s\.%s\.%s)\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + // Upstream listener metrics are prefixed by consul.upstream + // + // Listener metric name format: + // .upstream... + // + // Examples: + // - tcp.upstream.db.dc1.downstream_cx_total: 0 + // - http.upstream.web.default.dc1.downstream_cx_total: 0 + {"consul.upstream.service", + fmt.Sprintf(`^(?:tcp|http)\.upstream\.((%s)(?:\.%s)?\.%s\.)`, + reSegment, reSegment, reSegment)}, + + {"consul.upstream.datacenter", + fmt.Sprintf(`^(?:tcp|http)\.upstream\.(%s(?:\.%s)?\.(%s)\.)`, + reSegment, reSegment, reSegment)}, + + {"consul.upstream.namespace", + fmt.Sprintf(`^(?:tcp|http)\.upstream\.(%s(?:\.(%s))?\.%s\.)`, + reSegment, reSegment, reSegment)}, } + // These tags were deprecated in Consul 1.9.0 + // We are leaving them enabled by default for backwards compatibility + if !omitDeprecatedTags { + deprecatedRules := [][]string{ + {"consul.custom_hash", + fmt.Sprintf(`^cluster\.((?:(%s)~)?(?:%s\.)?%s\.%s\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.service_subset", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:(%s)\.)?%s\.%s\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.service", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?(%s)\.%s\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.namespace", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.(%s)\.%s\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.datacenter", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.(%s)\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.routing_type", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.%s\.(%s)\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.trust_domain", + fmt.Sprintf(`^cluster\.((?:%s~)?(?:%s\.)?%s\.%s\.%s\.%s\.(%s)\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.target", + fmt.Sprintf(`^cluster\.(((?:%s~)?(?:%s\.)?%s\.%s\.%s)\.%s\.%s\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + + {"consul.full_target", + fmt.Sprintf(`^cluster\.(((?:%s~)?(?:%s\.)?%s\.%s\.%s\.%s\.%s)\.consul\.)`, + reSegment, reSegment, reSegment, reSegment, reSegment, reSegment, reSegment)}, + } + rules = append(rules, deprecatedRules...) + } + + var tags []string for _, rule := range rules { m := map[string]string{ "tag_name": rule[0], @@ -342,24 +436,35 @@ func init() { } d, err := json.Marshal(m) if err != nil { - panic("error pregenerating SNI envoy tags: " + err.Error()) + return nil, err } - sniTagJSONs = append(sniTagJSONs, string(d)) + tags = append(tags, string(d)) } + return tags, nil } -func (c *BootstrapConfig) generateStatsConfig(args *BootstrapTplArgs) error { - var tagJSONs []string - - // Add some default tags if not already overridden - defaults := map[string]string{ - "local_cluster": args.ProxyCluster, +func formatStatsTags(tags []string) string { + var output string + if len(tags) > 0 { + // use_all_default_tags is true by default but we'll make it explicit! + output = `{ + "stats_tags": [ + ` + strings.Join(tags, ",\n") + ` + ], + "use_all_default_tags": true + }` } + return output +} - // Explode SNI portions. - tagJSONs = append(tagJSONs, sniTagJSONs...) +func generateStatsTags(args *BootstrapTplArgs, initialTags []string, omitDeprecatedTags bool) ([]string, error) { + var ( + // Track tags we are setting explicitly to exclude them from defaults + tagNames = make(map[string]struct{}) + tagJSONs []string + ) - for _, tag := range c.StatsTags { + for _, tag := range initialTags { parts := strings.SplitN(tag, "=", 2) // If there is no equals, treat it as a boolean tag and just assign value of // 1 e.g. "canary" will out put the tag "canary: 1" @@ -373,33 +478,65 @@ func (c *BootstrapConfig) generateStatsConfig(args *BootstrapTplArgs) error { "fixed_value": "` + v + `" }` tagJSONs = append(tagJSONs, tagJSON) - // Remove this in case we override a default - delete(defaults, k) + tagNames[k] = struct{}{} } - for k, v := range defaults { - if v == "" { - // Skip stuff we just didn't have data for, this is only really the case - // in tests currently. + // Explode listener and cluster portions. + tags, err := resourceTagSpecifiers(omitDeprecatedTags) + if err != nil { + return nil, fmt.Errorf("failed to generate resource-specific envoy tags: %v", err) + } + tagJSONs = append(tagJSONs, tags...) + + // Default the namespace here since it is also done for cluster SNI + ns := args.Namespace + if ns == "" { + ns = api.IntentionDefaultNamespace + } + + // Add some default tags if not already overridden. Note this is a slice not a + // map since we need ordering to be deterministic. + defaults := []struct { + name string + val string + }{ + // local_cluster is for backwards compatibility. We originally choose this + // name as it matched a few other Envoy metrics examples given in docs but + // it's a little confusing in context of setting up metrics dashboards. + { + name: "local_cluster", + val: args.ProxyCluster, + }, + { + name: "consul.source.service", + val: args.ProxySourceService, + }, + { + name: "consul.source.namespace", + val: ns, + }, + { + name: "consul.source.datacenter", + val: args.Datacenter, + }, + } + + for _, kv := range defaults { + if kv.val == "" { + // Skip stuff we just didn't have data for. + continue + } + if _, ok := tagNames[kv.name]; ok { + // Skip anything already set explicitly. continue } tagJSON := `{ - "tag_name": "` + k + `", - "fixed_value": "` + v + `" + "tag_name": "` + kv.name + `", + "fixed_value": "` + kv.val + `" }` tagJSONs = append(tagJSONs, tagJSON) } - - if len(tagJSONs) > 0 { - // use_all_default_tags is true by default but we'll make it explicit! - args.StatsConfigJSON = `{ - "stats_tags": [ - ` + strings.Join(tagJSONs, ",\n") + ` - ], - "use_all_default_tags": true - }` - } - return nil + return tagJSONs, nil } func (c *BootstrapConfig) generateListenerConfig(args *BootstrapTplArgs, bindAddr, name, matchType, matchValue, prefixRewrite string) error { diff --git a/command/connect/envoy/bootstrap_config_test.go b/command/connect/envoy/bootstrap_config_test.go index d6d33d13f3..92c64e6c50 100644 --- a/command/connect/envoy/bootstrap_config_test.go +++ b/command/connect/envoy/bootstrap_config_test.go @@ -1,10 +1,13 @@ package envoy import ( + "encoding/json" "reflect" + "regexp" "strings" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -197,21 +200,26 @@ const ( ) func TestBootstrapConfig_ConfigureArgs(t *testing.T) { - sniTagJSON := strings.Join(sniTagJSONs, ",\n") - defaultStatsConfigJSON := `{ - "stats_tags": [ - ` + sniTagJSON + ` - ], - "use_all_default_tags": true - }` + defaultTags, err := generateStatsTags(&BootstrapTplArgs{}, nil, false) + require.NoError(t, err) + + defaultTagsJSON := strings.Join(defaultTags, ",\n") + defaultStatsConfigJSON := formatStatsTags(defaultTags) + + // The updated tags exclude the ones deprecated in Consul 1.9 + updatedTags, err := generateStatsTags(&BootstrapTplArgs{}, nil, true) + require.NoError(t, err) + + updatedStatsConfigJSON := formatStatsTags(updatedTags) tests := []struct { - name string - input BootstrapConfig - env []string - baseArgs BootstrapTplArgs - wantArgs BootstrapTplArgs - wantErr bool + name string + input BootstrapConfig + env []string + baseArgs BootstrapTplArgs + wantArgs BootstrapTplArgs + omitDeprecatedTags bool + wantErr bool }{ { name: "defaults", @@ -403,7 +411,6 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) { wantArgs: BootstrapTplArgs{ StatsConfigJSON: `{ "stats_tags": [ - ` + sniTagJSON + `, { "tag_name": "canary", "fixed_value": "1" @@ -415,7 +422,8 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) { { "tag_name": "baz", "fixed_value": "2" - } + }, + ` + defaultTagsJSON + ` ], "use_all_default_tags": true }`, @@ -623,6 +631,31 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) { }, wantErr: false, }, + { + name: "omit-deprecated-tags", + input: BootstrapConfig{ + ReadyBindAddr: "0.0.0.0:4444", + PrometheusBindAddr: "0.0.0.0:9000", + StatsBindAddr: "0.0.0.0:9000", + }, + baseArgs: BootstrapTplArgs{ + AdminBindAddress: "127.0.0.1", + AdminBindPort: "19000", + }, + omitDeprecatedTags: true, + wantArgs: BootstrapTplArgs{ + AdminBindAddress: "127.0.0.1", + AdminBindPort: "19000", + StaticClustersJSON: expectedSelfAdminCluster, + StaticListenersJSON: strings.Join( + []string{expectedPromListener, expectedStatsListener, expectedReadyListener}, + ", ", + ), + // Should not have default stats config JSON when deprecated tags are omitted + StatsConfigJSON: updatedStatsConfigJSON, + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -630,7 +663,7 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) { defer testSetAndResetEnv(t, tt.env)() - err := tt.input.ConfigureArgs(&args) + err := tt.input.ConfigureArgs(&args, tt.omitDeprecatedTags) if tt.wantErr { require.Error(t, err) } else { @@ -659,3 +692,259 @@ func TestBootstrapConfig_ConfigureArgs(t *testing.T) { }) } } + +func TestConsulTagSpecifiers(t *testing.T) { + // Conveniently both envoy and Go use the re2 dialect of regular + // expressions, so we can actually test the stats tag extraction regular + // expressions right here! + + specs, err := resourceTagSpecifiers(false) + require.NoError(t, err) + + specsNoDeprecated, err := resourceTagSpecifiers(true) + require.NoError(t, err) + + type testPattern struct { + name string + r *regexp.Regexp + } + + parseSpecs := func(specs []string) []testPattern { + var patterns []testPattern + for _, spec := range specs { + var m struct { + TagName string `json:"tag_name"` + Regex string `json:"regex"` + } + require.NoError(t, json.Unmarshal([]byte(spec), &m)) + + patterns = append(patterns, testPattern{ + name: m.TagName, + r: regexp.MustCompile(m.Regex), + }) + } + return patterns + } + + var ( + patterns = parseSpecs(specs) + patternsNoDeprecated = parseSpecs(specsNoDeprecated) + ) + + type testcase struct { + name string + stat string + expect map[string][]string // this is the m[1:] of the match + expectNoDeprecated map[string][]string // this is the m[1:] of the match + } + + cases := []testcase{ + { + name: "cluster service", + stat: "cluster.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors", + expect: map[string][]string{ + "consul.custom_hash": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.datacenter": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.custom_hash": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.datacenter": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.target": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong.default.dc2"}, + "consul.destination.trust_domain": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.full_target": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.namespace": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.routing_type": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.service": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.service_subset": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.target": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong.default.dc2"}, + "consul.trust_domain": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + expectNoDeprecated: map[string][]string{ + "consul.destination.custom_hash": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.datacenter": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.target": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong.default.dc2"}, + "consul.destination.trust_domain": {"pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + }, + { + name: "cluster custom service", + stat: "cluster.f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors", + expect: map[string][]string{ + "consul.custom_hash": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8"}, + "consul.datacenter": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.custom_hash": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8"}, + "consul.destination.datacenter": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.target": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~pong.default.dc2"}, + "consul.destination.trust_domain": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.full_target": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.namespace": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.routing_type": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.service": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.service_subset": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.target": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~pong.default.dc2"}, + "consul.trust_domain": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + expectNoDeprecated: map[string][]string{ + "consul.destination.custom_hash": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8"}, + "consul.destination.datacenter": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.target": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~pong.default.dc2"}, + "consul.destination.trust_domain": {"f8f8f8f8~pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + }, + { + name: "cluster service subset", + stat: "cluster.v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors", + expect: map[string][]string{ + "consul.custom_hash": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.datacenter": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.custom_hash": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.datacenter": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2"}, + "consul.destination.target": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2.pong.default.dc2"}, + "consul.destination.trust_domain": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.full_target": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.namespace": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.routing_type": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.service": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.service_subset": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2"}, + "consul.target": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2.pong.default.dc2"}, + "consul.trust_domain": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + expectNoDeprecated: map[string][]string{ + "consul.destination.custom_hash": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", ""}, + "consul.destination.datacenter": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2"}, + "consul.destination.target": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2.pong.default.dc2"}, + "consul.destination.trust_domain": {"v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + }, + { + name: "cluster custom service subset", + stat: "cluster.f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.bind_errors", + expect: map[string][]string{ + "consul.custom_hash": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8"}, + "consul.datacenter": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.custom_hash": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8"}, + "consul.destination.datacenter": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2"}, + "consul.destination.target": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~v2.pong.default.dc2"}, + "consul.destination.trust_domain": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.full_target": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.namespace": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.routing_type": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.service": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.service_subset": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2"}, + "consul.target": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~v2.pong.default.dc2"}, + "consul.trust_domain": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + expectNoDeprecated: map[string][]string{ + "consul.destination.custom_hash": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8"}, + "consul.destination.datacenter": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "dc2"}, + "consul.destination.full_target": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648"}, + "consul.destination.namespace": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "default"}, + "consul.destination.routing_type": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "internal"}, + "consul.destination.service": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "pong"}, + "consul.destination.service_subset": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "v2"}, + "consul.destination.target": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "f8f8f8f8~v2.pong.default.dc2"}, + "consul.destination.trust_domain": {"f8f8f8f8~v2.pong.default.dc2.internal.e5b08d03-bfc3-c870-1833-baddb116e648.consul.", "e5b08d03-bfc3-c870-1833-baddb116e648"}, + }, + }, + { + name: "tcp listener no namespace", + stat: "tcp.upstream.db.dc1.downstream_cx_total", + expect: map[string][]string{ + "consul.upstream.datacenter": {"db.dc1.", "dc1"}, + "consul.upstream.namespace": {"db.dc1.", ""}, + "consul.upstream.service": {"db.dc1.", "db"}, + }, + }, + { + name: "tcp listener with namespace", + stat: "tcp.upstream.db.default.dc1.downstream_cx_total", + expect: map[string][]string{ + "consul.upstream.datacenter": {"db.default.dc1.", "dc1"}, + "consul.upstream.namespace": {"db.default.dc1.", "default"}, + "consul.upstream.service": {"db.default.dc1.", "db"}, + }, + }, + { + name: "http listener no namespace", + stat: "http.upstream.web.dc1.downstream_cx_total", + expect: map[string][]string{ + "consul.upstream.datacenter": {"web.dc1.", "dc1"}, + "consul.upstream.namespace": {"web.dc1.", ""}, + "consul.upstream.service": {"web.dc1.", "web"}, + }, + }, + { + name: "http listener with namespace", + stat: "http.upstream.web.default.dc1.downstream_cx_total", + expect: map[string][]string{ + "consul.upstream.datacenter": {"web.default.dc1.", "dc1"}, + "consul.upstream.namespace": {"web.default.dc1.", "default"}, + "consul.upstream.service": {"web.default.dc1.", "web"}, + }, + }, + } + + for _, tc := range cases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + var ( + got = make(map[string][]string) + gotNoDeprecated = make(map[string][]string) + ) + for _, p := range patterns { + m := p.r.FindStringSubmatch(tc.stat) + if len(m) > 1 { + m = m[1:] + got[p.name] = m + } + } + for _, p := range patternsNoDeprecated { + m := p.r.FindStringSubmatch(tc.stat) + if len(m) > 1 { + m = m[1:] + gotNoDeprecated[p.name] = m + } + } + + if tc.expectNoDeprecated == nil { + tc.expectNoDeprecated = tc.expect + } + + assert.Equal(t, tc.expect, got) + assert.Equal(t, tc.expectNoDeprecated, gotNoDeprecated) + }) + } +} diff --git a/command/connect/envoy/bootstrap_tpl.go b/command/connect/envoy/bootstrap_tpl.go index cc093b96ea..b73f5e2bb6 100644 --- a/command/connect/envoy/bootstrap_tpl.go +++ b/command/connect/envoy/bootstrap_tpl.go @@ -14,6 +14,12 @@ type BootstrapTplArgs struct { // the agent to deliver the correct configuration. ProxyID string + // ProxySourceService is the Consul service name to report for this proxy + // instance's source service label. For sidecars it should be the + // Proxy.DestinationServiceName. For gateways and similar it is the service + // name of the proxy service itself. + ProxySourceService string + // AgentCAPEM is the CA to use to verify the local agent gRPC service if // TLS is enabled. AgentCAPEM string @@ -79,10 +85,13 @@ type BootstrapTplArgs struct { // See https://www.envoyproxy.io/docs/envoy/v1.9.0/api-v2/config/trace/v2/trace.proto. TracingConfigJSON string - // Namespace is the Consul Enterprise Namespace of the proxy service instance as - // registered with the Consul agent. + // Namespace is the Consul Enterprise Namespace of the proxy service instance + // as registered with the Consul agent. Namespace string + // Datacenter is the datacenter where the proxy service instance is registered. + Datacenter string + // EnvoyVersion is the envoy version, which is necessary to generate the // correct configuration. EnvoyVersion string diff --git a/command/connect/envoy/envoy.go b/command/connect/envoy/envoy.go index 67530f0ec6..6e2953ae30 100644 --- a/command/connect/envoy/envoy.go +++ b/command/connect/envoy/envoy.go @@ -4,6 +4,7 @@ import ( "errors" "flag" "fmt" + "io" "net" "os" "os/exec" @@ -30,7 +31,10 @@ func New(ui cli.Ui) *cmd { Ui: ui, } - c := &cmd{UI: ui} + c := &cmd{ + UI: ui, + directOut: os.Stdout, + } c.init() return c } @@ -43,6 +47,9 @@ type cmd struct { http *flags.HTTPFlags help string client *api.Client + // DirectOut defaults to os.stdout but is a property to allow capture during + // tests to have more useful output. + directOut io.Writer // flags meshGateway bool @@ -64,6 +71,7 @@ type cmd struct { deregAfterCritical string bindAddresses ServiceAddressMapValue exposeServers bool + omitDeprecatedTags bool gatewaySvcName string gatewayKind api.ServiceKind @@ -152,6 +160,11 @@ func (c *cmd) init() { c.flags.StringVar(&c.deregAfterCritical, "deregister-after-critical", "6h", "The amount of time the gateway services health check can be failing before being deregistered") + c.flags.BoolVar(&c.omitDeprecatedTags, "omit-deprecated-tags", false, + "In Consul 1.9.0 the format of metric tags for Envoy clusters was updated from consul.[service|dc|...] to "+ + "consul.destination.[service|dc|...]. The old tags were preserved for backward compatibility,"+ + "but can be disabled with this flag.") + c.http = &flags.HTTPFlags{} flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.NamespaceFlags()) @@ -364,7 +377,7 @@ func (c *cmd) run(args []string) int { if c.bootstrap { // Just output it and we are done - os.Stdout.Write(bootstrapJson) + c.directOut.Write(bootstrapJson) return 0 } @@ -431,10 +444,13 @@ func (c *cmd) templateArgs() (*BootstrapTplArgs, error) { // know service name yet, we will after we resolve the proxy's config in a bit // and will update this then. cluster := c.proxyID + proxySourceService := "" if c.sidecarFor != "" { cluster = c.sidecarFor + proxySourceService = c.sidecarFor } else if c.gateway != "" && c.gatewaySvcName != "" { cluster = c.gatewaySvcName + proxySourceService = c.gatewaySvcName } adminAccessLogPath := c.adminAccessLogPath @@ -453,6 +469,7 @@ func (c *cmd) templateArgs() (*BootstrapTplArgs, error) { GRPC: grpcAddr, ProxyCluster: cluster, ProxyID: c.proxyID, + ProxySourceService: proxySourceService, AgentCAPEM: caPEM, AdminAccessLogPath: adminAccessLogPath, AdminBindAddress: adminBindIP.String(), @@ -483,29 +500,53 @@ func (c *cmd) generateConfig() ([]byte, error) { bsCfg.ReadyBindAddr = lanAddr } + // Fetch any customization from the registration + svc, _, err := c.client.Agent().Service(c.proxyID, nil) + if err != nil { + return nil, fmt.Errorf("failed fetch proxy config from local agent: %s", err) + } + if svc.Proxy == nil { + return nil, errors.New("service is not a Connect proxy or gateway") + } + + if svc.Proxy.DestinationServiceName != "" { + // Override cluster now we know the actual service name + args.ProxyCluster = svc.Proxy.DestinationServiceName + args.ProxySourceService = svc.Proxy.DestinationServiceName + } else { + // Set the source service name from the proxy's own registration + args.ProxySourceService = svc.Service + } + if svc.Namespace != "" { + // In most cases where namespaces are enabled this will already be set + // correctly because the http client that fetched this will need to have + // had the namespace set on it which is also how we initially populate + // this. However in the case of "default" namespace being accessed because + // there was no namespace argument, args.Namespace will be empty even + // though Namespaces are actually being used and the namespace of the request was + // inferred from the ACL token or defaulted to the "default" namespace. + // Overriding it here ensures that we always set the Namespace arg if the + // cluster is using namespaces regardless. + args.Namespace = svc.Namespace + } + agent, err := c.client.Agent().Self() + if err != nil { + return nil, fmt.Errorf("failed to fetch agent config: %v", err) + } + dc, ok := agent["Config"]["Datacenter"].(string) + if !ok { + return nil, fmt.Errorf("failed to fetch datacenter from agent. DC is: %T", agent["Config"]["Datacenter"]) + } + args.Datacenter = dc + if !c.disableCentralConfig { - // Fetch any customization from the registration - svc, _, err := c.client.Agent().Service(c.proxyID, nil) - if err != nil { - return nil, fmt.Errorf("failed fetch proxy config from local agent: %s", err) - } - - if svc.Proxy == nil { - return nil, errors.New("service is not a Connect proxy or gateway") - } - // Parse the bootstrap config if err := mapstructure.WeakDecode(svc.Proxy.Config, &bsCfg); err != nil { return nil, fmt.Errorf("failed parsing Proxy.Config: %s", err) } - - if svc.Proxy.DestinationServiceName != "" { - // Override cluster now we know the actual service name - args.ProxyCluster = svc.Proxy.DestinationServiceName - } } - return bsCfg.GenerateJSON(args) + return bsCfg.GenerateJSON(args, c.omitDeprecatedTags) } // TODO: make method a function diff --git a/command/connect/envoy/envoy_oss_test.go b/command/connect/envoy/envoy_oss_test.go new file mode 100644 index 0000000000..3c519cd465 --- /dev/null +++ b/command/connect/envoy/envoy_oss_test.go @@ -0,0 +1,9 @@ +// +build !consulent + +package envoy + +// enterpriseGenerateConfigTestCases returns enterprise-only configurations to +// test in TestGenerateConfig. +func enterpriseGenerateConfigTestCases() []generateConfigTestCase { + return nil +} diff --git a/command/connect/envoy/envoy_test.go b/command/connect/envoy/envoy_test.go index cab2ae9ad9..9d0b03704f 100644 --- a/command/connect/envoy/envoy_test.go +++ b/command/connect/envoy/envoy_test.go @@ -1,6 +1,7 @@ package envoy import ( + "bytes" "encoding/json" "flag" "io/ioutil" @@ -103,21 +104,24 @@ func testSetAndResetEnv(t *testing.T, env []string) func() { } } +type generateConfigTestCase struct { + Name string + Flags []string + Env []string + Files map[string]string + ProxyConfig map[string]interface{} + NamespacesEnabled bool + GRPCPort int // only used for testing custom-configured grpc port + WantArgs BootstrapTplArgs + WantErr string +} + // This tests the args we use to generate the template directly because they // encapsulate all the argument and default handling code which is where most of // the logic is. We also allow generating golden files but only for cases that // pass the test of having their template args generated as expected. func TestGenerateConfig(t *testing.T) { - cases := []struct { - Name string - Flags []string - Env []string - Files map[string]string - ProxyConfig map[string]interface{} - GRPCPort int // only used for testing custom-configured grpc port - WantArgs BootstrapTplArgs - WantErr string - }{ + cases := []generateConfigTestCase{ { Name: "no-args", Flags: []string{}, @@ -131,6 +135,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", // Note this is the gRPC port @@ -149,6 +156,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", // Note this is the gRPC port @@ -170,6 +180,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", // Note this is the gRPC port @@ -193,6 +206,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", // Note this is the gRPC port @@ -217,6 +233,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", // Note this is the gRPC port @@ -236,6 +255,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -259,6 +281,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -280,6 +305,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentSocket: "/var/run/consul.sock", }, @@ -297,6 +325,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -317,6 +348,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -337,6 +371,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -355,6 +392,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -377,6 +417,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -395,6 +438,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -439,6 +485,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -473,6 +522,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -512,6 +564,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -538,6 +593,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -594,6 +652,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -612,6 +673,9 @@ func TestGenerateConfig(t *testing.T) { EnvoyVersion: defaultEnvoyVersion, ProxyCluster: "test-proxy", ProxyID: "test-proxy", + // We don't know this til after the lookup so it will be empty in the + // initial args call we are testing here. + ProxySourceService: "", // Should resolve IP, note this might not resolve the same way // everywhere which might make this test brittle but not sure what else // to do. @@ -630,9 +694,10 @@ func TestGenerateConfig(t *testing.T) { Name: "ingress-gateway", Flags: []string{"-proxy-id", "ingress-gateway-1", "-gateway", "ingress"}, WantArgs: BootstrapTplArgs{ - EnvoyVersion: defaultEnvoyVersion, - ProxyCluster: "ingress-gateway", - ProxyID: "ingress-gateway-1", + EnvoyVersion: defaultEnvoyVersion, + ProxyCluster: "ingress-gateway", + ProxyID: "ingress-gateway-1", + ProxySourceService: "ingress-gateway", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -647,9 +712,10 @@ func TestGenerateConfig(t *testing.T) { Name: "ingress-gateway-address-specified", Flags: []string{"-proxy-id", "ingress-gateway", "-gateway", "ingress", "-address", "1.2.3.4:7777"}, WantArgs: BootstrapTplArgs{ - EnvoyVersion: defaultEnvoyVersion, - ProxyCluster: "ingress-gateway", - ProxyID: "ingress-gateway", + EnvoyVersion: defaultEnvoyVersion, + ProxyCluster: "ingress-gateway", + ProxyID: "ingress-gateway", + ProxySourceService: "ingress-gateway", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -664,9 +730,10 @@ func TestGenerateConfig(t *testing.T) { Name: "ingress-gateway-register-with-service-without-proxy-id", Flags: []string{"-gateway", "ingress", "-register", "-service", "my-gateway", "-address", "127.0.0.1:7777"}, WantArgs: BootstrapTplArgs{ - EnvoyVersion: defaultEnvoyVersion, - ProxyCluster: "my-gateway", - ProxyID: "my-gateway", + EnvoyVersion: defaultEnvoyVersion, + ProxyCluster: "my-gateway", + ProxyID: "my-gateway", + ProxySourceService: "my-gateway", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -681,9 +748,10 @@ func TestGenerateConfig(t *testing.T) { Name: "ingress-gateway-register-with-service-and-proxy-id", Flags: []string{"-gateway", "ingress", "-register", "-service", "my-gateway", "-proxy-id", "my-gateway-123", "-address", "127.0.0.1:7777"}, WantArgs: BootstrapTplArgs{ - EnvoyVersion: defaultEnvoyVersion, - ProxyCluster: "my-gateway", - ProxyID: "my-gateway-123", + EnvoyVersion: defaultEnvoyVersion, + ProxyCluster: "my-gateway", + ProxyID: "my-gateway-123", + ProxySourceService: "my-gateway", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -698,9 +766,10 @@ func TestGenerateConfig(t *testing.T) { Name: "ingress-gateway-no-auto-register", Flags: []string{"-gateway", "ingress", "-address", "127.0.0.1:7777"}, WantArgs: BootstrapTplArgs{ - EnvoyVersion: defaultEnvoyVersion, - ProxyCluster: "ingress-gateway", - ProxyID: "ingress-gateway", + EnvoyVersion: defaultEnvoyVersion, + ProxyCluster: "ingress-gateway", + ProxyID: "ingress-gateway", + ProxySourceService: "ingress-gateway", GRPC: GRPC{ AgentAddress: "127.0.0.1", AgentPort: "8502", @@ -713,6 +782,8 @@ func TestGenerateConfig(t *testing.T) { }, } + cases = append(cases, enterpriseGenerateConfigTestCases()...) + copyAndReplaceAll := func(s []string, old, new string) []string { out := make([]string, len(s)) for i, v := range s { @@ -736,7 +807,7 @@ func TestGenerateConfig(t *testing.T) { // Run a mock agent API that just always returns the proxy config in the // test. - srv := httptest.NewServer(testMockAgent(tc.ProxyConfig, tc.GRPCPort)) + srv := httptest.NewServer(testMockAgent(tc.ProxyConfig, tc.GRPCPort, tc.NamespacesEnabled)) defer srv.Close() client, err := api.NewClient(&api.Config{Address: srv.URL}) require.NoError(err) @@ -750,6 +821,11 @@ func TestGenerateConfig(t *testing.T) { // explicitly set the client to one which can connect to the httptest.Server c.client = client + var outBuf bytes.Buffer + // Capture output since it clutters test output and we can assert on what + // was actually printed this way. + c.directOut = &outBuf + // Run the command myFlags := copyAndReplaceAll(tc.Flags, "@@TEMPDIR@@", testDirPrefix) args := append([]string{"-bootstrap"}, myFlags...) @@ -770,10 +846,7 @@ func TestGenerateConfig(t *testing.T) { require.NoError(err) // Error cases should have returned above require.Equal(&tc.WantArgs, got) - // Actual template output goes to stdout direct to avoid prefix in UI, so - // generate it again here to assert on. - actual, err := c.generateConfig() - require.NoError(err) + actual := outBuf.Bytes() // If we got the arg handling write, verify output golden := filepath.Join("testdata", tc.Name+".golden") @@ -880,15 +953,15 @@ func TestEnvoy_GatewayRegistration(t *testing.T) { // testMockAgent combines testMockAgentProxyConfig and testMockAgentSelf, // routing /agent/service/... requests to testMockAgentProxyConfig and // routing /agent/self requests to testMockAgentSelf. -func testMockAgent(agentCfg map[string]interface{}, grpcPort int) http.HandlerFunc { +func testMockAgent(agentCfg map[string]interface{}, grpcPort int, namespacesEnabled bool) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if strings.Contains(r.URL.Path, "/agent/services") { - testMockAgentGatewayConfig()(w, r) + testMockAgentGatewayConfig(namespacesEnabled)(w, r) return } if strings.Contains(r.URL.Path, "/agent/service") { - testMockAgentProxyConfig(agentCfg)(w, r) + testMockAgentProxyConfig(agentCfg, namespacesEnabled)(w, r) return } @@ -901,7 +974,7 @@ func testMockAgent(agentCfg map[string]interface{}, grpcPort int) http.HandlerFu }) } -func testMockAgentGatewayConfig() http.HandlerFunc { +func testMockAgentGatewayConfig(namespacesEnabled bool) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Parse the proxy-id from the end of the URL (blindly assuming it's correct // format) @@ -924,6 +997,10 @@ func testMockAgentGatewayConfig() http.HandlerFunc { }, } + if namespacesEnabled { + svc[string(kind)].Namespace = namespaceFromQuery(r) + } + cfgJSON, err := json.Marshal(svc) if err != nil { w.WriteHeader(500) @@ -934,7 +1011,16 @@ func testMockAgentGatewayConfig() http.HandlerFunc { }) } -func testMockAgentProxyConfig(cfg map[string]interface{}) http.HandlerFunc { +func namespaceFromQuery(r *http.Request) string { + // Use the namespace in the request if there is one, otherwise + // use-default. + if queryNs := r.URL.Query().Get("ns"); queryNs != "" { + return queryNs + } + return "default" +} + +func testMockAgentProxyConfig(cfg map[string]interface{}, namespacesEnabled bool) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Parse the proxy-id from the end of the URL (blindly assuming it's correct // format) @@ -952,6 +1038,10 @@ func testMockAgentProxyConfig(cfg map[string]interface{}) http.HandlerFunc { }, } + if namespacesEnabled { + svc.Namespace = namespaceFromQuery(r) + } + cfgJSON, err := json.Marshal(svc) if err != nil { w.WriteHeader(500) @@ -1063,6 +1153,9 @@ func TestEnvoyCommand_canBindInternal(t *testing.T) { func testMockAgentSelf(wantGRPCPort int) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { resp := agent.Self{ + Config: map[string]interface{}{ + "Datacenter": "dc1", + }, DebugConfig: map[string]interface{}{ "GRPCPort": wantGRPCPort, }, diff --git a/command/connect/envoy/testdata/CONSUL_HTTP_ADDR-with-https-scheme-enables-tls.golden b/command/connect/envoy/testdata/CONSUL_HTTP_ADDR-with-https-scheme-enables-tls.golden index a2fdad2549..e1e0547bbd 100644 --- a/command/connect/envoy/testdata/CONSUL_HTTP_ADDR-with-https-scheme-enables-tls.golden +++ b/command/connect/envoy/testdata/CONSUL_HTTP_ADDR-with-https-scheme-enables-tls.golden @@ -45,6 +45,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -84,6 +132,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/access-log-path.golden b/command/connect/envoy/testdata/access-log-path.golden index c8d20d8900..096837c162 100644 --- a/command/connect/envoy/testdata/access-log-path.golden +++ b/command/connect/envoy/testdata/access-log-path.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/defaults.golden b/command/connect/envoy/testdata/defaults.golden index c577836057..3b360404d6 100644 --- a/command/connect/envoy/testdata/defaults.golden +++ b/command/connect/envoy/testdata/defaults.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/existing-ca-file.golden b/command/connect/envoy/testdata/existing-ca-file.golden index 761fcc56c8..36c74916f3 100644 --- a/command/connect/envoy/testdata/existing-ca-file.golden +++ b/command/connect/envoy/testdata/existing-ca-file.golden @@ -45,6 +45,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -84,6 +132,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/existing-ca-path.golden b/command/connect/envoy/testdata/existing-ca-path.golden index 7aa2057621..6c05cc6f98 100644 --- a/command/connect/envoy/testdata/existing-ca-path.golden +++ b/command/connect/envoy/testdata/existing-ca-path.golden @@ -45,6 +45,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -84,6 +132,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/extra_-multiple.golden b/command/connect/envoy/testdata/extra_-multiple.golden index 0b432401d5..839dab5121 100644 --- a/command/connect/envoy/testdata/extra_-multiple.golden +++ b/command/connect/envoy/testdata/extra_-multiple.golden @@ -58,6 +58,54 @@ ], "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -97,6 +145,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/extra_-single.golden b/command/connect/envoy/testdata/extra_-single.golden index 97b0568c1e..94ad8e426d 100644 --- a/command/connect/envoy/testdata/extra_-single.golden +++ b/command/connect/envoy/testdata/extra_-single.golden @@ -49,6 +49,54 @@ ], "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -88,6 +136,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/grpc-addr-config.golden b/command/connect/envoy/testdata/grpc-addr-config.golden index c438f4bf76..bca728cd25 100644 --- a/command/connect/envoy/testdata/grpc-addr-config.golden +++ b/command/connect/envoy/testdata/grpc-addr-config.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/grpc-addr-env.golden b/command/connect/envoy/testdata/grpc-addr-env.golden index c438f4bf76..bca728cd25 100644 --- a/command/connect/envoy/testdata/grpc-addr-env.golden +++ b/command/connect/envoy/testdata/grpc-addr-env.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/grpc-addr-flag.golden b/command/connect/envoy/testdata/grpc-addr-flag.golden index c438f4bf76..bca728cd25 100644 --- a/command/connect/envoy/testdata/grpc-addr-flag.golden +++ b/command/connect/envoy/testdata/grpc-addr-flag.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/grpc-addr-unix.golden b/command/connect/envoy/testdata/grpc-addr-unix.golden index 11413cf4ae..3dd5fa9a0f 100644 --- a/command/connect/envoy/testdata/grpc-addr-unix.golden +++ b/command/connect/envoy/testdata/grpc-addr-unix.golden @@ -35,6 +35,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -74,6 +122,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/ingress-gateway-address-specified.golden b/command/connect/envoy/testdata/ingress-gateway-address-specified.golden index efb6232c33..dc3847a778 100644 --- a/command/connect/envoy/testdata/ingress-gateway-address-specified.golden +++ b/command/connect/envoy/testdata/ingress-gateway-address-specified.golden @@ -109,6 +109,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -148,6 +196,18 @@ { "tag_name": "local_cluster", "fixed_value": "ingress-gateway" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "ingress-gateway" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/ingress-gateway-no-auto-register.golden b/command/connect/envoy/testdata/ingress-gateway-no-auto-register.golden index de1912ec98..4f4fc910c2 100644 --- a/command/connect/envoy/testdata/ingress-gateway-no-auto-register.golden +++ b/command/connect/envoy/testdata/ingress-gateway-no-auto-register.golden @@ -109,6 +109,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -148,6 +196,18 @@ { "tag_name": "local_cluster", "fixed_value": "ingress-gateway" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "ingress-gateway" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/ingress-gateway-register-with-service-and-proxy-id.golden b/command/connect/envoy/testdata/ingress-gateway-register-with-service-and-proxy-id.golden index 0d1239e903..7a94bed1d4 100644 --- a/command/connect/envoy/testdata/ingress-gateway-register-with-service-and-proxy-id.golden +++ b/command/connect/envoy/testdata/ingress-gateway-register-with-service-and-proxy-id.golden @@ -109,6 +109,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -148,6 +196,18 @@ { "tag_name": "local_cluster", "fixed_value": "my-gateway-123" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "my-gateway-123" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/ingress-gateway-register-with-service-without-proxy-id.golden b/command/connect/envoy/testdata/ingress-gateway-register-with-service-without-proxy-id.golden index 93720d2b84..136fb982c5 100644 --- a/command/connect/envoy/testdata/ingress-gateway-register-with-service-without-proxy-id.golden +++ b/command/connect/envoy/testdata/ingress-gateway-register-with-service-without-proxy-id.golden @@ -109,6 +109,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -148,6 +196,18 @@ { "tag_name": "local_cluster", "fixed_value": "my-gateway" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "my-gateway" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/ingress-gateway.golden b/command/connect/envoy/testdata/ingress-gateway.golden index d70b2b7486..112d49c720 100644 --- a/command/connect/envoy/testdata/ingress-gateway.golden +++ b/command/connect/envoy/testdata/ingress-gateway.golden @@ -109,6 +109,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -148,6 +196,18 @@ { "tag_name": "local_cluster", "fixed_value": "ingress-gateway-1" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "ingress-gateway-1" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/token-arg.golden b/command/connect/envoy/testdata/token-arg.golden index 62e3a58f68..8f0fcc2131 100644 --- a/command/connect/envoy/testdata/token-arg.golden +++ b/command/connect/envoy/testdata/token-arg.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/token-env.golden b/command/connect/envoy/testdata/token-env.golden index 62e3a58f68..8f0fcc2131 100644 --- a/command/connect/envoy/testdata/token-env.golden +++ b/command/connect/envoy/testdata/token-env.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/token-file-arg.golden b/command/connect/envoy/testdata/token-file-arg.golden index 62e3a58f68..8f0fcc2131 100644 --- a/command/connect/envoy/testdata/token-file-arg.golden +++ b/command/connect/envoy/testdata/token-file-arg.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/token-file-env.golden b/command/connect/envoy/testdata/token-file-env.golden index 62e3a58f68..8f0fcc2131 100644 --- a/command/connect/envoy/testdata/token-file-env.golden +++ b/command/connect/envoy/testdata/token-file-env.golden @@ -36,6 +36,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -75,6 +123,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/command/connect/envoy/testdata/zipkin-tracing-config.golden b/command/connect/envoy/testdata/zipkin-tracing-config.golden index 811910f02a..ba6245fc3e 100644 --- a/command/connect/envoy/testdata/zipkin-tracing-config.golden +++ b/command/connect/envoy/testdata/zipkin-tracing-config.golden @@ -60,6 +60,54 @@ }, "stats_config": { "stats_tags": [ + { + "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.custom_hash" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:([^.]+)\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service_subset" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.service" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.namespace" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.datacenter" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.routing_type" + }, + { + "regex": "^cluster\\.((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.([^.]+)\\.consul\\.)", + "tag_name": "consul.destination.trust_domain" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+)\\.[^.]+\\.[^.]+\\.consul\\.)", + "tag_name": "consul.destination.target" + }, + { + "regex": "^cluster\\.(((?:[^.]+~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+)\\.consul\\.)", + "tag_name": "consul.destination.full_target" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.(([^.]+)(?:\\.[^.]+)?\\.[^.]+\\.)", + "tag_name": "consul.upstream.service" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.[^.]+)?\\.([^.]+)\\.)", + "tag_name": "consul.upstream.datacenter" + }, + { + "regex": "^(?:tcp|http)\\.upstream\\.([^.]+(?:\\.([^.]+))?\\.[^.]+\\.)", + "tag_name": "consul.upstream.namespace" + }, { "regex": "^cluster\\.((?:([^.]+)~)?(?:[^.]+\\.)?[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.[^.]+\\.consul\\.)", "tag_name": "consul.custom_hash" @@ -99,6 +147,18 @@ { "tag_name": "local_cluster", "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.service", + "fixed_value": "test-proxy" + }, + { + "tag_name": "consul.source.namespace", + "fixed_value": "default" + }, + { + "tag_name": "consul.source.datacenter", + "fixed_value": "dc1" } ], "use_all_default_tags": true diff --git a/test/integration/connect/envoy/Dockerfile-bats b/test/integration/connect/envoy/Dockerfile-bats index 16c4c1e45d..7fab985681 100644 --- a/test/integration/connect/envoy/Dockerfile-bats +++ b/test/integration/connect/envoy/Dockerfile-bats @@ -1,6 +1,6 @@ -FROM docker.mirror.hashicorp.services/fortio/fortio AS fortio +FROM hashicorp.jfrog.io/docker/fortio/fortio AS fortio -FROM docker.mirror.hashicorp.services/bats/bats:latest +FROM hashicorp.jfrog.io/docker/bats/bats:latest RUN apk add curl RUN apk add openssl diff --git a/test/integration/connect/envoy/Dockerfile-consul-envoy b/test/integration/connect/envoy/Dockerfile-consul-envoy index b6d5b3e8e2..af119df94e 100644 --- a/test/integration/connect/envoy/Dockerfile-consul-envoy +++ b/test/integration/connect/envoy/Dockerfile-consul-envoy @@ -3,5 +3,5 @@ ARG ENVOY_VERSION FROM consul-dev as consul -FROM docker.mirror.hashicorp.services/envoyproxy/envoy:v${ENVOY_VERSION} +FROM hashicorp.jfrog.io/docker/envoyproxy/envoy:v${ENVOY_VERSION} COPY --from=consul /bin/consul /bin/consul diff --git a/test/integration/connect/envoy/case-centralconf/capture.sh b/test/integration/connect/envoy/case-centralconf/capture.sh new file mode 100644 index 0000000000..7f0c582f89 --- /dev/null +++ b/test/integration/connect/envoy/case-centralconf/capture.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +snapshot_envoy_admin localhost:19000 s1 primary || true diff --git a/test/integration/connect/envoy/case-centralconf/verify.bats b/test/integration/connect/envoy/case-centralconf/verify.bats index e25fe56460..0f4221ab5f 100644 --- a/test/integration/connect/envoy/case-centralconf/verify.bats +++ b/test/integration/connect/envoy/case-centralconf/verify.bats @@ -42,15 +42,15 @@ load helpers # Should be labelling with local_cluster. retry_default \ must_match_in_prometheus_response localhost:1234 \ - '[\{,]local_cluster="s1"[,}] ' + '[\{,]consul_source_service="s1"[,}] ' # Ensure we have http metrics for public listener retry_default \ must_match_in_prometheus_response localhost:1234 \ - '[\{,]envoy_http_conn_manager_prefix="public_listener_http"[,}]' + '[\{,]envoy_http_conn_manager_prefix="public_listener"[,}]' # Ensure we have http metrics for s2 upstream retry_default \ must_match_in_prometheus_response localhost:1234 \ - '[\{,]envoy_http_conn_manager_prefix="upstream_s2_http"[,}]' + '[\{,]consul_upstream_service="s2"[,}]' } diff --git a/test/integration/connect/envoy/case-prometheus/capture.sh b/test/integration/connect/envoy/case-prometheus/capture.sh new file mode 100644 index 0000000000..7f0c582f89 --- /dev/null +++ b/test/integration/connect/envoy/case-prometheus/capture.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +snapshot_envoy_admin localhost:19000 s1 primary || true diff --git a/test/integration/connect/envoy/case-prometheus/verify.bats b/test/integration/connect/envoy/case-prometheus/verify.bats index 9c4606169d..3d886b60bd 100644 --- a/test/integration/connect/envoy/case-prometheus/verify.bats +++ b/test/integration/connect/envoy/case-prometheus/verify.bats @@ -40,13 +40,13 @@ load helpers must_match_in_prometheus_response localhost:1234 \ '^envoy_http_downstream_rq_active' - # Should be labelling with local_cluster. + # Should be labelling with consul_source_service. retry_default \ must_match_in_prometheus_response localhost:1234 \ - '[\{,]local_cluster="s1"[,}] ' + '[\{,]consul_source_service="s1"[,}] ' # Should be labelling with http listener prefix. retry_default \ must_match_in_prometheus_response localhost:1234 \ - '[\{,]envoy_http_conn_manager_prefix="public_listener_http"[,}]' + '[\{,]envoy_http_conn_manager_prefix="public_listener"[,}]' } diff --git a/test/integration/connect/envoy/case-stats-proxy/verify.bats b/test/integration/connect/envoy/case-stats-proxy/verify.bats index af89d47aaa..285cdd6cbc 100644 --- a/test/integration/connect/envoy/case-stats-proxy/verify.bats +++ b/test/integration/connect/envoy/case-stats-proxy/verify.bats @@ -48,12 +48,12 @@ load helpers # Response should include the http public listener. retry_default \ must_match_in_stats_proxy_response localhost:1239 \ - 'stats' 'http.public_listener_http' + 'stats' 'http.public_listener' # /stats/prometheus should also be reachable and labelling the local cluster. retry_default \ must_match_in_stats_proxy_response localhost:1239 \ - 'stats/prometheus' '[\{,]local_cluster="s1"[,}]' + 'stats/prometheus' '[\{,]consul_source_service="s1"[,}]' # /stats/prometheus should also be reachable and exposing metrics. retry_default \ diff --git a/test/integration/connect/envoy/helpers.bash b/test/integration/connect/envoy/helpers.bash index e9792674e8..63577e0e22 100755 --- a/test/integration/connect/envoy/helpers.bash +++ b/test/integration/connect/envoy/helpers.bash @@ -229,6 +229,7 @@ function snapshot_envoy_admin { docker_wget "$DC" "http://${HOSTPORT}/config_dump" -q -O - > "${OUTDIR}/config_dump.json" docker_wget "$DC" "http://${HOSTPORT}/clusters?format=json" -q -O - > "${OUTDIR}/clusters.json" docker_wget "$DC" "http://${HOSTPORT}/stats" -q -O - > "${OUTDIR}/stats.txt" + docker_wget "$DC" "http://${HOSTPORT}/stats/prometheus" -q -O - > "${OUTDIR}/stats_prometheus.txt" } function reset_envoy_metrics { diff --git a/ui/packages/consul-ui/app/components/topology-metrics/index.hbs b/ui/packages/consul-ui/app/components/topology-metrics/index.hbs index f52d79b889..7b183d7568 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/index.hbs +++ b/ui/packages/consul-ui/app/components/topology-metrics/index.hbs @@ -33,7 +33,7 @@ {{#if this.hasMetricsProvider }} {{#if (not-eq @service.Service.Kind 'ingress-gateway')}} = 2 && m[1] !== '') { + var targetService = "invalid-local-cluster"; + var m = q.match(/consul_source_service="([^"]*)"/); + if (m && m.length >= 2 && m[1] != "") { targetService = m[1]; } - m = q.match(/consul_service="([^"]*)"/); - if (type === 'downstream' && m && m.length >= 2 && m[1] !== '') { + m = q.match(/consul_destination_service="([^"]*)"/); + if (type == "downstream" && m && m.length >= 2 && m[1] != "") { // downstreams don't have the same selector for the main service // name. targetService = m[1]; } - let targets = []; + // Figure out the actual namespace for the target service + var targetNS = "invalid-local-ns"; + var m = q.match(/consul_source_namespace="([^"]*)"/); + if (m && m.length >= 2 && m[1] != "") { + targetNS = m[1]; + } + m = q.match(/consul_destination_namespace="([^"]*)"/); + if (type == "downstream" && m && m.length >= 2 && m[1] != "") { + // downstreams don't have the same selector for the main service + // name. + targetNS = m[1]; + } + + // Figure out the actual datacenter for the target service + var targetDC = "invalid-local-dc"; + var m = q.match(/consul_source_datacenter="([^"]*)"/); + if (m && m.length >= 2 && m[1] != "") { + targetDC = m[1]; + } + m = q.match(/consul_destination_datacenter="([^"]*)"/); + if (type == "downstream" && m && m.length >= 2 && m[1] != "") { + // downstreams don't have the same selector for the main service + // name. + targetDC = m[1]; + } + + var serviceNames = []; switch(type) { case 'downstream': // fallthrough case 'upstream': @@ -156,12 +182,10 @@ let metric = `{}`; switch(type) { case 'upstream': - // TODO: this should really return tcp proxy label for tcp - // metrics but we don't look at that for now. - metric = `{"upstream": "${item.Name}", "envoy_http_conn_manager_prefix": "${item.Name}"}`; + metric = `{"consul_upstream_service": "${item.Name}", "consul_upstream_datacenter": "${targetDC}", "consul_upstream_namespace": "${targetNS}"}`; break; - case 'downstream': - metric = `{"downstream": "${item.Name}", "local_cluster": "${item.Name}"}`; + case "downstream": + metric = `{"consul_source_service": "${item.Name}", "consul_source_datacenter": "${targetDC}", "consul_source_namespace": "${targetNS}"}`; break; } const timestamp = Date.now() / 1000; diff --git a/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js b/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js index 0d25629bf2..8bd5c87fc8 100644 --- a/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js +++ b/ui/packages/consul-ui/vendor/metrics-providers/prometheus.js @@ -1,5 +1,5 @@ /*eslint no-console: "off"*/ -(function() { +(function () { var emptySeries = { unitSuffix: '', labels: {}, data: [] }; var prometheusProvider = { @@ -23,7 +23,7 @@ * The provider should throw an Exception if the options are not valid for * example because it requires a metrics proxy and one is not configured. */ - init: function(options) { + init: function (options) { this.options = options; if (!this.options.metrics_proxy_enabled) { throw new Error( @@ -35,18 +35,18 @@ // simple httpGet function that also encodes query parameters // before passing the constructed url through to native fetch // any errors should throw an error with a statusCode property - httpGet: function(url, queryParams, headers) { + httpGet: function (url, queryParams, headers) { if (queryParams) { var separator = url.indexOf('?') !== -1 ? '&' : '?'; var qs = Object.keys(queryParams) - .map(function(key) { + .map(function (key) { return encodeURIComponent(key) + '=' + encodeURIComponent(queryParams[key]); }) .join('&'); url = url + separator + qs; } // fetch the url along with any headers - return this.options.fetch(url, { headers: headers || {} }).then(function(response) { + return this.options.fetch(url, { headers: headers || {} }).then(function (response) { if (response.ok) { return response.json(); } else { @@ -112,7 +112,7 @@ * Every data point object should have a value for every series label * (except for "Total") otherwise it will be assumed to be "0". */ - serviceRecentSummarySeries: function(serviceDC, namespace, serviceName, protocol, options) { + serviceRecentSummarySeries: function (service, dc, nspace, protocol, options) { // Fetch time-series var series = []; var labels = []; @@ -124,11 +124,11 @@ options.end = now; if (this.hasL7Metrics(protocol)) { - return this.fetchRequestRateSeries(serviceName, options); + return this.fetchRequestRateSeries(service, dc, nspace, options); } // Fallback to just L4 metrics. - return this.fetchDataRateSeries(serviceName, options); + return this.fetchDataRateSeries(service, dc, nspace, options); }, /** @@ -165,20 +165,20 @@ * ] * } */ - serviceRecentSummaryStats: function(serviceDC, namespace, serviceName, protocol, options) { + serviceRecentSummaryStats: function (service, dc, nspace, protocol, options) { // Fetch stats var stats = []; if (this.hasL7Metrics(protocol)) { - stats.push(this.fetchRPS(serviceName, 'service', options)); - stats.push(this.fetchER(serviceName, 'service', options)); - stats.push(this.fetchPercentile(50, serviceName, 'service', options)); - stats.push(this.fetchPercentile(99, serviceName, 'service', options)); + stats.push(this.fetchRPS(service, dc, nspace, 'service', options)); + stats.push(this.fetchER(service, dc, nspace, 'service', options)); + stats.push(this.fetchPercentile(50, service, dc, nspace, 'service', options)); + stats.push(this.fetchPercentile(99, service, dc, nspace, 'service', options)); } else { // Fallback to just L4 metrics. - stats.push(this.fetchConnRate(serviceName, 'service', options)); - stats.push(this.fetchServiceRx(serviceName, 'service', options)); - stats.push(this.fetchServiceTx(serviceName, 'service', options)); - stats.push(this.fetchServiceNoRoute(serviceName, 'service', options)); + stats.push(this.fetchConnRate(service, dc, nspace, 'service', options)); + stats.push(this.fetchServiceRx(service, dc, nspace, 'service', options)); + stats.push(this.fetchServiceTx(service, dc, nspace, 'service', options)); + stats.push(this.fetchServiceNoRoute(service, dc, nspace, 'service', options)); } return this.fetchStats(stats); }, @@ -216,8 +216,8 @@ * } * } */ - upstreamRecentSummaryStats: function(serviceDC, namespace, serviceName, upstreamName, options) { - return this.fetchRecentSummaryStats(serviceName, 'upstream', options); + upstreamRecentSummaryStats: function (service, dc, nspace, options) { + return this.fetchRecentSummaryStats(service, dc, nspace, 'upstream', options); }, /** @@ -245,13 +245,13 @@ * * { * stats: { - * // Each downstream will appear as an entry keyed by the downstream - * // service name. The value is an array of stats with the same + * // Each downstream will appear as an entry keyed by "service.namespace.dc". + * // The value is an array of stats with the same * // format as serviceRecentSummaryStats response.stats. Different * // downstreams may display different stats if required although the * // protocol should be the same for all as it is the target * // service's protocol that matters here. - * "downstream_name": [ + * "web.default.dc1": [ * {label: "SR", desc: "...", value: "99%"}, * ... * ], @@ -259,37 +259,37 @@ * } * } */ - downstreamRecentSummaryStats: function(serviceDC, namespace, serviceName, options) { - return this.fetchRecentSummaryStats(serviceName, 'downstream', options); + downstreamRecentSummaryStats: function (service, dc, nspace, options) { + return this.fetchRecentSummaryStats(service, dc, nspace, 'downstream', options); }, - fetchRecentSummaryStats: function(serviceName, type, options) { + fetchRecentSummaryStats: function (service, dc, nspace, type, options) { // Fetch stats var stats = []; // We don't know which upstreams are HTTP/TCP so just fetch all of them. // HTTP - stats.push(this.fetchRPS(serviceName, type, options)); - stats.push(this.fetchER(serviceName, type, options)); - stats.push(this.fetchPercentile(50, serviceName, type, options)); - stats.push(this.fetchPercentile(99, serviceName, type, options)); + stats.push(this.fetchRPS(service, dc, nspace, type, options)); + stats.push(this.fetchER(service, dc, nspace, type, options)); + stats.push(this.fetchPercentile(50, service, dc, nspace, type, options)); + stats.push(this.fetchPercentile(99, service, dc, nspace, type, options)); // L4 - stats.push(this.fetchConnRate(serviceName, type, options)); - stats.push(this.fetchServiceRx(serviceName, type, options)); - stats.push(this.fetchServiceTx(serviceName, type, options)); - stats.push(this.fetchServiceNoRoute(serviceName, type, options)); + stats.push(this.fetchConnRate(service, dc, nspace, type, options)); + stats.push(this.fetchServiceRx(service, dc, nspace, type, options)); + stats.push(this.fetchServiceTx(service, dc, nspace, type, options)); + stats.push(this.fetchServiceNoRoute(service, dc, nspace, type, options)); return this.fetchStatsGrouped(stats); }, - hasL7Metrics: function(protocol) { + hasL7Metrics: function (protocol) { return protocol === 'http' || protocol === 'http2' || protocol === 'grpc'; }, - fetchStats: function(statsPromises) { - var all = Promise.all(statsPromises).then(function(results) { + fetchStats: function (statsPromises) { + var all = Promise.all(statsPromises).then(function (results) { var data = { stats: [], }; @@ -306,8 +306,8 @@ return all; }, - fetchStatsGrouped: function(statsPromises) { - var all = Promise.all(statsPromises).then(function(results) { + fetchStatsGrouped: function (statsPromises) { + var all = Promise.all(statsPromises).then(function (results) { var data = { stats: {}, }; @@ -330,8 +330,8 @@ return all; }, - reformatSeries: function(unitSuffix, labelMap) { - return function(response) { + reformatSeries: function (unitSuffix, labelMap) { + return function (response) { // Handle empty result sets gracefully. if ( !response.data || @@ -347,7 +347,7 @@ // Populate time values first based on first result since Prometheus will // always return all the same points for all series in the query. - let series = response.data.result[0].values.map(function(d, i) { + let series = response.data.result[0].values.map(function (d, i) { return { time: Math.round(d[0] * 1000), }; @@ -355,8 +355,8 @@ // Then for each series returned populate the labels and values in the // points. - response.data.result.map(function(d) { - d.values.map(function(p, i) { + response.data.result.map(function (d) { + d.values.map(function (p, i) { series[i][d.metric.label] = parseFloat(p[1]); }); }); @@ -369,7 +369,7 @@ }; }, - fetchRequestRateSeries: function(serviceName, options) { + fetchRequestRateSeries: function (service, dc, nspace, options) { // We need the sum of all non-500 error rates as one value and the 500 // error rate as a separate series so that they stack to show the full // request rate. Some creative label replacement makes this possible in @@ -383,7 +383,11 @@ // will get summed together. `label_replace(` + // Get rate of requests to the service - `irate(envoy_listener_http_downstream_rq_xx{local_cluster="${serviceName}",envoy_http_conn_manager_prefix="public_listener_http"}[10m])` + + `irate(envoy_listener_http_downstream_rq_xx{` + + `consul_source_service="${service}",` + + `consul_source_datacenter="${dc}",` + + `consul_source_namespace="${nspace}",` + + `envoy_http_conn_manager_prefix="public_listener"}[10m])` + // ... inner replacement matches all code classes except "5" and // applies err=no `, "label", "Successes", "envoy_response_code_class", "[^5]")` + @@ -399,7 +403,7 @@ return this.fetchSeries(q, options).then(this.reformatSeries(' rps', labelMap)); }, - fetchDataRateSeries: function(serviceName, options) { + fetchDataRateSeries: function (service, dc, nspace, options) { // 8 * converts from bytes/second to bits/second var q = `8 * sum by (label) (` + @@ -407,13 +411,21 @@ // being summed together. `label_replace(` + // Get the tx rate - `irate(envoy_tcp_downstream_cx_tx_bytes_total{local_cluster="${serviceName}",envoy_tcp_prefix="public_listener_tcp"}[10m])` + + `irate(envoy_tcp_downstream_cx_tx_bytes_total{` + + `consul_source_service="${service}",` + + `consul_source_datacenter="${dc}",` + + `consul_source_namespace="${nspace}",` + + `envoy_tcp_prefix="public_listener"}[10m])` + // Match all and apply the tx label `, "label", "Outbound", "__name__", ".*"` + // Union those vectors with the RX ones `) or label_replace(` + // Get the rx rate - `irate(envoy_tcp_downstream_cx_rx_bytes_total{local_cluster="${serviceName}",envoy_tcp_prefix="public_listener_tcp"}[10m])` + + `irate(envoy_tcp_downstream_cx_rx_bytes_total{` + + `consul_source_service="${service}",` + + `consul_source_datacenter="${dc}",` + + `consul_source_namespace="${nspace}",` + + `envoy_tcp_prefix="public_listener"}[10m])` + // Match all and apply the rx label `, "label", "Inbound", "__name__", ".*"` + `)` + @@ -426,218 +438,186 @@ return this.fetchSeries(q, options).then(this.reformatSeries('bps', labelMap)); }, - makeSubject: function(serviceName, type) { + makeSubject: function (service, dc, nspace, type) { + var entity = `${nspace}/${service} (${dc})`; if (type == 'upstream') { // {{GROUP}} is a placeholder that is replaced by the upstream name - return `${serviceName} → {{GROUP}}`; + return `${entity} → {{GROUP}}`; } if (type == 'downstream') { // {{GROUP}} is a placeholder that is replaced by the downstream name - return `{{GROUP}} → ${serviceName}`; + return `{{GROUP}} → ${entity}`; } - return serviceName; + return entity; }, - makeHTTPSelector: function(serviceName, type) { + makeHTTPSelector: function (service, dc, nspace, type) { // Downstreams are totally different if (type == 'downstream') { - return `consul_service="${serviceName}"`; + return `consul_destination_service="${service}",consul_destination_datacenter="${dc}",consul_destination_namespace="${nspace}"`; } - var lc = `local_cluster="${serviceName}"`; + var lc = `consul_source_service="${service}",consul_source_datacenter="${dc}",consul_source_namespace="${nspace}"`; if (type == 'upstream') { - lc += `,envoy_http_conn_manager_prefix=~"upstream_.*"`; + lc += `,envoy_http_conn_manager_prefix="upstream"`; } else { // Only care about inbound public listener - lc += `,envoy_http_conn_manager_prefix="public_listener_http"`; + lc += `,envoy_http_conn_manager_prefix="public_listener"`; } return lc; }, - makeTCPSelector: function(serviceName, type) { + makeTCPSelector: function (service, dc, nspace, type) { // Downstreams are totally different if (type == 'downstream') { - return `consul_service="${serviceName}"`; + return `consul_destination_service="${service}",consul_destination_datacenter="${dc}",consul_destination_namespace="${nspace}"`; } - var lc = `local_cluster="${serviceName}"`; + var lc = `consul_source_service="${service}",consul_source_datacenter="${dc}",consul_source_namespace="${nspace}"`; if (type == 'upstream') { - lc += `,envoy_tcp_prefix=~"upstream_.*"`; + lc += `,envoy_tcp_prefix=~"upstream.*"`; } else { // Only care about inbound public listener - lc += `,envoy_tcp_prefix="public_listener_tcp"`; + lc += `,envoy_tcp_prefix="public_listener"`; } return lc; }, - groupQueryHTTP: function(type, q) { + groupQuery: function (type, q) { if (type == 'upstream') { - q += ' by (envoy_http_conn_manager_prefix)'; - // Extract the raw upstream service name to group results by - q = this.upstreamRelabelQueryHTTP(q); + q += ' by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)'; } else if (type == 'downstream') { - q += ' by (local_cluster)'; - q = this.downstreamRelabelQuery(q); + q += ' by (consul_source_service,consul_source_datacenter,consul_source_namespace)'; } return q; }, - groupQueryTCP: function(type, q) { + groupByInfix: function (type) { if (type == 'upstream') { - q += ' by (envoy_tcp_prefix)'; - // Extract the raw upstream service name to group results by - q = this.upstreamRelabelQueryTCP(q); + return 'upstream'; } else if (type == 'downstream') { - q += ' by (local_cluster)'; - q = this.downstreamRelabelQuery(q); - } - return q; - }, - - upstreamRelabelQueryHTTP: function(q) { - return `label_replace(${q}, "upstream", "$1", "envoy_http_conn_manager_prefix", "upstream_(.*)_http")`; - }, - - upstreamRelabelQueryTCP: function(q) { - return `label_replace(${q}, "upstream", "$1", "envoy_tcp_prefix", "upstream_(.*)_tcp")`; - }, - - downstreamRelabelQuery: function(q) { - return `label_replace(${q}, "downstream", "$1", "local_cluster", "(.*)")`; - }, - - groupBy: function(type) { - if (type == 'service') { + return 'source'; + } else { return false; } - return type; }, - metricPrefixHTTP: function(type) { + metricPrefixHTTP: function (type) { if (type == 'downstream') { return 'envoy_cluster_upstream_rq'; } return 'envoy_http_downstream_rq'; }, - metricPrefixTCP: function(type) { + metricPrefixTCP: function (type) { if (type == 'downstream') { return 'envoy_cluster_upstream_cx'; } return 'envoy_tcp_downstream_cx'; }, - fetchRPS: function(serviceName, type, options) { - var sel = this.makeHTTPSelector(serviceName, type); - var subject = this.makeSubject(serviceName, type); + fetchRPS: function (service, dc, nspace, type, options) { + var sel = this.makeHTTPSelector(service, dc, nspace, type); + var subject = this.makeSubject(service, dc, nspace, type); var metricPfx = this.metricPrefixHTTP(type); var q = `sum(rate(${metricPfx}_completed{${sel}}[15m]))`; return this.fetchStat( - this.groupQueryHTTP(type, q), + this.groupQuery(type, q), 'RPS', `${subject} request rate averaged over the last 15 minutes`, shortNumStr, - this.groupBy(type) + this.groupByInfix(type) ); }, - fetchER: function(serviceName, type, options) { - var sel = this.makeHTTPSelector(serviceName, type); - var subject = this.makeSubject(serviceName, type); + fetchER: function (service, dc, nspace, type, options) { + var sel = this.makeHTTPSelector(service, dc, nspace, type); + var subject = this.makeSubject(service, dc, nspace, type); var groupBy = ''; if (type == 'upstream') { - groupBy += ' by (envoy_http_conn_manager_prefix)'; + groupBy += + ' by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)'; } else if (type == 'downstream') { - groupBy += ' by (local_cluster)'; + groupBy += ' by (consul_source_service,consul_source_datacenter,consul_source_namespace)'; } var metricPfx = this.metricPrefixHTTP(type); var q = `sum(rate(${metricPfx}_xx{${sel},envoy_response_code_class="5"}[15m]))${groupBy}/sum(rate(${metricPfx}_xx{${sel}}[15m]))${groupBy}`; - if (type == 'upstream') { - q = this.upstreamRelabelQueryHTTP(q); - } else if (type == 'downstream') { - q = this.downstreamRelabelQuery(q); - } return this.fetchStat( q, 'ER', `Percentage of ${subject} requests which were 5xx status over the last 15 minutes`, - function(val) { + function (val) { return shortNumStr(val) + '%'; }, - this.groupBy(type) + this.groupByInfix(type) ); }, - fetchPercentile: function(percentile, serviceName, type, options) { - var sel = this.makeHTTPSelector(serviceName, type); - var subject = this.makeSubject(serviceName, type); + fetchPercentile: function (percentile, service, dc, nspace, type, options) { + var sel = this.makeHTTPSelector(service, dc, nspace, type); + var subject = this.makeSubject(service, dc, nspace, type); var groupBy = 'le'; if (type == 'upstream') { - groupBy += ',envoy_http_conn_manager_prefix'; + groupBy += ',consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace'; } else if (type == 'downstream') { - groupBy += ',local_cluster'; + groupBy += ',consul_source_service,consul_source_datacenter,consul_source_namespace'; } var metricPfx = this.metricPrefixHTTP(type); var q = `histogram_quantile(${percentile / 100}, sum by(${groupBy}) (rate(${metricPfx}_time_bucket{${sel}}[15m])))`; - if (type == 'upstream') { - q = this.upstreamRelabelQueryHTTP(q); - } else if (type == 'downstream') { - q = this.downstreamRelabelQuery(q); - } return this.fetchStat( q, `P${percentile}`, `${subject} ${percentile}th percentile request service time over the last 15 minutes`, shortTimeStr, - this.groupBy(type) + this.groupByInfix(type) ); }, - fetchConnRate: function(serviceName, type, options) { - var sel = this.makeTCPSelector(serviceName, type); - var subject = this.makeSubject(serviceName, type); + fetchConnRate: function (service, dc, nspace, type, options) { + var sel = this.makeTCPSelector(service, dc, nspace, type); + var subject = this.makeSubject(service, dc, nspace, type); var metricPfx = this.metricPrefixTCP(type); var q = `sum(rate(${metricPfx}_total{${sel}}[15m]))`; return this.fetchStat( - this.groupQueryTCP(type, q), + this.groupQuery(type, q), 'CR', `${subject} inbound TCP connections per second averaged over the last 15 minutes`, shortNumStr, - this.groupBy(type) + this.groupByInfix(type) ); }, - fetchServiceRx: function(serviceName, type, options) { - var sel = this.makeTCPSelector(serviceName, type); - var subject = this.makeSubject(serviceName, type); + fetchServiceRx: function (service, dc, nspace, type, options) { + var sel = this.makeTCPSelector(service, dc, nspace, type); + var subject = this.makeSubject(service, dc, nspace, type); var metricPfx = this.metricPrefixTCP(type); var q = `8 * sum(rate(${metricPfx}_rx_bytes_total{${sel}}[15m]))`; return this.fetchStat( - this.groupQueryTCP(type, q), + this.groupQuery(type, q), 'RX', `${subject} received bits per second averaged over the last 15 minutes`, shortNumStr, - this.groupBy(type) + this.groupByInfix(type) ); }, - fetchServiceTx: function(serviceName, type, options) { - var sel = this.makeTCPSelector(serviceName, type); - var subject = this.makeSubject(serviceName, type); + fetchServiceTx: function (service, dc, nspace, type, options) { + var sel = this.makeTCPSelector(service, dc, nspace, type); + var subject = this.makeSubject(service, dc, nspace, type); var metricPfx = this.metricPrefixTCP(type); var q = `8 * sum(rate(${metricPfx}_tx_bytes_total{${sel}}[15m]))`; var self = this; return this.fetchStat( - this.groupQueryTCP(type, q), + this.groupQuery(type, q), 'TX', `${subject} transmitted bits per second averaged over the last 15 minutes`, shortNumStr, - this.groupBy(type) + this.groupByInfix(type) ); }, - fetchServiceNoRoute: function(serviceName, type, options) { - var sel = this.makeTCPSelector(serviceName, type); - var subject = this.makeSubject(serviceName, type); + fetchServiceNoRoute: function (service, dc, nspace, type, options) { + var sel = this.makeTCPSelector(service, dc, nspace, type); + var subject = this.makeSubject(service, dc, nspace, type); var metricPfx = this.metricPrefixTCP(type); var metric = '_no_route'; if (type == 'downstream') { @@ -645,16 +625,16 @@ } var q = `sum(rate(${metricPfx}${metric}{${sel}}[15m]))`; return this.fetchStat( - this.groupQueryTCP(type, q), + this.groupQuery(type, q), 'NR', `${subject} unroutable (failed) connections per second averaged over the last 15 minutes`, shortNumStr, - this.groupBy(type) + this.groupByInfix(type) ); }, - fetchStat: function(promql, label, desc, formatter, groupBy) { - if (!groupBy) { + fetchStat: function (promql, label, desc, formatter, groupByInfix) { + if (!groupByInfix) { // If we don't have a grouped result and its just a single stat, return // no result as a zero not a missing stat. promql += ' OR on() vector(0)'; @@ -663,8 +643,8 @@ query: promql, time: new Date().getTime() / 1000, }; - return this.httpGet('/api/v1/query', params).then(function(response) { - if (!groupBy) { + return this.httpGet('/api/v1/query', params).then(function (response) { + if (!groupByInfix) { // Not grouped, expect just one stat value return that var v = parseFloat(response.data.result[0].value[1]); return { @@ -678,7 +658,10 @@ for (var i = 0; i < response.data.result.length; i++) { var res = response.data.result[i]; var v = parseFloat(res.value[1]); - var groupName = res.metric[groupBy]; + var service = res.metric['consul_' + groupByInfix + '_service']; + var nspace = res.metric['consul_' + groupByInfix + '_namespace']; + var datacenter = res.metric['consul_' + groupByInfix + '_datacenter']; + var groupName = `${service}.${nspace}.${datacenter}`; data[groupName] = { label: label, desc: desc.replace('{{GROUP}}', groupName), @@ -689,7 +672,7 @@ }); }, - fetchSeries: function(promql, options) { + fetchSeries: function (promql, options) { var params = { query: promql, start: options.start, From 82e7363b90036d3f9cb4d3899dfbb87f96acfbb9 Mon Sep 17 00:00:00 2001 From: Kit Patella Date: Mon, 16 Nov 2020 15:54:50 -0800 Subject: [PATCH 06/36] Merge pull request #9198 from hashicorp/mkcp/telemetry/add-all-metric-definitions Add metric definitions for all metrics known at Consul start --- .changelog/9198.txt | 3 + agent/agent_endpoint.go | 2 +- agent/cache/cache.go | 31 ++++++ agent/catalog_endpoint.go | 118 +++++++++++++++++++- agent/config/builder.go | 5 +- agent/config/runtime_test.go | 15 ++- agent/consul/acl.go | 29 ++++- agent/consul/acl_endpoint.go | 70 +++++++++++- agent/consul/acl_endpoint_legacy.go | 8 ++ agent/consul/autopilot.go | 12 +++ agent/consul/catalog_endpoint.go | 47 ++++++++ agent/consul/client.go | 16 +++ agent/consul/config_endpoint.go | 29 +++++ agent/consul/federation_state_endpoint.go | 22 +++- agent/consul/fsm/commands_oss.go | 93 +++++++++++++++- agent/consul/fsm/snapshot.go | 8 ++ agent/consul/intention_endpoint.go | 12 +++ agent/consul/kvs_endpoint.go | 8 ++ agent/consul/leader.go | 16 +++ agent/consul/prepared_query_endpoint.go | 20 ++++ agent/consul/rpc.go | 42 ++++++++ agent/consul/segment_oss.go | 8 ++ agent/consul/server.go | 4 +- agent/consul/session_endpoint.go | 12 +++ agent/consul/session_ttl.go | 23 ++++ agent/consul/txn_endpoint.go | 12 +++ agent/consul/usagemetrics/usagemetrics.go | 17 +++ agent/dns.go | 20 ++++ agent/grpc/stats.go | 38 +++++++ agent/http.go | 8 ++ agent/local/state.go | 31 +++++- agent/setup.go | 126 ++++++++++++++++++++++ connect/proxy/proxy.go | 2 + lib/telemetry.go | 99 ++++------------- lib/telemetry_test.go | 9 ++ 35 files changed, 922 insertions(+), 93 deletions(-) create mode 100644 .changelog/9198.txt diff --git a/.changelog/9198.txt b/.changelog/9198.txt new file mode 100644 index 0000000000..3f68c3b4b8 --- /dev/null +++ b/.changelog/9198.txt @@ -0,0 +1,3 @@ +```release-note:improvement +agent: All metrics should be present and available to prometheus scrapers when Consul starts. If any non-deprecated metrics are missing please submit an issue with its name. +``` diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index 73e0f53640..49721f9125 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -136,7 +136,7 @@ func (s *HTTPHandlers) AgentMetrics(resp http.ResponseWriter, req *http.Request) return nil, acl.ErrPermissionDenied } if enablePrometheusOutput(req) { - if s.agent.config.Telemetry.PrometheusRetentionTime < 1 { + if s.agent.config.Telemetry.PrometheusOpts.Expiration < 1 { resp.WriteHeader(http.StatusUnsupportedMediaType) fmt.Fprint(resp, "Prometheus is not enabled since its retention time is not positive") return nil, nil diff --git a/agent/cache/cache.go b/agent/cache/cache.go index 1a5193792b..62dc8619ba 100644 --- a/agent/cache/cache.go +++ b/agent/cache/cache.go @@ -24,6 +24,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "golang.org/x/time/rate" "github.com/hashicorp/consul/lib" @@ -32,6 +33,34 @@ import ( //go:generate mockery -all -inpkg +// TODO(kit): remove the namespace from these once the metrics themselves change +var Gauges = []prometheus.GaugeDefinition{ + { + Name: []string{"consul", "cache", "entries_count"}, + Help: "", + }, +} + +// TODO(kit): remove the namespace from these once the metrics themselves change +var Counters = []prometheus.CounterDefinition{ + { + Name: []string{"consul", "cache", "bypass"}, + Help: "", + }, + { + Name: []string{"consul", "cache", "fetch_success"}, + Help: "", + }, + { + Name: []string{"consul", "cache", "fetch_error"}, + Help: "", + }, + { + Name: []string{"consul", "cache", "evict_expired"}, + Help: "", + }, +} + // Constants related to refresh backoff. We probably don't ever need to // make these configurable knobs since they primarily exist to lower load. const ( @@ -629,6 +658,7 @@ func (c *Cache) fetch(key string, r getOptions, allowNew bool, attempt uint, ign // Error handling if err == nil { labels := []metrics.Label{{Name: "result_not_modified", Value: strconv.FormatBool(result.NotModified)}} + // TODO(kit): move tEntry.Name to a label on the first write here and deprecate the second write metrics.IncrCounterWithLabels([]string{"consul", "cache", "fetch_success"}, 1, labels) metrics.IncrCounterWithLabels([]string{"consul", "cache", tEntry.Name, "fetch_success"}, 1, labels) @@ -658,6 +688,7 @@ func (c *Cache) fetch(key string, r getOptions, allowNew bool, attempt uint, ign newEntry.RefreshLostContact = time.Time{} } } else { + // TODO(kit): Add tEntry.Name to label on fetch_error and deprecate second write metrics.IncrCounter([]string{"consul", "cache", "fetch_error"}, 1) metrics.IncrCounter([]string{"consul", "cache", tEntry.Name, "fetch_error"}, 1) diff --git a/agent/catalog_endpoint.go b/agent/catalog_endpoint.go index 60c5fc3449..188c1bfb20 100644 --- a/agent/catalog_endpoint.go +++ b/agent/catalog_endpoint.go @@ -5,11 +5,127 @@ import ( "net/http" "strings" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" cachetype "github.com/hashicorp/consul/agent/cache-types" "github.com/hashicorp/consul/agent/structs" ) +var CatalogCounters = []prometheus.CounterDefinition{ + { + Name: []string{"client", "api", "catalog_register"}, + Help: "Increments whenever a Consul agent receives a catalog register request.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_register"}, + Help: "Increments whenever a Consul agent receives an RPC error for a catalog register request.", + }, + { + Name: []string{"client", "api", "success", "catalog_register"}, + Help: "Increments whenever a Consul agent successfully responds to a catalog register request.", + }, + { + Name: []string{"client", "api", "catalog_deregister"}, + Help: "Increments whenever a Consul agent receives a catalog deregister request.", + }, + { + Name: []string{"client", "api", "catalog_datacenters"}, + Help: "Increments whenever a Consul agent receives a request to list datacenters in the catalog.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_deregister"}, + Help: "Increments whenever a Consul agent receives an RPC error for a catalog deregister request.", + }, + { + Name: []string{"client", "api", "success", "catalog_nodes"}, + Help: "Increments whenever a Consul agent successfully responds to a request to list nodes.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_nodes"}, + Help: "Increments whenever a Consul agent receives an RPC error for a request to list nodes.", + }, + { + Name: []string{"client", "api", "success", "catalog_deregister"}, + Help: "Increments whenever a Consul agent successfully responds to a catalog deregister request.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_datacenters"}, + Help: "Increments whenever a Consul agent receives an RPC error for a request to list datacenters.", + }, + { + Name: []string{"client", "api", "success", "catalog_datacenters"}, + Help: "Increments whenever a Consul agent successfully responds to a request to list datacenters.", + }, + { + Name: []string{"client", "api", "catalog_nodes"}, + Help: "Increments whenever a Consul agent receives a request to list nodes from the catalog.", + }, + { + Name: []string{"client", "api", "catalog_services"}, + Help: "Increments whenever a Consul agent receives a request to list services from the catalog.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_services"}, + Help: "Increments whenever a Consul agent receives an RPC error for a request to list services.", + }, + { + Name: []string{"client", "api", "success", "catalog_services"}, + Help: "Increments whenever a Consul agent successfully responds to a request to list services.", + }, + { + Name: []string{"client", "api", "catalog_service_nodes"}, + Help: "Increments whenever a Consul agent receives a request to list nodes offering a service.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_service_nodes"}, + Help: "Increments whenever a Consul agent receives an RPC error for a request to list nodes offering a service.", + }, + { + Name: []string{"client", "api", "success", "catalog_service_nodes"}, + Help: "Increments whenever a Consul agent successfully responds to a request to list nodes offering a service.", + }, + { + Name: []string{"client", "api", "error", "catalog_service_nodes"}, + Help: "", + }, + { + Name: []string{"client", "api", "catalog_node_services"}, + Help: "Increments whenever a Consul agent successfully responds to a request to list nodes offering a service.", + }, + { + Name: []string{"client", "api", "success", "catalog_node_services"}, + Help: "Increments whenever a Consul agent successfully responds to a request to list services in a node.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_node_services"}, + Help: "Increments whenever a Consul agent receives an RPC error for a request to list services in a node.", + }, + { + Name: []string{"client", "api", "catalog_node_service_list"}, + Help: "", + }, + { + Name: []string{"client", "rpc", "error", "catalog_node_service_list"}, + Help: "", + }, + { + Name: []string{"client", "api", "success", "catalog_node_service_list"}, + Help: "", + }, + { + Name: []string{"client", "api", "catalog_gateway_services"}, + Help: "Increments whenever a Consul agent receives a request to list services associated with a gateway.", + }, + { + Name: []string{"client", "rpc", "error", "catalog_gateway_services"}, + Help: "Increments whenever a Consul agent receives an RPC error for a request to list services associated with a gateway.", + }, + { + Name: []string{"client", "api", "success", "catalog_gateway_services"}, + Help: "Increments whenever a Consul agent successfully responds to a request to list services associated with a gateway.", + }, +} + func (s *HTTPHandlers) CatalogRegister(resp http.ResponseWriter, req *http.Request) (interface{}, error) { metrics.IncrCounterWithLabels([]string{"client", "api", "catalog_register"}, 1, []metrics.Label{{Name: "node", Value: s.nodeName()}}) diff --git a/agent/config/builder.go b/agent/config/builder.go index 1c1798dc76..062fb440f7 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -17,6 +17,7 @@ import ( "strings" "time" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/go-bexpr" "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-multierror" @@ -942,13 +943,15 @@ func (b *Builder) Build() (rt RuntimeConfig, err error) { DisableHostname: b.boolVal(c.Telemetry.DisableHostname), DogstatsdAddr: b.stringVal(c.Telemetry.DogstatsdAddr), DogstatsdTags: c.Telemetry.DogstatsdTags, - PrometheusRetentionTime: b.durationVal("prometheus_retention_time", c.Telemetry.PrometheusRetentionTime), FilterDefault: b.boolVal(c.Telemetry.FilterDefault), AllowedPrefixes: telemetryAllowedPrefixes, BlockedPrefixes: telemetryBlockedPrefixes, MetricsPrefix: b.stringVal(c.Telemetry.MetricsPrefix), StatsdAddr: b.stringVal(c.Telemetry.StatsdAddr), StatsiteAddr: b.stringVal(c.Telemetry.StatsiteAddr), + PrometheusOpts: prometheus.PrometheusOpts{ + Expiration: b.durationVal("prometheus_retention_time", c.Telemetry.PrometheusRetentionTime), + }, }, // Agent diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index aba609ec16..2dff70d1bf 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -18,6 +18,7 @@ import ( "testing" "time" + "github.com/armon/go-metrics/prometheus" "github.com/stretchr/testify/require" "github.com/hashicorp/consul/agent/cache" @@ -7103,9 +7104,11 @@ func TestFullConfig(t *testing.T) { AllowedPrefixes: []string{"oJotS8XJ"}, BlockedPrefixes: []string{"cazlEhGn"}, MetricsPrefix: "ftO6DySn", - PrometheusRetentionTime: 15 * time.Second, StatsdAddr: "drce87cy", StatsiteAddr: "HpFwKB8R", + PrometheusOpts: prometheus.PrometheusOpts{ + Expiration: 15 * time.Second, + }, }, TLSCipherSuites: []uint16{tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256}, TLSMinVersion: "pAOWafkR", @@ -7814,9 +7817,15 @@ func TestSanitize(t *testing.T) { "DogstatsdTags": [], "FilterDefault": false, "MetricsPrefix": "", - "PrometheusRetentionTime": "0s", "StatsdAddr": "", - "StatsiteAddr": "" + "StatsiteAddr": "", + "PrometheusOpts": { + "Expiration": "0s", + "Registerer": null, + "GaugeDefinitions": [], + "CounterDefinitions": [], + "SummaryDefinitions": [] + } }, "TranslateWANAddrs": false, "TxnMaxReqLen": 5678000000000000, diff --git a/agent/consul/acl.go b/agent/consul/acl.go index 7796c3756c..1ec7bc4193 100644 --- a/agent/consul/acl.go +++ b/agent/consul/acl.go @@ -6,7 +6,8 @@ import ( "sync" "time" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/logging" @@ -15,6 +16,32 @@ import ( "golang.org/x/time/rate" ) +var ACLCounters = []prometheus.CounterDefinition{ + { + Name: []string{"acl", "token", "cache_hit"}, + Help: "", + }, + { + Name: []string{"acl", "token", "cache_miss"}, + Help: "", + }, +} + +var ACLSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"acl", "resolveTokenLegacy"}, + Help: "", + }, + { + Name: []string{"acl", "ResolveToken"}, + Help: "", + }, + { + Name: []string{"acl", "ResolveTokenToIdentity"}, + Help: "", + }, +} + // These must be kept in sync with the constants in command/agent/acl.go. const ( // anonymousToken is the token ID we re-write to if there is no token ID diff --git a/agent/consul/acl_endpoint.go b/agent/consul/acl_endpoint.go index ccc9e1b2af..b8ba08e0b2 100644 --- a/agent/consul/acl_endpoint.go +++ b/agent/consul/acl_endpoint.go @@ -11,7 +11,8 @@ import ( "regexp" "time" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/authmethod" "github.com/hashicorp/consul/agent/consul/state" @@ -30,6 +31,73 @@ const ( aclBootstrapReset = "acl-bootstrap-reset" ) +var ACLEndpointSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"acl", "token", "clone"}, + Help: "", + }, + { + Name: []string{"acl", "token", "upsert"}, + Help: "", + }, + { + Name: []string{"acl", "token", "delete"}, + Help: "", + }, + { + Name: []string{"acl", "policy", "upsert"}, + Help: "", + }, + { + Name: []string{"acl", "policy", "delete"}, + Help: "", + }, + { + Name: []string{"acl", "policy", "delete"}, + Help: "", + }, + { + Name: []string{"acl", "role", "upsert"}, + Help: "", + }, + { + Name: []string{"acl", "role", "delete"}, + Help: "", + }, + { + Name: []string{"acl", "bindingrule", "upsert"}, + Help: "", + }, + { + Name: []string{"acl", "bindingrule", "delete"}, + Help: "", + }, + { + Name: []string{"acl", "authmethod", "upsert"}, + Help: "", + }, + { + Name: []string{"acl", "authmethod", "delete"}, + Help: "", + }, + { + Name: []string{"acl", "login"}, + Help: "", + }, + { + Name: []string{"acl", "login"}, + Help: "", + }, + { + Name: []string{"acl", "logout"}, + Help: "", + }, + { + Name: []string{"acl", "logout"}, + Help: "", + }, +} + // Regex for matching var ( validPolicyName = regexp.MustCompile(`^[A-Za-z0-9\-_]{1,128}$`) diff --git a/agent/consul/acl_endpoint_legacy.go b/agent/consul/acl_endpoint_legacy.go index 22838aca0d..9cdfba668b 100644 --- a/agent/consul/acl_endpoint_legacy.go +++ b/agent/consul/acl_endpoint_legacy.go @@ -5,6 +5,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/structs" @@ -12,6 +13,13 @@ import ( "github.com/hashicorp/go-memdb" ) +var ACLEndpointLegacySummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"acl", "apply"}, + Help: "Measures the time it takes to complete an update to the ACL store.", + }, +} + // Bootstrap is used to perform a one-time ACL bootstrap operation on // a cluster to get the first management token. func (a *ACL) Bootstrap(args *structs.DCSpecificRequest, reply *structs.ACL) error { diff --git a/agent/consul/autopilot.go b/agent/consul/autopilot.go index dc5aa5da70..cc6cf62302 100644 --- a/agent/consul/autopilot.go +++ b/agent/consul/autopilot.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/agent/metadata" "github.com/hashicorp/consul/types" "github.com/hashicorp/raft" @@ -12,6 +13,17 @@ import ( "github.com/hashicorp/serf/serf" ) +var AutopilotGauges = []prometheus.GaugeDefinition{ + { + Name: []string{"autopilot", "failure_tolerance"}, + Help: "Tracks the number of voting servers that the cluster can lose while continuing to function.", + }, + { + Name: []string{"autopilot", "healthy"}, + Help: "Tracks the overall health of the local server cluster. 1 if all servers are healthy, 0 if one or more are unhealthy.", + }, +} + // AutopilotDelegate is a Consul delegate for autopilot operations. type AutopilotDelegate struct { server *Server diff --git a/agent/consul/catalog_endpoint.go b/agent/consul/catalog_endpoint.go index 04be323cb5..f5d5b5633d 100644 --- a/agent/consul/catalog_endpoint.go +++ b/agent/consul/catalog_endpoint.go @@ -6,6 +6,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/structs" @@ -17,6 +18,52 @@ import ( "github.com/hashicorp/go-uuid" ) +var CatalogCounters = []prometheus.CounterDefinition{ + { + Name: []string{"catalog", "service", "query"}, + Help: "Increments for each catalog query for the given service.", + }, + { + Name: []string{"catalog", "connect", "query"}, + Help: "", + }, + { + Name: []string{"catalog", "service", "query-tag"}, + Help: "Increments for each catalog query for the given service with the given tag.", + }, + { + Name: []string{"catalog", "connect", "query-tag"}, + Help: "", + }, + { + Name: []string{"catalog", "service", "query-tags"}, + Help: "Increments for each catalog query for the given service with the given tags.", + }, + { + Name: []string{"catalog", "connect", "query-tags"}, + Help: "", + }, + { + Name: []string{"catalog", "service", "not-found"}, + Help: "Increments for each catalog query where the given service could not be found.", + }, + { + Name: []string{"catalog", "connect", "not-found"}, + Help: "", + }, +} + +var CatalogSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"catalog", "deregister"}, + Help: "Measures the time it takes to complete a catalog deregister operation.", + }, + { + Name: []string{"catalog", "register"}, + Help: "Measures the time it takes to complete a catalog register operation.", + }, +} + // Catalog endpoint is used to manipulate the service catalog type Catalog struct { srv *Server diff --git a/agent/consul/client.go b/agent/consul/client.go index b4cf90759b..d2ae9a1edd 100644 --- a/agent/consul/client.go +++ b/agent/consul/client.go @@ -9,6 +9,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/agent/pool" "github.com/hashicorp/consul/agent/router" "github.com/hashicorp/consul/agent/structs" @@ -21,6 +22,21 @@ import ( "golang.org/x/time/rate" ) +var ClientCounters = []prometheus.CounterDefinition{ + { + Name: []string{"client", "rpc"}, + Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server.", + }, + { + Name: []string{"client", "rpc", "exceeded"}, + Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server gets rate limited by that agent's limits configuration.", + }, + { + Name: []string{"client", "rpc", "failed"}, + Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server and fails.", + }, +} + const ( // serfEventBacklog is the maximum number of unprocessed Serf Events // that will be held in queue before new serf events block. A diff --git a/agent/consul/config_endpoint.go b/agent/consul/config_endpoint.go index 3d3c0ff354..b2529133d5 100644 --- a/agent/consul/config_endpoint.go +++ b/agent/consul/config_endpoint.go @@ -4,6 +4,8 @@ import ( "fmt" "time" + "github.com/armon/go-metrics/prometheus" + metrics "github.com/armon/go-metrics" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" @@ -12,6 +14,33 @@ import ( "github.com/mitchellh/copystructure" ) +var ConfigSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"config_entry", "apply"}, + Help: "", + }, + { + Name: []string{"config_entry", "get"}, + Help: "", + }, + { + Name: []string{"config_entry", "list"}, + Help: "", + }, + { + Name: []string{"config_entry", "listAll"}, + Help: "", + }, + { + Name: []string{"config_entry", "delete"}, + Help: "", + }, + { + Name: []string{"config_entry", "resolve_service_config"}, + Help: "", + }, +} + // The ConfigEntry endpoint is used to query centralized config information type ConfigEntry struct { srv *Server diff --git a/agent/consul/federation_state_endpoint.go b/agent/consul/federation_state_endpoint.go index a98ab83e8f..88111364c1 100644 --- a/agent/consul/federation_state_endpoint.go +++ b/agent/consul/federation_state_endpoint.go @@ -5,13 +5,33 @@ import ( "fmt" "time" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/structs" memdb "github.com/hashicorp/go-memdb" ) +var FederationStateSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"federation_state", "apply"}, + Help: "", + }, + { + Name: []string{"federation_state", "get"}, + Help: "", + }, + { + Name: []string{"federation_state", "list"}, + Help: "", + }, + { + Name: []string{"federation_state", "list_mesh_gateways"}, + Help: "", + }, +} + var ( errFederationStatesNotEnabled = errors.New("Federation states are currently disabled until all servers in the datacenter support the feature") ) diff --git a/agent/consul/fsm/commands_oss.go b/agent/consul/fsm/commands_oss.go index a914009a4d..fae5eb1a81 100644 --- a/agent/consul/fsm/commands_oss.go +++ b/agent/consul/fsm/commands_oss.go @@ -4,11 +4,102 @@ import ( "fmt" "time" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/api" ) +var CommandsSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"fsm", "register"}, + Help: "Measures the time it takes to apply a catalog register operation to the FSM.", + }, + { + Name: []string{"fsm", "deregister"}, + Help: "Measures the time it takes to apply a catalog deregister operation to the FSM.", + }, + { + Name: []string{"fsm", "kvs"}, + Help: "Measures the time it takes to apply the given KV operation to the FSM.", + }, + { + Name: []string{"fsm", "session"}, + Help: "Measures the time it takes to apply the given session operation to the FSM.", + }, + { + Name: []string{"fsm", "acl"}, + Help: "Measures the time it takes to apply the given ACL operation to the FSM.", + }, + { + Name: []string{"fsm", "tombstone"}, + Help: "Measures the time it takes to apply the given tombstone operation to the FSM.", + }, + { + Name: []string{"fsm", "coordinate", "batch-update"}, + Help: "Measures the time it takes to apply the given batch coordinate update to the FSM.", + }, + { + Name: []string{"fsm", "prepared-query"}, + Help: "Measures the time it takes to apply the given prepared query update operation to the FSM.", + }, + { + Name: []string{"fsm", "txn"}, + Help: "Measures the time it takes to apply the given transaction update to the FSM.", + }, + { + Name: []string{"fsm", "autopilot"}, + Help: "Measures the time it takes to apply the given autopilot update to the FSM.", + }, + { + Name: []string{"consul", "fsm", "intention"}, + Help: "", + }, + { + Name: []string{"fsm", "intention"}, + Help: "", + }, + { + Name: []string{"consul", "fsm", "ca"}, + Help: "", + }, + { + Name: []string{"fsm", "ca", "leaf"}, + Help: "", + }, + { + Name: []string{"fsm", "acl", "token"}, + Help: "", + }, + { + Name: []string{"fsm", "ca", "leaf"}, + Help: "", + }, + { + Name: []string{"fsm", "acl", "policy"}, + Help: "", + }, + { + Name: []string{"fsm", "acl", "bindingrule"}, + Help: "", + }, + { + Name: []string{"fsm", "acl", "authmethod"}, + Help: "", + }, + { + Name: []string{"fsm", "system_metadata"}, + Help: "", + }, + // TODO(kit): We generate the config-entry fsm summaries by reading off of the request. It is + // possible to statically declare these when we know all of the names, but I didn't get to it + // in this patch. Config-entries are known though and we should add these in the future. + // { + // Name: []string{"fsm", "config_entry", req.Entry.GetKind()}, + // Help: "", + // }, +} + func init() { registerCommand(structs.RegisterRequestType, (*FSM).applyRegister) registerCommand(structs.DeregisterRequestType, (*FSM).applyDeregister) diff --git a/agent/consul/fsm/snapshot.go b/agent/consul/fsm/snapshot.go index e4c9c0bb45..696ca56453 100644 --- a/agent/consul/fsm/snapshot.go +++ b/agent/consul/fsm/snapshot.go @@ -5,6 +5,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/go-msgpack/codec" @@ -12,6 +13,13 @@ import ( "github.com/hashicorp/raft" ) +var SnapshotSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"fsm", "persist"}, + Help: "Measures the time it takes to persist the FSM to a raft snapshot.", + }, +} + // snapshot is used to provide a snapshot of the current // state in a way that can be accessed concurrently with operations // that may modify the live state. diff --git a/agent/consul/intention_endpoint.go b/agent/consul/intention_endpoint.go index 9b1931e00f..d96e17c268 100644 --- a/agent/consul/intention_endpoint.go +++ b/agent/consul/intention_endpoint.go @@ -6,6 +6,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/connect" "github.com/hashicorp/consul/agent/consul/state" @@ -16,6 +17,17 @@ import ( "github.com/hashicorp/go-memdb" ) +var IntentionSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"consul", "intention", "apply"}, + Help: "", + }, + { + Name: []string{"intention", "apply"}, + Help: "", + }, +} + var ( // ErrIntentionNotFound is returned if the intention lookup failed. ErrIntentionNotFound = errors.New("Intention not found") diff --git a/agent/consul/kvs_endpoint.go b/agent/consul/kvs_endpoint.go index 04dee57b62..c6aee93805 100644 --- a/agent/consul/kvs_endpoint.go +++ b/agent/consul/kvs_endpoint.go @@ -6,6 +6,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/structs" @@ -14,6 +15,13 @@ import ( "github.com/hashicorp/go-memdb" ) +var KVSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"kvs", "apply"}, + Help: "Measures the time it takes to complete an update to the KV store.", + }, +} + // KVS endpoint is used to manipulate the Key-Value store type KVS struct { srv *Server diff --git a/agent/consul/leader.go b/agent/consul/leader.go index a1d90131ae..d050e297b4 100644 --- a/agent/consul/leader.go +++ b/agent/consul/leader.go @@ -11,6 +11,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/metadata" "github.com/hashicorp/consul/agent/structs" @@ -27,6 +28,21 @@ import ( "golang.org/x/time/rate" ) +var LeaderSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"leader", "barrier"}, + Help: "Measures the time spent waiting for the raft barrier upon gaining leadership.", + }, + { + Name: []string{"leader", "reconcileMember"}, + Help: "Measures the time spent updating the raft store for a single serf member's information.", + }, + { + Name: []string{"leader", "reapTombstones"}, + Help: "Measures the time spent clearing tombstones.", + }, +} + const ( newLeaderEvent = "consul:new-leader" barrierWriteTimeout = 2 * time.Minute diff --git a/agent/consul/prepared_query_endpoint.go b/agent/consul/prepared_query_endpoint.go index bb13ff3cb3..360c80b9b7 100644 --- a/agent/consul/prepared_query_endpoint.go +++ b/agent/consul/prepared_query_endpoint.go @@ -6,6 +6,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/structs" @@ -15,6 +16,25 @@ import ( "github.com/hashicorp/go-uuid" ) +var PreparedQuerySummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"prepared-query", "apply"}, + Help: "Measures the time it takes to apply a prepared query update.", + }, + { + Name: []string{"prepared-query", "explain"}, + Help: "Measures the time it takes to process a prepared query explain request.", + }, + { + Name: []string{"prepared-query", "execute"}, + Help: "Measures the time it takes to process a prepared query execute request.", + }, + { + Name: []string{"prepared-query", "execute_remote"}, + Help: "Measures the time it takes to process a prepared query execute request that was forwarded to another datacenter.", + }, +} + // PreparedQuery manages the prepared query endpoint. type PreparedQuery struct { srv *Server diff --git a/agent/consul/rpc.go b/agent/consul/rpc.go index ac1096292b..82a656a3a4 100644 --- a/agent/consul/rpc.go +++ b/agent/consul/rpc.go @@ -13,6 +13,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/consul/wanfed" @@ -31,6 +32,47 @@ import ( "github.com/hashicorp/yamux" ) +var RPCCounters = []prometheus.CounterDefinition{ + { + Name: []string{"rpc", "accept_conn"}, + Help: "Increments when a server accepts an RPC connection.", + }, + { + Name: []string{"rpc", "raft_handoff"}, + Help: "Increments when a server accepts a Raft-related RPC connection.", + }, + { + Name: []string{"rpc", "request_error"}, + Help: "Increments when a server returns an error from an RPC request.", + }, + { + Name: []string{"rpc", "request"}, + Help: "Increments when a server receives a Consul-related RPC request.", + }, + { + Name: []string{"rpc", "cross-dc"}, + Help: "Increments when a server sends a (potentially blocking) cross datacenter RPC query.", + }, + { + Name: []string{"rpc", "query"}, + Help: "Increments when a server receives a new blocking RPC request, indicating the rate of new blocking query calls.", + }, +} + +var RPCGauges = []prometheus.GaugeDefinition{ + { + Name: []string{"rpc", "queries_blocking"}, + Help: "Shows the current number of in-flight blocking queries the server is handling.", + }, +} + +var RPCSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"rpc", "consistentRead"}, + Help: "Measures the time spent confirming that a consistent read can be performed.", + }, +} + const ( // jitterFraction is a the limit to the amount of jitter we apply // to a user specified MaxQueryTime. We divide the specified time by diff --git a/agent/consul/segment_oss.go b/agent/consul/segment_oss.go index 11b06b6959..690132c347 100644 --- a/agent/consul/segment_oss.go +++ b/agent/consul/segment_oss.go @@ -7,10 +7,18 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/serf/serf" ) +var SegmentOSSSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"leader", "reconcile"}, + Help: "Measures the time spent updating the raft store from the serf member information.", + }, +} + // LANMembersAllSegments returns members from all segments. func (s *Server) LANMembersAllSegments() ([]serf.Member, error) { return s.LANMembers(), nil diff --git a/agent/consul/server.go b/agent/consul/server.go index 13fece4060..5db589d3a1 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -17,7 +17,7 @@ import ( "sync/atomic" "time" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" connlimit "github.com/hashicorp/go-connlimit" "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-memdb" @@ -50,6 +50,8 @@ import ( "github.com/hashicorp/consul/types" ) +// NOTE The "consul.client.rpc" and "consul.client.rpc.exceeded" counters are defined in consul/client.go + // These are the protocol versions that Consul can _understand_. These are // Consul-level protocol versions, that are used to configure the Serf // protocol versions. diff --git a/agent/consul/session_endpoint.go b/agent/consul/session_endpoint.go index 3ac8b41dc0..d3d3604883 100644 --- a/agent/consul/session_endpoint.go +++ b/agent/consul/session_endpoint.go @@ -5,6 +5,7 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/agent/structs" @@ -13,6 +14,17 @@ import ( "github.com/hashicorp/go-uuid" ) +var SessionEndpointSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"session", "apply"}, + Help: "Measures the time spent applying a session update.", + }, + { + Name: []string{"session", "renew"}, + Help: "Measures the time spent renewing a session.", + }, +} + // Session endpoint is used to manipulate sessions for KV type Session struct { srv *Server diff --git a/agent/consul/session_ttl.go b/agent/consul/session_ttl.go index 4afdc0e382..15c77a24a2 100644 --- a/agent/consul/session_ttl.go +++ b/agent/consul/session_ttl.go @@ -5,9 +5,32 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/agent/structs" ) +var SessionGauges = []prometheus.GaugeDefinition{ + { + Name: []string{"session_ttl", "active"}, + Help: "Tracks the active number of sessions being tracked.", + }, + { + Name: []string{"raft", "applied_index"}, + Help: "", + }, + { + Name: []string{"raft", "last_index"}, + Help: "", + }, +} + +var SessionSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"session_ttl", "invalidate"}, + Help: "Measures the time spent invalidating an expired session.", + }, +} + const ( // maxInvalidateAttempts limits how many invalidate attempts are made maxInvalidateAttempts = 6 diff --git a/agent/consul/txn_endpoint.go b/agent/consul/txn_endpoint.go index 9819d63704..9febc8b89f 100644 --- a/agent/consul/txn_endpoint.go +++ b/agent/consul/txn_endpoint.go @@ -5,12 +5,24 @@ import ( "time" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/api" "github.com/hashicorp/go-hclog" ) +var TxnSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"txn", "apply"}, + Help: "Measures the time spent applying a transaction operation.", + }, + { + Name: []string{"txn", "read"}, + Help: "Measures the time spent returning a read transaction.", + }, +} + // Txn endpoint is used to perform multi-object atomic transactions. type Txn struct { srv *Server diff --git a/agent/consul/usagemetrics/usagemetrics.go b/agent/consul/usagemetrics/usagemetrics.go index 259c6646e1..da09890e5f 100644 --- a/agent/consul/usagemetrics/usagemetrics.go +++ b/agent/consul/usagemetrics/usagemetrics.go @@ -5,12 +5,29 @@ import ( "errors" "time" + "github.com/armon/go-metrics/prometheus" + "github.com/armon/go-metrics" "github.com/hashicorp/consul/agent/consul/state" "github.com/hashicorp/consul/logging" "github.com/hashicorp/go-hclog" ) +var Gauges = []prometheus.GaugeDefinition{ + { + Name: []string{"consul", "state", "nodes"}, + Help: "Measures the current number of nodes registered with Consul. It is only emitted by Consul servers. Added in v1.9.0.", + }, + { + Name: []string{"consul", "state", "services"}, + Help: "Measures the current number of unique services registered with Consul, based on service name. It is only emitted by Consul servers. Added in v1.9.0.", + }, + { + Name: []string{"consul", "state", "service_instances"}, + Help: "Measures the current number of unique services registered with Consul, based on service name. It is only emitted by Consul servers. Added in v1.9.0.", + }, +} + // Config holds the settings for various parameters for the // UsageMetricsReporter type Config struct { diff --git a/agent/dns.go b/agent/dns.go index a9063e26f4..d8e20003dd 100644 --- a/agent/dns.go +++ b/agent/dns.go @@ -10,6 +10,8 @@ import ( "sync/atomic" "time" + "github.com/armon/go-metrics/prometheus" + metrics "github.com/armon/go-metrics" radix "github.com/armon/go-radix" "github.com/coredns/coredns/plugin/pkg/dnsutil" @@ -26,6 +28,24 @@ import ( "github.com/hashicorp/consul/logging" ) +var DNSCounters = []prometheus.CounterDefinition{ + { + Name: []string{"dns", "stale_queries"}, + Help: "Increments when an agent serves a query within the allowed stale threshold.", + }, +} + +var DNSSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"dns", "ptr_query"}, + Help: "Measures the time spent handling a reverse DNS query for the given node.", + }, + { + Name: []string{"dns", "domain_query"}, + Help: "Measures the time spent handling a domain query for the given node.", + }, +} + const ( // UDP can fit ~25 A records in a 512B response, and ~14 AAAA // records. Limit further to prevent unintentional configuration diff --git a/agent/grpc/stats.go b/agent/grpc/stats.go index eeb8eb379d..7ba96f91f4 100644 --- a/agent/grpc/stats.go +++ b/agent/grpc/stats.go @@ -5,10 +5,48 @@ import ( "sync/atomic" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "google.golang.org/grpc" "google.golang.org/grpc/stats" ) +var StatsGauges = []prometheus.GaugeDefinition{ + { + Name: []string{"grpc", "server", "connections"}, + Help: "Measures the number of active gRPC connections open on the server.", + }, + { + Name: []string{"grpc", "client", "connections"}, + Help: "Measures the number of active gRPC connections open from the client agent to any Consul servers.", + }, + { + Name: []string{"grpc", "server", "streams"}, + Help: "Measures the number of active gRPC streams handled by the server.", + }, +} +var StatsCounters = []prometheus.CounterDefinition{ + { + Name: []string{"grpc", "client", "request", "count"}, + Help: "Counts the number of gRPC requests made by the client agent to a Consul server.", + }, + { + Name: []string{"grpc", "server", "request", "count"}, + Help: "Counts the number of gRPC requests received by the server.", + }, + { + Name: []string{"grpc", "client", "connection", "count"}, + Help: "Counts the number of new gRPC connections opened by the client agent to a Consul server.", + }, + { + Name: []string{"grpc", "server", "connection", "count"}, + Help: "Counts the number of new gRPC connections received by the server.", + }, + { + Name: []string{"grpc", "server", "stream", "count"}, + Help: "Counts the number of new gRPC streams received by the server.", + }, +} + var defaultMetrics = metrics.Default // statsHandler is a grpc/stats.StatsHandler which emits connection and diff --git a/agent/http.go b/agent/http.go index c1c2b5b1a9..93c6cdc8f7 100644 --- a/agent/http.go +++ b/agent/http.go @@ -17,6 +17,7 @@ import ( "github.com/NYTimes/gziphandler" "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/cache" "github.com/hashicorp/consul/agent/config" @@ -31,6 +32,13 @@ import ( "github.com/pkg/errors" ) +var HTTPSummaries = []prometheus.SummaryDefinition{ + { + Name: []string{"api", "http"}, + Help: "Samples how long it takes to service the given HTTP request for the given verb and path.", + }, +} + // MethodNotAllowedError should be returned by a handler when the HTTP method is not allowed. type MethodNotAllowedError struct { Method string diff --git a/agent/local/state.go b/agent/local/state.go index be0c481f3d..b4414e9109 100644 --- a/agent/local/state.go +++ b/agent/local/state.go @@ -9,8 +9,8 @@ import ( "sync/atomic" "time" - metrics "github.com/armon/go-metrics" - + "github.com/armon/go-metrics" + "github.com/armon/go-metrics/prometheus" "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/agent/token" @@ -20,6 +20,33 @@ import ( "github.com/hashicorp/go-hclog" ) +var StateCounters = []prometheus.CounterDefinition{ + { + Name: []string{"acl", "blocked", "service", "registration"}, + Help: "Increments whenever a registration fails for a service (blocked by an ACL)", + }, + { + Name: []string{"acl", "blocked", "service", "deregistration"}, + Help: "Increments whenever a deregistration fails for a service (blocked by an ACL)", + }, + { + Name: []string{"acl", "blocked", "check", "registration"}, + Help: "Increments whenever a registration fails for a check (blocked by an ACL)", + }, + { + Name: []string{"acl", "blocked", "check", "deregistration"}, + Help: "Increments whenever a deregistration fails for a check (blocked by an ACL)", + }, + { + Name: []string{"acl", "blocked", "node", "registration"}, + Help: "Increments whenever a registration fails for a node (blocked by an ACL)", + }, + { + Name: []string{"acl", "blocked", "node", "deregistration"}, + Help: "Increments whenever a deregistration fails for a node (blocked by an ACL)", + }, +} + const fullSyncReadMaxStale = 2 * time.Second // Config is the configuration for the State. diff --git a/agent/setup.go b/agent/setup.go index 96265ef24a..9efc565c92 100644 --- a/agent/setup.go +++ b/agent/setup.go @@ -8,6 +8,12 @@ import ( "sync" "time" + "github.com/hashicorp/consul/agent/consul/fsm" + + "github.com/armon/go-metrics/prometheus" + "github.com/hashicorp/consul/agent/consul/usagemetrics" + "github.com/hashicorp/consul/agent/local" + "github.com/hashicorp/go-hclog" "google.golang.org/grpc/grpclog" grpcresolver "google.golang.org/grpc/resolver" @@ -72,6 +78,10 @@ func NewBaseDeps(configLoader ConfigLoader, logOut io.Writer) (BaseDeps, error) return d, fmt.Errorf("failed to setup node ID: %w", err) } + gauges, counters, summaries := getPrometheusDefs(cfg.Telemetry) + cfg.Telemetry.PrometheusOpts.GaugeDefinitions = gauges + cfg.Telemetry.PrometheusOpts.CounterDefinitions = counters + cfg.Telemetry.PrometheusOpts.SummaryDefinitions = summaries d.MetricsHandler, err = lib.InitTelemetry(cfg.Telemetry) if err != nil { return d, fmt.Errorf("failed to initialize telemetry: %w", err) @@ -177,3 +187,119 @@ func registerWithGRPC(b grpcresolver.Builder) { defer registerLock.Unlock() grpcresolver.Register(b) } + +// getPrometheusDefs reaches into every slice of prometheus defs we've defined in each part of the agent, and appends +// all of our slices into one nice slice of definitions per metric type for the Consul agent to pass to go-metrics. +func getPrometheusDefs(cfg lib.TelemetryConfig) ([]prometheus.GaugeDefinition, []prometheus.CounterDefinition, []prometheus.SummaryDefinition) { + // Build slice of slices for all gauge definitions + var gauges = [][]prometheus.GaugeDefinition{ + cache.Gauges, + consul.AutopilotGauges, + consul.RPCGauges, + consul.SessionGauges, + grpc.StatsGauges, + usagemetrics.Gauges, + } + // Flatten definitions + // NOTE(kit): Do we actually want to create a set here so we can ensure definition names are unique? + var gaugeDefs []prometheus.GaugeDefinition + for _, g := range gauges { + // Set Consul to each definition's namespace + // TODO(kit): Prepending the service to each definition should be handled by go-metrics + var withService []prometheus.GaugeDefinition + for _, gauge := range g { + gauge.Name = append([]string{cfg.MetricsPrefix}, gauge.Name...) + withService = append(withService, gauge) + } + gaugeDefs = append(gaugeDefs, withService...) + } + + raftCounters := []prometheus.CounterDefinition{ + // TODO(kit): "raft..." metrics come from the raft lib and we should migrate these to a telemetry + // package within. In the mean time, we're going to define a few here because they're key to monitoring Consul. + { + Name: []string{"raft", "apply"}, + Help: "This counts the number of Raft transactions occurring over the interval.", + }, + { + Name: []string{"raft", "state", "candidate"}, + Help: "This increments whenever a Consul server starts an election.", + }, + { + Name: []string{"raft", "state", "leader"}, + Help: "This increments whenever a Consul server becomes a leader.", + }, + } + + var counters = [][]prometheus.CounterDefinition{ + CatalogCounters, + cache.Counters, + consul.ACLCounters, + consul.CatalogCounters, + consul.ClientCounters, + consul.RPCCounters, + grpc.StatsCounters, + local.StateCounters, + raftCounters, + } + // Flatten definitions + // NOTE(kit): Do we actually want to create a set here so we can ensure definition names are unique? + var counterDefs []prometheus.CounterDefinition + for _, c := range counters { + // TODO(kit): Prepending the service to each definition should be handled by go-metrics + var withService []prometheus.CounterDefinition + for _, counter := range c { + counter.Name = append([]string{cfg.MetricsPrefix}, counter.Name...) + withService = append(withService, counter) + } + counterDefs = append(counterDefs, withService...) + } + + raftSummaries := []prometheus.SummaryDefinition{ + // TODO(kit): "raft..." metrics come from the raft lib and we should migrate these to a telemetry + // package within. In the mean time, we're going to define a few here because they're key to monitoring Consul. + { + Name: []string{"raft", "commitTime"}, + Help: "This measures the time it takes to commit a new entry to the Raft log on the leader.", + }, + { + Name: []string{"raft", "leader", "lastContact"}, + Help: "Measures the time since the leader was last able to contact the follower nodes when checking its leader lease.", + }, + } + + var summaries = [][]prometheus.SummaryDefinition{ + HTTPSummaries, + consul.ACLSummaries, + consul.ACLEndpointSummaries, + consul.ACLEndpointLegacySummaries, + consul.CatalogSummaries, + consul.FederationStateSummaries, + consul.IntentionSummaries, + consul.KVSummaries, + consul.LeaderSummaries, + consul.PreparedQuerySummaries, + consul.RPCSummaries, + consul.SegmentOSSSummaries, + consul.SessionSummaries, + consul.SessionEndpointSummaries, + consul.TxnSummaries, + fsm.CommandsSummaries, + fsm.SnapshotSummaries, + raftSummaries, + } + // Flatten definitions + // NOTE(kit): Do we actually want to create a set here so we can ensure definition names are unique? + var summaryDefs []prometheus.SummaryDefinition + for _, s := range summaries { + // TODO(kit): Prepending the service to each definition should be handled by go-metrics + var withService []prometheus.SummaryDefinition + for _, summary := range s { + summary.Name = append([]string{cfg.MetricsPrefix}, summary.Name...) + withService = append(withService, summary) + } + summaryDefs = append(summaryDefs, withService...) + } + + return gaugeDefs, counterDefs, summaryDefs +} diff --git a/connect/proxy/proxy.go b/connect/proxy/proxy.go index 9dc27a06fe..a29cf352e8 100644 --- a/connect/proxy/proxy.go +++ b/connect/proxy/proxy.go @@ -54,6 +54,8 @@ func (p *Proxy) Serve() error { // Initial setup // Setup telemetry if configured + // NOTE(kit): As far as I can tell, all of the metrics in the proxy are generated at runtime, so we + // don't have any static metrics we initialize at start. _, err := lib.InitTelemetry(newCfg.Telemetry) if err != nil { p.logger.Error("proxy telemetry config error", "error", err) diff --git a/lib/telemetry.go b/lib/telemetry.go index 33f7d21008..d85e51d45d 100644 --- a/lib/telemetry.go +++ b/lib/telemetry.go @@ -4,7 +4,7 @@ import ( "reflect" "time" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" "github.com/armon/go-metrics/circonus" "github.com/armon/go-metrics/datadog" "github.com/armon/go-metrics/prometheus" @@ -154,14 +154,6 @@ type TelemetryConfig struct { // hcl: telemetry { dogstatsd_tags = []string } DogstatsdTags []string `json:"dogstatsd_tags,omitempty" mapstructure:"dogstatsd_tags"` - // PrometheusRetentionTime is the retention time for prometheus metrics if greater than 0. - // A value of 0 disable Prometheus support. Regarding Prometheus, it is considered a good - // practice to put large values here (such as a few days), and at least the interval between - // prometheus requests. - // - // hcl: telemetry { prometheus_retention_time = "duration" } - PrometheusRetentionTime time.Duration `json:"prometheus_retention_time,omitempty" mapstructure:"prometheus_retention_time"` - // FilterDefault is the default for whether to allow a metric that's not // covered by the filter. // @@ -199,10 +191,18 @@ type TelemetryConfig struct { // // hcl: telemetry { statsite_address = string } StatsiteAddr string `json:"statsite_address,omitempty" mapstructure:"statsite_address"` + + // PrometheusOpts provides configuration for the PrometheusSink. Currently the only configuration + // we acquire from hcl is the retention time. We also use definition slices that are set in agent setup + // before being passed to InitTelemmetry. + // + // hcl: telemetry { prometheus_retention_time = "duration" } + PrometheusOpts prometheus.PrometheusOpts } // MergeDefaults copies any non-zero field from defaults into the current // config. +// TODO(kit): We no longer use this function and can probably delete it func (c *TelemetryConfig) MergeDefaults(defaults *TelemetryConfig) { if defaults == nil { return @@ -221,6 +221,10 @@ func (c *TelemetryConfig) MergeDefaults(defaults *TelemetryConfig) { // implementing this for the types we actually have for now. Test failure // should catch the case where we add new types later. switch f.Kind() { + case reflect.Struct: + if f.Type() == reflect.TypeOf(prometheus.PrometheusOpts{}) { + continue + } case reflect.Slice: if !f.IsNil() { continue @@ -277,80 +281,12 @@ func dogstatdSink(cfg TelemetryConfig, hostname string) (metrics.MetricSink, err } func prometheusSink(cfg TelemetryConfig, hostname string) (metrics.MetricSink, error) { - if cfg.PrometheusRetentionTime.Nanoseconds() < 1 { + + if cfg.PrometheusOpts.Expiration.Nanoseconds() < 1 { return nil, nil } - // TODO(kit) define these in vars in the package/file they're used - gaugeDefs := []prometheus.GaugeDefinition{ - { - Name: []string{"consul", "autopilot", "healthy"}, - Help: "This tracks the overall health of the local server cluster. 1 if all servers are healthy, 0 if one or more are unhealthy.", - }, - } - - // TODO(kit) define these in vars in the package/file they're used - counterDefs := []prometheus.CounterDefinition{ - { - Name: []string{"consul", "raft", "apply"}, - Help: "This counts the number of Raft transactions occurring over the interval.", - }, - { - Name: []string{"consul", "raft", "state", "candidate"}, - Help: "This increments whenever a Consul server starts an election.", - }, - { - Name: []string{"consul", "raft", "state", "leader"}, - Help: "This increments whenever a Consul server becomes a leader.", - }, - { - Name: []string{"consul", "client", "api", "catalog_register"}, - Help: "Increments whenever a Consul agent receives a catalog register request.", - }, - { - Name: []string{"consul", "runtime", "total_gc_pause_ns"}, - Help: "Number of nanoseconds consumed by stop-the-world garbage collection (GC) pauses since Consul started.", - }, - { - Name: []string{"consul", "client", "rpc"}, - Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server.", - }, - { - Name: []string{"consul", "client", "rpc", "exceeded"}, - Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server gets rate limited by that agent's limits configuration.", - }, - { - Name: []string{"consul", "client", "rpc", "failed"}, - Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server and fails.", - }, - } - - // TODO(kit) define these in vars in the package/file they're used - summaryDefs := []prometheus.SummaryDefinition{ - { - Name: []string{"consul", "kvs", "apply"}, - Help: "This measures the time it takes to complete an update to the KV store.", - }, - { - Name: []string{"consul", "txn", "apply"}, - Help: "This measures the time spent applying a transaction operation.", - }, - { - Name: []string{"consul", "raft", "commitTime"}, - Help: "This measures the time it takes to commit a new entry to the Raft log on the leader.", - }, - { - Name: []string{"consul", "raft", "leader", "lastContact"}, - Help: "Measures the time since the leader was last able to contact the follower nodes when checking its leader lease.", - }, - } - prometheusOpts := prometheus.PrometheusOpts{ - Expiration: cfg.PrometheusRetentionTime, - GaugeDefinitions: gaugeDefs, - CounterDefinitions: counterDefs, - SummaryDefinitions: summaryDefs, - } - sink, err := prometheus.NewPrometheusSinkFrom(prometheusOpts) + sink, err := prometheus.NewPrometheusSinkFrom(cfg.PrometheusOpts) if err != nil { return nil, err } @@ -440,6 +376,9 @@ func InitTelemetry(cfg TelemetryConfig) (*metrics.InmemSink, error) { if err := addSink(circonusSink); err != nil { return nil, err } + if err := addSink(circonusSink); err != nil { + return nil, err + } if err := addSink(prometheusSink); err != nil { return nil, err } diff --git a/lib/telemetry_test.go b/lib/telemetry_test.go index f81b7b5c1a..4ee012f1ec 100644 --- a/lib/telemetry_test.go +++ b/lib/telemetry_test.go @@ -5,11 +5,14 @@ import ( "testing" "time" + "github.com/armon/go-metrics/prometheus" + "github.com/stretchr/testify/require" ) func makeFullTelemetryConfig(t *testing.T) TelemetryConfig { var ( + promOpts = prometheus.PrometheusOpts{} strSliceVal = []string{"foo"} strVal = "foo" intVal = int64(1 * time.Second) @@ -27,6 +30,12 @@ func makeFullTelemetryConfig(t *testing.T) TelemetryConfig { // now for brevity but will fail the test if a new field type is added since // this is likely not implemented in MergeDefaults either. switch f.Kind() { + case reflect.Struct: + if f.Type() != reflect.TypeOf(promOpts) { + t.Fatalf("unknown struct type in TelemetryConfig: actual %v, expected: %v", f.Type(), reflect.TypeOf(promOpts)) + } + // TODO(kit): This should delve into the fields and set them individually rather than using an empty struct + f.Set(reflect.ValueOf(promOpts)) case reflect.Slice: if f.Type() != reflect.TypeOf(strSliceVal) { t.Fatalf("unknown slice type in TelemetryConfig." + From aa45e343b5cefd02f5d076f94a6b9b5d997cc00d Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Tue, 17 Nov 2020 10:03:00 -0500 Subject: [PATCH 07/36] [docs] Change links to the DNS information to the right place (#8675) The redirects were working in many situations but some (INTERNALS.md) was not. This just flips everything over to using the real link. --- contributing/INTERNALS.md | 2 +- website/pages/api-docs/query.mdx | 2 +- website/pages/docs/agent/config-entries/ingress-gateway.mdx | 2 +- website/pages/docs/agent/options.mdx | 2 +- website/pages/docs/connect/gateways/ingress-gateway.mdx | 4 ++-- website/pages/docs/connect/native/index.mdx | 2 +- website/pages/docs/connect/proxies/index.mdx | 2 +- website/pages/docs/connect/proxies/managed-deprecated.mdx | 2 +- website/pages/docs/discovery/services.mdx | 2 +- website/pages/docs/k8s/dns.mdx | 2 +- website/pages/docs/k8s/service-sync.mdx | 2 +- website/pages/intro/getting-started/agent.mdx | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/contributing/INTERNALS.md b/contributing/INTERNALS.md index cb1cbe4de3..38fd01aaf2 100644 --- a/contributing/INTERNALS.md +++ b/contributing/INTERNALS.md @@ -59,7 +59,7 @@ This section addresses some frequently asked questions about Consul's architectu ### How does eventually-consistent gossip relate to the Raft consensus protocol? -When you query Consul for information about a service, such as via the [DNS interface](https://www.consul.io/docs/agent/dns.html), the agent will always make an internal RPC request to a Consul server that will query the consistent state store. Even though an agent might learn that another agent is down via gossip, that won't be reflected in service discovery until the current Raft leader server perceives that through gossip and updates the catalog using Raft. You can see an example of where these layers are plumbed together here - https://github.com/hashicorp/consul/blob/v1.0.5/agent/consul/leader.go#L559-L602. +When you query Consul for information about a service, such as via the [DNS interface](https://www.consul.io/docs/discovery/dns), the agent will always make an internal RPC request to a Consul server that will query the consistent state store. Even though an agent might learn that another agent is down via gossip, that won't be reflected in service discovery until the current Raft leader server perceives that through gossip and updates the catalog using Raft. You can see an example of where these layers are plumbed together here - https://github.com/hashicorp/consul/blob/v1.0.5/agent/consul/leader.go#L559-L602. ## Why does a blocking query sometimes return with identical results? diff --git a/website/pages/api-docs/query.mdx b/website/pages/api-docs/query.mdx index c5a2c4c15b..510324c4a3 100644 --- a/website/pages/api-docs/query.mdx +++ b/website/pages/api-docs/query.mdx @@ -12,7 +12,7 @@ The `/query` endpoints create, update, destroy, and execute prepared queries. Prepared queries allow you to register a complex service query and then execute it later via its ID or name to get a set of healthy nodes that provide a given service. This is particularly useful in combination with Consul's -[DNS Interface](/docs/agent/dns) as it allows for much richer queries than +[DNS Interface](/docs/discovery/dns) as it allows for much richer queries than would be possible given the limited entry points exposed by DNS. Check the [Geo Failover tutorial](https://learn.hashicorp.com/tutorials/consul/automate-geo-failover) for details and diff --git a/website/pages/docs/agent/config-entries/ingress-gateway.mdx b/website/pages/docs/agent/config-entries/ingress-gateway.mdx index cfa06f7aba..aedf21d2ba 100644 --- a/website/pages/docs/agent/config-entries/ingress-gateway.mdx +++ b/website/pages/docs/agent/config-entries/ingress-gateway.mdx @@ -38,7 +38,7 @@ gateway: - The ingress gateway will route traffic based on the host/authority header, expecting a value matching `.ingress.*`, or if using namespaces, `.ingress..*`. This matches the [Consul DNS - ingress subdomain](/docs/agent/dns#ingress-service-lookups). + ingress subdomain](/docs/discovery/dns#ingress-service-lookups). A wildcard specifier cannot be set on a listener of protocol `tcp`. diff --git a/website/pages/docs/agent/options.mdx b/website/pages/docs/agent/options.mdx index be74f6ad09..da8dba391b 100644 --- a/website/pages/docs/agent/options.mdx +++ b/website/pages/docs/agent/options.mdx @@ -1452,7 +1452,7 @@ Valid time units are 'ns', 'us' (or 'µs'), 'ms', 's', 'm', 'h'." When set to true, in a DNS query for a service, the label between the domain and the `service` label will be treated as a namespace name instead of a datacenter. When set to false, the default, the behavior will be the same as non-Enterprise - versions and will assume the label is the datacenter. See: [this section](/docs/agent/dns#namespaced-services) + versions and will assume the label is the datacenter. See: [this section](/docs/discovery/dns#namespaced-services) for more details. - `domain` Equivalent to the [`-domain` command-line flag](#_domain). diff --git a/website/pages/docs/connect/gateways/ingress-gateway.mdx b/website/pages/docs/connect/gateways/ingress-gateway.mdx index 170a4f460b..6c72c3d73a 100644 --- a/website/pages/docs/connect/gateways/ingress-gateway.mdx +++ b/website/pages/docs/connect/gateways/ingress-gateway.mdx @@ -23,7 +23,7 @@ to a set of backing [services](/docs/agent/config-entries/ingress-gateway#services). To enable easier service discovery, a new Consul [DNS -subdomain](/docs/agent/dns#ingress-service-lookups) is provided, on +subdomain](/docs/discovery/dns#ingress-service-lookups) is provided, on `.ingress.`. For listeners with a @@ -32,7 +32,7 @@ For listeners with a case, the ingress gateway relies on host/authority headers to decide the service that should receive the traffic. The host used to match traffic defaults to the [Consul DNS ingress -subdomain](/docs/agent/dns#ingress-service-lookups), but can be changed using +subdomain](/docs/discovery/dns#ingress-service-lookups), but can be changed using the [hosts](/docs/agent/config-entries/ingress-gateway#hosts) field. ![Ingress Gateway Architecture](/img/ingress-gateways.png) diff --git a/website/pages/docs/connect/native/index.mdx b/website/pages/docs/connect/native/index.mdx index e4ad134140..5b0f0e0497 100644 --- a/website/pages/docs/connect/native/index.mdx +++ b/website/pages/docs/connect/native/index.mdx @@ -52,7 +52,7 @@ Details on the steps are below: - **Service discovery** - This is normal service discovery using Consul, a static IP, or any other mechanism. If you're using Consul DNS, the - [`.connect`](/docs/agent/dns#connect-capable-service-lookups) + [`.connect`](/docs/discovery/dns#connect-capable-service-lookups) syntax to find Connect-capable endpoints for a service. After service discovery, choose one address from the list of **service addresses**. diff --git a/website/pages/docs/connect/proxies/index.mdx b/website/pages/docs/connect/proxies/index.mdx index 430c53609a..874871fe8b 100644 --- a/website/pages/docs/connect/proxies/index.mdx +++ b/website/pages/docs/connect/proxies/index.mdx @@ -32,7 +32,7 @@ switch service definitions for registering proxies. If an application requires dynamic dependencies that are only available at runtime, it must [natively integrate](/docs/connect/native) with Connect. After natively integrating, the HTTP API or -[DNS interface](/docs/agent/dns#connect-capable-service-lookups) +[DNS interface](/docs/discovery/dns#connect-capable-service-lookups) can be used. !> Connect proxies do not currently support dynamic upstreams. diff --git a/website/pages/docs/connect/proxies/managed-deprecated.mdx b/website/pages/docs/connect/proxies/managed-deprecated.mdx index 757b5171a0..24348dd8cc 100644 --- a/website/pages/docs/connect/proxies/managed-deprecated.mdx +++ b/website/pages/docs/connect/proxies/managed-deprecated.mdx @@ -119,7 +119,7 @@ default managed proxy and starts a listener for that service: The listener is started on random port within the configured Connect port range. It can be discovered using the -[DNS interface](/docs/agent/dns#connect-capable-service-lookups) +[DNS interface](/docs/discovery/dns#connect-capable-service-lookups) or [Catalog API](#). In most cases, service-to-service communication is established by diff --git a/website/pages/docs/discovery/services.mdx b/website/pages/docs/discovery/services.mdx index cb90f2abe6..c1d01f5f2c 100644 --- a/website/pages/docs/discovery/services.mdx +++ b/website/pages/docs/discovery/services.mdx @@ -355,7 +355,7 @@ services { ## Service and Tag Names with DNS -Consul exposes service definitions and tags over the [DNS](/docs/agent/dns) +Consul exposes service definitions and tags over the [DNS](/docs/discovery/dns) interface. DNS queries have a strict set of allowed characters and a well-defined format that Consul cannot override. While it is possible to register services or tags with names that don't match the conventions, those diff --git a/website/pages/docs/k8s/dns.mdx b/website/pages/docs/k8s/dns.mdx index 053ce31697..5bb1038d46 100644 --- a/website/pages/docs/k8s/dns.mdx +++ b/website/pages/docs/k8s/dns.mdx @@ -11,7 +11,7 @@ description: >- # Consul DNS on Kubernetes One of the primary query interfaces to Consul is the -[DNS interface](/docs/agent/dns). You can configure Consul DNS in +[DNS interface](/docs/discovery/dns). You can configure Consul DNS in Kubernetes using a [stub-domain configuration](https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#configure-stub-domain-and-upstream-dns-servers) if using KubeDNS or a [proxy configuration](https://coredns.io/plugins/proxy/) if using CoreDNS. diff --git a/website/pages/docs/k8s/service-sync.mdx b/website/pages/docs/k8s/service-sync.mdx index 46ab6a8d9b..092e18b79b 100644 --- a/website/pages/docs/k8s/service-sync.mdx +++ b/website/pages/docs/k8s/service-sync.mdx @@ -21,7 +21,7 @@ automatically installed and configured using the Consul catalog enable Kubernetes services to be accessed by any node that is part of the Consul cluster, including other distinct Kubernetes clusters. For non-Kubernetes nodes, they can access services using the standard -[Consul DNS](/docs/agent/dns) or HTTP API. +[Consul DNS](/docs/discovery/dns) or HTTP API. **Why sync Consul services to Kubernetes?** Syncing Consul services to Kubernetes services enables non-Kubernetes services (such as external to diff --git a/website/pages/intro/getting-started/agent.mdx b/website/pages/intro/getting-started/agent.mdx index 2f97788303..42e3c82313 100644 --- a/website/pages/intro/getting-started/agent.mdx +++ b/website/pages/intro/getting-started/agent.mdx @@ -103,7 +103,7 @@ $ curl localhost:8500/v1/catalog/nodes [{"Node":"Armons-MacBook-Air","Address":"127.0.0.1","TaggedAddresses":{"lan":"127.0.0.1","wan":"127.0.0.1"},"CreateIndex":4,"ModifyIndex":110}] ``` -In addition to the HTTP API, the [DNS interface](/docs/agent/dns) can +In addition to the HTTP API, the [DNS interface](/docs/discovery/dns) can be used to query the node. Note that you have to make sure to point your DNS lookups to the Consul agent's DNS server which runs on port 8600 by default. The format of the DNS entries (such as "Armons-MacBook-Air.node.consul") will From d3e379b7125f8d423b7413b170b19f84fe09ff0e Mon Sep 17 00:00:00 2001 From: Kenia <19161242+kaxcode@users.noreply.github.com> Date: Tue, 17 Nov 2020 10:35:56 -0500 Subject: [PATCH 08/36] ui: Changelog changes (#9209) --- .changelog/9141.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changelog/9141.txt diff --git a/.changelog/9141.txt b/.changelog/9141.txt new file mode 100644 index 0000000000..06a2690b7a --- /dev/null +++ b/.changelog/9141.txt @@ -0,0 +1,7 @@ +```release-note:improvement +ui: Moves the Proxy health checks to be displayed with the Service health check under the Health Checks tab +``` + +```release-note:improvement +ui: Add the Upstreams and Exposed Paths tabs for services in mesh +``` \ No newline at end of file From dfaaa0b73a943e91339df718afbf55e407d2fc7d Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Tue, 17 Nov 2020 10:53:57 -0500 Subject: [PATCH 09/36] Refactor to call non-voting servers read replicas (#9191) Co-authored-by: Kit Patella --- .changelog/9191.txt | 18 ++++++++++ agent/agent.go | 4 +-- agent/config/builder.go | 2 +- agent/config/builder_oss.go | 3 ++ agent/config/builder_oss_test.go | 17 +++++++--- agent/config/config.go | 2 +- agent/config/flags.go | 3 +- agent/config/runtime.go | 4 +-- agent/config/runtime_oss_test.go | 6 +++- agent/config/runtime_test.go | 10 +++--- agent/consul/config.go | 4 +-- agent/consul/leader.go | 2 ++ agent/consul/leader_test.go | 6 ++++ agent/consul/server_serf.go | 9 +++-- agent/consul/server_test.go | 2 +- agent/metadata/server.go | 8 +++-- agent/metadata/server_test.go | 16 ++++++--- agent/structs/structs_filtering_test.go | 35 ++++++++++++++++++++ api/agent.go | 9 +++++ website/pages/docs/agent/options.mdx | 9 +++-- website/pages/docs/enterprise/read-scale.mdx | 10 +++--- 21 files changed, 141 insertions(+), 38 deletions(-) create mode 100644 .changelog/9191.txt diff --git a/.changelog/9191.txt b/.changelog/9191.txt new file mode 100644 index 0000000000..25f7da43db --- /dev/null +++ b/.changelog/9191.txt @@ -0,0 +1,18 @@ +```release-note:deprecation +cli: **(Enterprise only)** The `-non-voting-server` flag is deprecated in favor of the new `-read-replica` flag. The `-non-voting-server` flag is still present along side the new flag but it will be removed in a future release. +``` +```release-note:improvement +cli: **(Enterprise only)** A new `-read-replica` flag can now be used to enable running a server as a read only replica. Previously this was enabled with the now deprecated `-non-voting-server` flag. +``` +```release-note:deprecation +config: **(Enterprise only)** The `non_voting_server` configuration setting is deprecated in favor of the new `read_replica` setting. The `non_voting_server` configuration setting is still present but will be removed in a future release. +``` +```release-note:improvement +config: **(Enterprise only)** A new `read_replica` configuration setting can now be used to enable running a server as a read only replica. Previously this was enabled with the now deprecated `non_voting_server` setting. +``` +```release-note:deprecation +server: **(Enterprise only)** Addition of the `nonvoter` tag to the service registration made for read replicas is deprecated in favor of the new tag name of `read_replica`. Both are present in the registration but the `nonvoter` tag will be completely removed in a future release. +``` +```release-note:deprecation +gossip: **(Enterprise only)** Read replicas now advertise themselves by setting the `read_replica` tag. The old `nonvoter` tag is still present but is deprecated and will be removed in a future release. +``` diff --git a/agent/agent.go b/agent/agent.go index 76fd923d4a..07f21a2306 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -1110,8 +1110,8 @@ func newConsulConfig(runtimeCfg *config.RuntimeConfig, logger hclog.Logger) (*co if runtimeCfg.SessionTTLMin != 0 { cfg.SessionTTLMin = runtimeCfg.SessionTTLMin } - if runtimeCfg.NonVotingServer { - cfg.NonVoter = runtimeCfg.NonVotingServer + if runtimeCfg.ReadReplica { + cfg.ReadReplica = runtimeCfg.ReadReplica } // These are fully specified in the agent defaults, so we can simply diff --git a/agent/config/builder.go b/agent/config/builder.go index 062fb440f7..48a2c55bec 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -1034,7 +1034,7 @@ func (b *Builder) Build() (rt RuntimeConfig, err error) { NodeID: types.NodeID(b.stringVal(c.NodeID)), NodeMeta: c.NodeMeta, NodeName: b.nodeName(c.NodeName), - NonVotingServer: b.boolVal(c.NonVotingServer), + ReadReplica: b.boolVal(c.ReadReplica), PidFile: b.stringVal(c.PidFile), PrimaryDatacenter: primaryDatacenter, PrimaryGateways: b.expandAllOptionalAddrs("primary_gateways", c.PrimaryGateways), diff --git a/agent/config/builder_oss.go b/agent/config/builder_oss.go index 85cf081375..82a037994b 100644 --- a/agent/config/builder_oss.go +++ b/agent/config/builder_oss.go @@ -13,6 +13,9 @@ var ( "non_voting_server": func(c *Config) { // to maintain existing compatibility we don't nullify the value }, + "read_replica": func(c *Config) { + // to maintain existing compatibility we don't nullify the value + }, "segment": func(c *Config) { // to maintain existing compatibility we don't nullify the value }, diff --git a/agent/config/builder_oss_test.go b/agent/config/builder_oss_test.go index d7a94a9821..e94fec68a2 100644 --- a/agent/config/builder_oss_test.go +++ b/agent/config/builder_oss_test.go @@ -24,11 +24,18 @@ func TestBuilder_validateEnterpriseConfigKeys(t *testing.T) { cases := map[string]testCase{ "non_voting_server": { config: Config{ - NonVotingServer: &boolVal, + ReadReplica: &boolVal, }, keys: []string{"non_voting_server"}, badKeys: []string{"non_voting_server"}, }, + "read_replica": { + config: Config{ + ReadReplica: &boolVal, + }, + keys: []string{"read_replica"}, + badKeys: []string{"read_replica"}, + }, "segment": { config: Config{ SegmentName: &stringVal, @@ -118,11 +125,11 @@ func TestBuilder_validateEnterpriseConfigKeys(t *testing.T) { }, "multi": { config: Config{ - NonVotingServer: &boolVal, - SegmentName: &stringVal, + ReadReplica: &boolVal, + SegmentName: &stringVal, }, - keys: []string{"non_voting_server", "segment", "acl.tokens.agent_master"}, - badKeys: []string{"non_voting_server", "segment"}, + keys: []string{"non_voting_server", "read_replica", "segment", "acl.tokens.agent_master"}, + badKeys: []string{"non_voting_server", "read_replica", "segment"}, }, } diff --git a/agent/config/config.go b/agent/config/config.go index f966297baf..a6d4df8434 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -289,7 +289,7 @@ type Config struct { // Enterprise Only Audit *Audit `json:"audit,omitempty" hcl:"audit" mapstructure:"audit"` // Enterprise Only - NonVotingServer *bool `json:"non_voting_server,omitempty" hcl:"non_voting_server" mapstructure:"non_voting_server"` + ReadReplica *bool `json:"read_replica,omitempty" hcl:"read_replica" mapstructure:"read_replica" alias:"non_voting_server"` // Enterprise Only SegmentName *string `json:"segment,omitempty" hcl:"segment" mapstructure:"segment"` // Enterprise Only diff --git a/agent/config/flags.go b/agent/config/flags.go index a032944d3e..77dc2abb38 100644 --- a/agent/config/flags.go +++ b/agent/config/flags.go @@ -89,7 +89,8 @@ func AddFlags(fs *flag.FlagSet, f *BuilderOpts) { add(&f.Config.NodeName, "node", "Name of this node. Must be unique in the cluster.") add(&f.Config.NodeID, "node-id", "A unique ID for this node across space and time. Defaults to a randomly-generated ID that persists in the data-dir.") add(&f.Config.NodeMeta, "node-meta", "An arbitrary metadata key/value pair for this node, of the format `key:value`. Can be specified multiple times.") - add(&f.Config.NonVotingServer, "non-voting-server", "(Enterprise-only) This flag is used to make the server not participate in the Raft quorum, and have it only receive the data replication stream. This can be used to add read scalability to a cluster in cases where a high volume of reads to servers are needed.") + add(&f.Config.ReadReplica, "non-voting-server", "(Enterprise-only) DEPRECATED: -read-replica should be used instead") + add(&f.Config.ReadReplica, "read-replica", "(Enterprise-only) This flag is used to make the server not participate in the Raft quorum, and have it only receive the data replication stream. This can be used to add read scalability to a cluster in cases where a high volume of reads to servers are needed.") add(&f.Config.PidFile, "pid-file", "Path to file to store agent PID.") add(&f.Config.RPCProtocol, "protocol", "Sets the protocol version. Defaults to latest.") add(&f.Config.RaftProtocol, "raft-protocol", "Sets the Raft protocol version. Defaults to latest.") diff --git a/agent/config/runtime.go b/agent/config/runtime.go index 4acc823faa..ffaf1f7f09 100644 --- a/agent/config/runtime.go +++ b/agent/config/runtime.go @@ -845,12 +845,12 @@ type RuntimeConfig struct { // flag: -node-meta "key:value" -node-meta "key:value" ... NodeMeta map[string]string - // NonVotingServer is whether this server will act as a non-voting member + // ReadReplica is whether this server will act as a non-voting member // of the cluster to help provide read scalability. (Enterprise-only) // // hcl: non_voting_server = (true|false) // flag: -non-voting-server - NonVotingServer bool + ReadReplica bool // PidFile is the file to store our PID in. // diff --git a/agent/config/runtime_oss_test.go b/agent/config/runtime_oss_test.go index c7c21eb0a0..670008ce93 100644 --- a/agent/config/runtime_oss_test.go +++ b/agent/config/runtime_oss_test.go @@ -12,12 +12,16 @@ var entTokenConfigSanitize = `"EnterpriseConfig": {},` func entFullRuntimeConfig(rt *RuntimeConfig) {} -var enterpriseNonVotingServerWarnings []string = []string{enterpriseConfigKeyError{key: "non_voting_server"}.Error()} +var enterpriseReadReplicaWarnings []string = []string{enterpriseConfigKeyError{key: "read_replica"}.Error()} var enterpriseConfigKeyWarnings []string func init() { for k := range enterpriseConfigMap { + if k == "non_voting_server" { + // this is an alias for "read_replica" so we shouldn't see it in warnings + continue + } enterpriseConfigKeyWarnings = append(enterpriseConfigKeyWarnings, enterpriseConfigKeyError{key: k}.Error()) } } diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index 2dff70d1bf..a989add2f7 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -610,10 +610,10 @@ func TestBuilder_BuildAndValidate_ConfigFlagsAndEdgecases(t *testing.T) { `-data-dir=` + dataDir, }, patch: func(rt *RuntimeConfig) { - rt.NonVotingServer = true + rt.ReadReplica = true rt.DataDir = dataDir }, - warns: enterpriseNonVotingServerWarnings, + warns: enterpriseReadReplicaWarnings, }, { desc: "-pid-file", @@ -5315,6 +5315,7 @@ func TestFullConfig(t *testing.T) { "raft_snapshot_threshold": 16384, "raft_snapshot_interval": "30s", "raft_trailing_logs": 83749, + "read_replica": true, "reconnect_timeout": "23739s", "reconnect_timeout_wan": "26694s", "recursors": [ "63.38.39.58", "92.49.18.18" ], @@ -6004,6 +6005,7 @@ func TestFullConfig(t *testing.T) { raft_snapshot_threshold = 16384 raft_snapshot_interval = "30s" raft_trailing_logs = 83749 + read_replica = true reconnect_timeout = "23739s" reconnect_timeout_wan = "26694s" recursors = [ "63.38.39.58", "92.49.18.18" ] @@ -6749,7 +6751,7 @@ func TestFullConfig(t *testing.T) { NodeID: types.NodeID("AsUIlw99"), NodeMeta: map[string]string{"5mgGQMBk": "mJLtVMSG", "A7ynFMJB": "0Nx6RGab"}, NodeName: "otlLxGaI", - NonVotingServer: true, + ReadReplica: true, PidFile: "43xN80Km", PrimaryDatacenter: "ejtmd43d", PrimaryGateways: []string{"aej8eeZo", "roh2KahS"}, @@ -7684,13 +7686,13 @@ func TestSanitize(t *testing.T) { "NodeID": "", "NodeMeta": {}, "NodeName": "", - "NonVotingServer": false, "PidFile": "", "PrimaryDatacenter": "", "PrimaryGateways": [ "pmgw_foo=bar pmgw_key=baz pmgw_secret=boom pmgw_bang=bar" ], "PrimaryGatewaysInterval": "0s", + "ReadReplica": false, "RPCAdvertiseAddr": "", "RPCBindAddr": "", "RPCHandshakeTimeout": "0s", diff --git a/agent/consul/config.go b/agent/consul/config.go index 73db2d2967..7b4cbb507e 100644 --- a/agent/consul/config.go +++ b/agent/consul/config.go @@ -110,9 +110,9 @@ type Config struct { // RaftConfig is the configuration used for Raft in the local DC RaftConfig *raft.Config - // (Enterprise-only) NonVoter is used to prevent this server from being added + // (Enterprise-only) ReadReplica is used to prevent this server from being added // as a voting member of the Raft cluster. - NonVoter bool + ReadReplica bool // NotifyListen is called after the RPC listener has been configured. // RPCAdvertise will be set to the listener address if it hasn't been diff --git a/agent/consul/leader.go b/agent/consul/leader.go index d050e297b4..1fcef0624c 100644 --- a/agent/consul/leader.go +++ b/agent/consul/leader.go @@ -1230,7 +1230,9 @@ func (s *Server) handleAliveMember(member serf.Member) error { Warning: 1, }, Meta: map[string]string{ + // DEPRECATED - remove nonvoter in favor of read_replica in a future version of consul "non_voter": strconv.FormatBool(member.Tags["nonvoter"] == "1"), + "read_replica": strconv.FormatBool(member.Tags["read_replica"] == "1"), "raft_version": strconv.Itoa(parts.RaftVersion), "serf_protocol_current": strconv.FormatUint(uint64(member.ProtocolCur), 10), "serf_protocol_min": strconv.FormatUint(uint64(member.ProtocolMin), 10), diff --git a/agent/consul/leader_test.go b/agent/consul/leader_test.go index 60f817a8d3..0d02e522bd 100644 --- a/agent/consul/leader_test.go +++ b/agent/consul/leader_test.go @@ -334,7 +334,9 @@ func TestLeader_CheckServersMeta(t *testing.T) { versionToExpect := "19.7.9" retry.Run(t, func(r *retry.R) { + // DEPRECATED - remove nonvoter tag in favor of read_replica in a future version of consul member.Tags["nonvoter"] = "1" + member.Tags["read_replica"] = "1" member.Tags["build"] = versionToExpect err := s1.handleAliveMember(member) if err != nil { @@ -347,9 +349,13 @@ func TestLeader_CheckServersMeta(t *testing.T) { if service == nil { r.Fatal("client not registered") } + // DEPRECATED - remove non_voter in favor of read_replica in a future version of consul if service.Meta["non_voter"] != "true" { r.Fatalf("Expected to be non_voter == true, was: %s", service.Meta["non_voter"]) } + if service.Meta["read_replica"] != "true" { + r.Fatalf("Expected to be read_replica == true, was: %s", service.Meta["non_voter"]) + } newVersion := service.Meta["version"] if newVersion != versionToExpect { r.Fatalf("Expected version to be updated to %s, was %s", versionToExpect, newVersion) diff --git a/agent/consul/server_serf.go b/agent/consul/server_serf.go index ce57d9d4b8..d6b79f0a79 100644 --- a/agent/consul/server_serf.go +++ b/agent/consul/server_serf.go @@ -61,8 +61,11 @@ func (s *Server) setupSerf(conf *serf.Config, ch chan serf.Event, path string, w if s.config.BootstrapExpect != 0 { conf.Tags["expect"] = fmt.Sprintf("%d", s.config.BootstrapExpect) } - if s.config.NonVoter { + if s.config.ReadReplica { + // DEPRECATED - This tag should be removed when we no longer want to support + // upgrades from 1.8.x and below conf.Tags["nonvoter"] = "1" + conf.Tags["read_replica"] = "1" } if s.config.UseTLS { conf.Tags["use_tls"] = "1" @@ -351,7 +354,7 @@ func (s *Server) maybeBootstrap() { s.logger.Error("Member has bootstrap mode. Expect disabled.", "member", member) return } - if !p.NonVoter { + if !p.ReadReplica { voters++ } servers = append(servers, *p) @@ -410,7 +413,7 @@ func (s *Server) maybeBootstrap() { id := raft.ServerID(server.ID) suffrage := raft.Voter - if server.NonVoter { + if server.ReadReplica { suffrage = raft.Nonvoter } peer := raft.Server{ diff --git a/agent/consul/server_test.go b/agent/consul/server_test.go index 928e59257b..c645386388 100644 --- a/agent/consul/server_test.go +++ b/agent/consul/server_test.go @@ -240,7 +240,7 @@ func testServerDCExpectNonVoter(t *testing.T, dc string, expect int) (string, *S c.Datacenter = dc c.Bootstrap = false c.BootstrapExpect = expect - c.NonVoter = true + c.ReadReplica = true }) } diff --git a/agent/metadata/server.go b/agent/metadata/server.go index d145a9d266..5b35ec78ec 100644 --- a/agent/metadata/server.go +++ b/agent/metadata/server.go @@ -40,7 +40,7 @@ type Server struct { RaftVersion int Addr net.Addr Status serf.MemberStatus - NonVoter bool + ReadReplica bool ACLs structs.ACLMode FeatureFlags map[string]int @@ -160,7 +160,10 @@ func IsConsulServer(m serf.Member) (bool, *Server) { } // Check if the server is a non voter + // DEPRECATED - remove looking for the nonvoter tag eventually once we don't have to support + // read replicas running v1.8.x and below. _, nonVoter := m.Tags["nonvoter"] + _, readReplica := m.Tags["read_replica"] addr := &net.TCPAddr{IP: m.Addr, Port: port} @@ -182,7 +185,8 @@ func IsConsulServer(m serf.Member) (bool, *Server) { RaftVersion: raftVsn, Status: m.Status, UseTLS: useTLS, - NonVoter: nonVoter, + // DEPRECATED - remove nonVoter check once support for that tag is removed + ReadReplica: nonVoter || readReplica, ACLs: acls, FeatureFlags: featureFlags, } diff --git a/agent/metadata/server_test.go b/agent/metadata/server_test.go index 6b96785ccf..4f479472c0 100644 --- a/agent/metadata/server_test.go +++ b/agent/metadata/server_test.go @@ -66,7 +66,7 @@ func TestIsConsulServer(t *testing.T) { "expect": "3", "raft_vsn": "3", "use_tls": "1", - "nonvoter": "1", + "read_replica": "1", }, Status: serf.StatusLeft, } @@ -101,7 +101,7 @@ func TestIsConsulServer(t *testing.T) { if !parts.UseTLS { t.Fatalf("bad: %v", parts.UseTLS) } - if !parts.NonVoter { + if !parts.ReadReplica { t.Fatalf("unexpected voter") } m.Tags["bootstrap"] = "1" @@ -130,10 +130,16 @@ func TestIsConsulServer(t *testing.T) { t.Fatalf("unexpected bootstrap") } - delete(m.Tags, "nonvoter") + delete(m.Tags, "read_replica") ok, parts = metadata.IsConsulServer(m) - if !ok || parts.NonVoter { - t.Fatalf("unexpected nonvoter") + if !ok || parts.ReadReplica { + t.Fatalf("unexpected read replica") + } + + m.Tags["nonvoter"] = "1" + ok, parts = metadata.IsConsulServer(m) + if !ok || !parts.ReadReplica { + t.Fatalf("expected read replica") } delete(m.Tags, "role") diff --git a/agent/structs/structs_filtering_test.go b/agent/structs/structs_filtering_test.go index e13c98043c..319f47e9e2 100644 --- a/agent/structs/structs_filtering_test.go +++ b/agent/structs/structs_filtering_test.go @@ -11,12 +11,47 @@ import ( "github.com/hashicorp/consul/api" bexpr "github.com/hashicorp/go-bexpr" + "github.com/mitchellh/pointerstructure" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var dumpFieldConfig = flag.Bool("dump-field-config", false, "generate field config dump file") +func TestPointerStructure(t *testing.T) { + csn := CheckServiceNode{ + Node: &Node{ + ID: "f18f3a10-2153-40ae-af7d-68db0e856498", + Node: "node1", + Address: "198.18.0.1", + }, + Service: &NodeService{ + ID: "test", + Service: "test", + Port: 1234, + TaggedAddresses: map[string]ServiceAddress{ + "wan": { + Address: "1.1.1.1", + Port: 443, + }, + }, + }, + } + + ptr := pointerstructure.Pointer{ + Parts: []string{ + "Service", + "TaggedAddresses", + "wan", + "Address", + }, + } + + val, err := ptr.Get(csn) + require.NoError(t, err) + require.Equal(t, "1.1.1.1", val) +} + /////////////////////////////////////////////////////////////////////////////// // // NOTE: The tests within this file are designed to validate that the fields diff --git a/api/agent.go b/api/agent.go index 7b7fbdfc93..d392d08973 100644 --- a/api/agent.go +++ b/api/agent.go @@ -158,6 +158,15 @@ const ( // configured to use TLS. Any other value indicates that it was not setup in // that manner. MemberTagValueUseTLS = "1" + + // MemberTagKeyReadReplica is the key used to indicate that the member is a read + // replica server (will remain a Raft non-voter). + // Read Replicas are a Consul Enterprise feature. + MemberTagKeyReadReplica = "read_replica" + // MemberTagValueReadReplica is the value of the MemberTagKeyReadReplica key when + // the member is in fact a read-replica. Any other value indicates that it is not. + // Read Replicas are a Consul Enterprise feature. + MemberTagValueReadReplica = "1" ) type MemberACLMode string diff --git a/website/pages/docs/agent/options.mdx b/website/pages/docs/agent/options.mdx index da8dba391b..df7f41e1b9 100644 --- a/website/pages/docs/agent/options.mdx +++ b/website/pages/docs/agent/options.mdx @@ -479,7 +479,10 @@ The options below are all specified on the command-line. This overrides the default server RPC port 8300. This is available in Consul 1.2.2 and later. -- `-non-voting-server` ((#\_non_voting_server)) - This +- `-non-voting-server` ((#\_non_voting_server)) - **This field + is deprecated in Consul 1.9.1. See the [`-read-replica`](#_read_replica) flag instead.** + +- `-read-replica` ((#\_read_replica)) - This flag is used to make the server not participate in the Raft quorum, and have it only receive the data replication stream. This can be used to add read scalability to a cluster in cases where a high volume of reads to servers are needed. @@ -1852,7 +1855,9 @@ Valid time units are 'ns', 'us' (or 'µs'), 'ms', 's', 'm', 'h'." - `server` Equivalent to the [`-server` command-line flag](#_server). -- `non_voting_server` - Equivalent to the [`-non-voting-server` command-line flag](#_non_voting_server). +- `non_voting_server` - **This field is deprecated in Consul 1.9.1. See the [`read_replica`](#read_replica) field instead.** + +- `read_replica` - Equivalent to the [`-read-replica` command-line flag](#_read_replica). - `server_name` When provided, this overrides the [`node_name`](#_node) for the TLS certificate. It can be used to ensure that the certificate name matches diff --git a/website/pages/docs/enterprise/read-scale.mdx b/website/pages/docs/enterprise/read-scale.mdx index a5bb4102f7..cf2dd536fa 100644 --- a/website/pages/docs/enterprise/read-scale.mdx +++ b/website/pages/docs/enterprise/read-scale.mdx @@ -4,12 +4,10 @@ page_title: Consul Enterprise Enhanced Read Scalability sidebar_title: Enhanced Read Scalability description: >- Consul Enterprise supports increased read scalability without impacting write - latency by introducing - - non-voting servers. + latency by introducing read replicas. --- -# Enhanced Read Scalability with Non-Voting Servers +# Enhanced Read Scalability with Read Replicas This feature requires{' '} @@ -18,10 +16,10 @@ description: >- Consul Enterprise provides the ability to scale clustered Consul servers -to include voting and non-voting servers. Non-voting servers still receive data from the cluster replication, +to include voting servers and read replicas. Read replicas still receive data from the cluster replication, however, they do not take part in quorum election operations. Expanding your Consul cluster in this way can scale reads without impacting write latency. For more details, review the [Consul server configuration](/docs/agent/options) -documentation and the [-non-voting-server](/docs/agent/options#_non_voting_server) +documentation and the [-read-replica](/docs/agent/options#_read_replica) configuration flag. From 6a42641eb20a8acc94172c8b7adf512d605af88e Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 17 Nov 2020 13:13:38 -0500 Subject: [PATCH 10/36] Merge pull request #9160 from hashicorp/dnephin/go-test-race-in-to-out-list ci: change go-test-race package list to exclude list --- .circleci/config.yml | 9 ++++----- acl/authorizer_test.go | 2 -- acl/chained_authorizer_test.go | 10 ---------- acl/policy_authorizer_test.go | 9 --------- acl/static_authorizer_test.go | 6 ------ agent/auto-config/auto_config_test.go | 19 ++++++++++--------- connect/proxy/config_test.go | 4 +--- connect/proxy/proxy_test.go | 6 ++---- connect/service_test.go | 4 ++-- connect/testing.go | 7 ++++--- connect/tls.go | 5 ++++- 11 files changed, 27 insertions(+), 54 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b8eb39ec1..af00fc9180 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -236,16 +236,15 @@ jobs: name: go test -race command: | mkdir -p $TEST_RESULTS_DIR /tmp/jsonfile + pkgs="$(go list ./... | \ + grep -E -v '^github.com/hashicorp/consul/agent(/consul|/local|/xds|/routine-leak-checker)?$' | \ + grep -E -v '^github.com/hashicorp/consul/command/')" gotestsum \ - --format=short-verbose \ --jsonfile /tmp/jsonfile/go-test-race.log \ --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \ -tags="$GOTAGS" -p 2 \ -race -gcflags=all=-d=checkptr=0 \ - ./agent/{ae,cache,cache-types,checks,config,pool,proxycfg,router}/... \ - ./agent/consul/{authmethod,fsm,state,stream}/... \ - ./agent/{grpc,rpc,rpcclient,submatview}/... \ - ./snapshot + $pkgs - store_test_results: path: *TEST_RESULTS_DIR diff --git a/acl/authorizer_test.go b/acl/authorizer_test.go index b5534b00cd..b1833efd14 100644 --- a/acl/authorizer_test.go +++ b/acl/authorizer_test.go @@ -195,8 +195,6 @@ func (m *mockAuthorizer) Snapshot(ctx *AuthorizerContext) EnforcementDecision { } func TestACL_Enforce(t *testing.T) { - t.Parallel() - type testCase struct { method string resource Resource diff --git a/acl/chained_authorizer_test.go b/acl/chained_authorizer_test.go index 4ff7b2e4f1..870a00f9c3 100644 --- a/acl/chained_authorizer_test.go +++ b/acl/chained_authorizer_test.go @@ -94,11 +94,7 @@ func (authz testAuthorizer) Snapshot(*AuthorizerContext) EnforcementDecision { } func TestChainedAuthorizer(t *testing.T) { - t.Parallel() - t.Run("No Authorizers", func(t *testing.T) { - t.Parallel() - authz := NewChainedAuthorizer([]Authorizer{}) checkDenyACLRead(t, authz, "foo", nil) checkDenyACLWrite(t, authz, "foo", nil) @@ -129,8 +125,6 @@ func TestChainedAuthorizer(t *testing.T) { }) t.Run("Authorizer Defaults", func(t *testing.T) { - t.Parallel() - authz := NewChainedAuthorizer([]Authorizer{testAuthorizer(Default)}) checkDenyACLRead(t, authz, "foo", nil) checkDenyACLWrite(t, authz, "foo", nil) @@ -161,8 +155,6 @@ func TestChainedAuthorizer(t *testing.T) { }) t.Run("Authorizer No Defaults", func(t *testing.T) { - t.Parallel() - authz := NewChainedAuthorizer([]Authorizer{testAuthorizer(Allow)}) checkAllowACLRead(t, authz, "foo", nil) checkAllowACLWrite(t, authz, "foo", nil) @@ -193,8 +185,6 @@ func TestChainedAuthorizer(t *testing.T) { }) t.Run("First Found", func(t *testing.T) { - t.Parallel() - authz := NewChainedAuthorizer([]Authorizer{testAuthorizer(Deny), testAuthorizer(Allow)}) checkDenyACLRead(t, authz, "foo", nil) checkDenyACLWrite(t, authz, "foo", nil) diff --git a/acl/policy_authorizer_test.go b/acl/policy_authorizer_test.go index 0f074e49aa..d303eea924 100644 --- a/acl/policy_authorizer_test.go +++ b/acl/policy_authorizer_test.go @@ -13,8 +13,6 @@ import ( // ensure compatibility from version to version those tests have been only minimally altered. The tests in this // file are specific to the newer functionality. func TestPolicyAuthorizer(t *testing.T) { - t.Parallel() - type aclCheck struct { name string prefix string @@ -446,8 +444,6 @@ func TestPolicyAuthorizer(t *testing.T) { name := name tcase := tcase t.Run(name, func(t *testing.T) { - t.Parallel() - authz, err := NewPolicyAuthorizer([]*Policy{tcase.policy}, nil) require.NoError(t, err) @@ -458,7 +454,6 @@ func TestPolicyAuthorizer(t *testing.T) { } t.Run(checkName, func(t *testing.T) { check := check - t.Parallel() check.check(t, authz, check.prefix, nil) }) @@ -468,8 +463,6 @@ func TestPolicyAuthorizer(t *testing.T) { } func TestAnyAllowed(t *testing.T) { - t.Parallel() - type radixInsertion struct { segment string value *policyAuthorizerRadixLeaf @@ -719,8 +712,6 @@ func TestAnyAllowed(t *testing.T) { } func TestAllAllowed(t *testing.T) { - t.Parallel() - type radixInsertion struct { segment string value *policyAuthorizerRadixLeaf diff --git a/acl/static_authorizer_test.go b/acl/static_authorizer_test.go index a2865754ee..b9ed590933 100644 --- a/acl/static_authorizer_test.go +++ b/acl/static_authorizer_test.go @@ -5,11 +5,7 @@ import ( ) func TestStaticAuthorizer(t *testing.T) { - t.Parallel() - t.Run("AllowAll", func(t *testing.T) { - t.Parallel() - authz := AllowAll() checkDenyACLRead(t, authz, "foo", nil) checkDenyACLWrite(t, authz, "foo", nil) @@ -40,7 +36,6 @@ func TestStaticAuthorizer(t *testing.T) { }) t.Run("DenyAll", func(t *testing.T) { - t.Parallel() authz := DenyAll() checkDenyACLRead(t, authz, "foo", nil) checkDenyACLWrite(t, authz, "foo", nil) @@ -71,7 +66,6 @@ func TestStaticAuthorizer(t *testing.T) { }) t.Run("ManageAll", func(t *testing.T) { - t.Parallel() authz := ManageAll() checkAllowACLRead(t, authz, "foo", nil) checkAllowACLWrite(t, authz, "foo", nil) diff --git a/agent/auto-config/auto_config_test.go b/agent/auto-config/auto_config_test.go index b8ab0caf45..dc413ed4d0 100644 --- a/agent/auto-config/auto_config_test.go +++ b/agent/auto-config/auto_config_test.go @@ -634,6 +634,7 @@ type testAutoConfig struct { ac *AutoConfig tokenUpdates chan struct{} originalToken string + stop func() initialRoots *structs.IndexedCARoots initialCert *structs.IssuedCert @@ -835,6 +836,7 @@ func startedAutoConfig(t *testing.T, autoEncrypt bool) testAutoConfig { initialRoots: indexedRoots, initialCert: cert, extraCerts: extraCerts, + stop: cancel, } } @@ -1098,16 +1100,15 @@ func TestFallback(t *testing.T) { // now wait for the fallback routine to be invoked require.True(t, waitForChans(100*time.Millisecond, fallbackCtx.Done()), "fallback routines did not get invoked within the alotted time") - // persisting these to disk happens after the RPC we waited on above will have fired - // There is no deterministic way to know once its been written so we wrap this in a retry. - testretry.Run(t, func(r *testretry.R) { - resp, err := testAC.ac.readPersistedAutoConfig() - require.NoError(r, err) + testAC.stop() + <-testAC.ac.done - // ensure the roots got persisted to disk - require.Equal(r, thirdCert.CertPEM, resp.Certificate.GetCertPEM()) - require.Equal(r, secondRoots.ActiveRootID, resp.CARoots.GetActiveRootID()) - }) + resp, err := testAC.ac.readPersistedAutoConfig() + require.NoError(t, err) + + // ensure the roots got persisted to disk + require.Equal(t, thirdCert.CertPEM, resp.Certificate.GetCertPEM()) + require.Equal(t, secondRoots.ActiveRootID, resp.CARoots.GetActiveRootID()) } func TestIntroToken(t *testing.T) { diff --git a/connect/proxy/config_test.go b/connect/proxy/config_test.go index 6ba5603089..f076d626cc 100644 --- a/connect/proxy/config_test.go +++ b/connect/proxy/config_test.go @@ -5,12 +5,12 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/hashicorp/consul/agent" "github.com/hashicorp/consul/api" "github.com/hashicorp/consul/connect" "github.com/hashicorp/consul/sdk/testutil" - "github.com/stretchr/testify/require" ) func TestUpstreamResolverFuncFromClient(t *testing.T) { @@ -79,8 +79,6 @@ func TestUpstreamResolverFuncFromClient(t *testing.T) { } func TestAgentConfigWatcherSidecarProxy(t *testing.T) { - t.Parallel() - a := agent.StartTestAgent(t, agent.TestAgent{Name: "agent_smith"}) defer a.Shutdown() diff --git a/connect/proxy/proxy_test.go b/connect/proxy/proxy_test.go index 64765ca8a2..f280387a1d 100644 --- a/connect/proxy/proxy_test.go +++ b/connect/proxy/proxy_test.go @@ -5,7 +5,7 @@ import ( "net" "testing" - "github.com/hashicorp/consul/testrpc" + "github.com/stretchr/testify/require" "github.com/hashicorp/consul/agent" agConnect "github.com/hashicorp/consul/agent/connect" @@ -14,12 +14,10 @@ import ( "github.com/hashicorp/consul/sdk/freeport" "github.com/hashicorp/consul/sdk/testutil" "github.com/hashicorp/consul/sdk/testutil/retry" - "github.com/stretchr/testify/require" + "github.com/hashicorp/consul/testrpc" ) func TestProxy_public(t *testing.T) { - t.Parallel() - require := require.New(t) ports := freeport.MustTake(1) diff --git a/connect/service_test.go b/connect/service_test.go index 49c4877007..1ee66ce83d 100644 --- a/connect/service_test.go +++ b/connect/service_test.go @@ -14,13 +14,13 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/hashicorp/consul/agent" "github.com/hashicorp/consul/agent/connect" "github.com/hashicorp/consul/api" "github.com/hashicorp/consul/sdk/testutil/retry" "github.com/hashicorp/consul/testrpc" - "github.com/stretchr/testify/require" ) // Assert io.Closer implementation @@ -89,8 +89,8 @@ func TestService_Dial(t *testing.T) { err := testSvr.Serve() require.NoError(err) }() - defer testSvr.Close() <-testSvr.Listening + defer testSvr.Close() } // Always expect to be connecting to a "DB" diff --git a/connect/testing.go b/connect/testing.go index 4554add0e8..30a517b61f 100644 --- a/connect/testing.go +++ b/connect/testing.go @@ -10,11 +10,12 @@ import ( "net/http" "sync/atomic" + "github.com/hashicorp/go-hclog" + testing "github.com/mitchellh/go-testing-interface" + "github.com/hashicorp/consul/agent/connect" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/sdk/freeport" - "github.com/hashicorp/go-hclog" - testing "github.com/mitchellh/go-testing-interface" ) // TestService returns a Service instance based on a static TLS Config. @@ -124,8 +125,8 @@ func (s *TestServer) Serve() error { if err != nil { return err } - close(s.Listening) s.l = l + close(s.Listening) log.Printf("test connect service listening on %s", s.Addr) for { diff --git a/connect/tls.go b/connect/tls.go index e465d3a10a..a79fe7c8a3 100644 --- a/connect/tls.go +++ b/connect/tls.go @@ -13,9 +13,10 @@ import ( "strings" "sync" + "github.com/hashicorp/go-hclog" + "github.com/hashicorp/consul/agent/connect" "github.com/hashicorp/consul/api" - "github.com/hashicorp/go-hclog" ) // parseLeafX509Cert will parse an X509 certificate @@ -460,5 +461,7 @@ func (cfg *dynamicTLSConfig) Ready() bool { // method will not stop returning a nil chan in that case. It is only useful // for initial startup. For ongoing health Ready() should be used. func (cfg *dynamicTLSConfig) ReadyWait() <-chan struct{} { + cfg.RLock() + defer cfg.RUnlock() return cfg.readyCh } From 63e96d70ff7aec337ded9b7a316c99610a03c9b9 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 18 Nov 2020 11:11:02 +0000 Subject: [PATCH 11/36] ui: Add triple curlies and reformat style attribute (#9210) --- ui/packages/consul-ui/app/components/tab-nav/index.hbs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/packages/consul-ui/app/components/tab-nav/index.hbs b/ui/packages/consul-ui/app/components/tab-nav/index.hbs index 62a978ecb4..1e9d2d7cb3 100644 --- a/ui/packages/consul-ui/app/components/tab-nav/index.hbs +++ b/ui/packages/consul-ui/app/components/tab-nav/index.hbs @@ -1,5 +1,12 @@