4

I am trying to configure stats sink to collect stats into statsd.

I have configured the envoy.yaml as follows:

admin:
  access_log_path: /logs/envoy_access.log
  address:
    socket_address:
      protocol: TCP
      address: 0.0.0.0
      port_value: 8001

stats_sinks:
  name: envoy.statsd
  config:
    tcp_cluster_name: statsd-exporter

static_resources:
  ...


  clusters:

    - name: app
      connect_timeout: 0.25s
      type: strict_dns
      lb_policy: round_robin
      hosts:
        - socket_address:
            address: {{appName}}
            port_value: {{appPort}}

    - name: statsd-exporter
      connect_timeout: 0.25s
      type: strict_dns
      lb_policy: round_robin
      hosts:
        - socket_address:
            address: statsd_exporter
            port_value: 9125

statsd is built as container within the same docker network.

When I run the docker containers with Envoy and statsd, Envoy shows the following error:

proxy_1            | [2019-05-06 04:50:38.006][27][info][main] [source/server/server.cc:516] exiting
proxy_1            | tcp statsd: node 'id' and 'cluster' are required. Set it either in 'node'
config or via --service-node and --service-cluster options.
template-starter-windows_proxy_1 exited with code 1

How do I resolve this error?

Update

I was able to resolve the error by setting the --service-cluster and --service-node parameters for envoy command: envoy -c /etc/envoy/envoy.yaml --service-cluster 'front-envoy' --service-node 'front-envoy'

I am not sure why using statsd sink would require these parameters to be set. and The documentation for envoy does not mention this information,

coder_bro
  • 10,503
  • 13
  • 56
  • 88
  • 2
    The docs may not have mentioned this at the time you ran into this problem, but the docs do mention these as requirements now: [service cluster](https://www.envoyproxy.io/docs/envoy/v1.8.0/operations/cli#cmdoption-service-cluster) and [service node](https://www.envoyproxy.io/docs/envoy/v1.8.0/operations/cli#cmdoption-service-node). The docs on the [stats](https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/metrics/v2/stats.proto#envoy-api-msg-config-metrics-v2-statsdsink) section don't mention that those are required though, so it seems like this is a matter of clarity in the docs. – Jimberley Feb 13 '20 at 16:32
  • 1
    The docs may not have mentioned this at the time you ran into this problem, but the docs do mention these as requirements now: [service cluster](https://www.envoyproxy.io/docs/envoy/v1.8.0/operations/cli#cmdoption-service-cluster) and [service node](https://www.envoyproxy.io/docs/envoy/v1.8.0/operations/cli#cmdoption-service-node). The docs on the [stats](https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/metrics/v2/stats.proto#envoy-api-msg-config-metrics-v2-statsdsink) section don't mention that those are required though, so it seems like this is a matter of clarity in the docs. – Jimberley Feb 13 '20 at 16:32

1 Answers1

0

You're right, the docs suggest passing argument flags to bypass the error. I agree this is unsatisfying. I'm not sure why the docs under "examples" don't provide working yaml out of the box.

To use envoy.yml to the same configuration as these CLI args, I've added the following top level entry:

node:
  id: foo_id
  cluster: foo_cluster

so your full envoy.yml will look some thing like:

node:
  id: foo_id
  cluster: foo_cluster

admin:
  ...
  ...

stats_sinks:
  ...
  ...

static_resources:
  ...
  ...
Matthew
  • 3,510
  • 2
  • 23
  • 24