[CC-4519] Include Consul NodeID in Envoy bootstrap metadata (#17139)

This is being added so that metrics sent to HCP can be augmented with the source node's ID.

Opting not to add this to stats_tag out of caution, since it would increase the cardinality of metrics emitted by Envoy for all users.

There is no functional impact to Envoy expected from this change.
This commit is contained in:
Freddy 2023-04-26 10:04:57 -06:00 committed by GitHub
parent 75669ed4c4
commit c5c35ec924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 50 additions and 0 deletions

View File

@ -17,6 +17,9 @@ type BootstrapTplArgs struct {
// the agent to deliver the correct configuration.
ProxyID string
// NodeID is the ID of the node on which the proxy service instance is registered.
NodeID string
// NodeName is the name of the node on which the proxy service instance is registered.
NodeName string
@ -184,6 +187,7 @@ const bootstrapTemplate = `{
{{- if .NodeName }}
"node_name": "{{ .NodeName }}",
{{- end }}
"node_id": "{{ .NodeID }}",
"namespace": "{{if ne .Namespace ""}}{{ .Namespace }}{{else}}default{{end}}",
"partition": "{{if ne .Partition ""}}{{ .Partition }}{{else}}default{{end}}"
}

View File

@ -722,6 +722,12 @@ func (c *cmd) generateConfig() ([]byte, error) {
args.Datacenter = datacenter
}
info, err := c.client.Agent().Self()
if err != nil {
return nil, err
}
args.NodeID, _ = info["Config"]["NodeID"].(string)
if err := generateAccessLogs(c, args); err != nil {
return nil, err
}

View File

@ -1691,6 +1691,7 @@ func testMockAgentSelf(
resp := agent.Self{
Config: map[string]interface{}{
"Datacenter": "dc1",
"NodeID": "7cbef9fc-4fb1-4c84-b100-689db9755449",
},
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -25,6 +25,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -47,6 +47,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -13,6 +13,7 @@
"id": "test-proxy",
"metadata": {
"node_name": "test-node",
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "ingress-gateway",
"id": "ingress-gateway",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "ingress-gateway",
"id": "ingress-gateway",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -13,6 +13,7 @@
"id": "ingress-gateway-1",
"metadata": {
"node_name": "test-node",
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "my-gateway-123",
"id": "my-gateway-123",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "my-gateway",
"id": "my-gateway",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "ingress-gateway-1",
"id": "ingress-gateway-1",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}

View File

@ -12,6 +12,7 @@
"cluster": "test",
"id": "test-proxy",
"metadata": {
"node_id": "7cbef9fc-4fb1-4c84-b100-689db9755449",
"namespace": "default",
"partition": "default"
}