relay icon indicating copy to clipboard operation
relay copied to clipboard

Add environment config for metrics.statsd

Open low613 opened this issue 7 months ago • 3 comments

It would be beneficial to have an environment variable that can override the metrics statsd endpoint. This would allow for more flexible configurations in different environments without needing to change the configuration file directly.

low613 avatar May 22 '25 05:05 low613

With the latest release you can use environment variable references in the config (it's just not yet documented).

Setting the endpoint to a variable in the format ${STATSD_ENDPOINT} will read it from the environment variable STATSD_ENDPOINT.

Dav1dde avatar May 22 '25 10:05 Dav1dde

I tried using that environment variable however it still isn't working RELAY_MODE=proxy STATSD_ENDPOINT=127.0.0.1:8125 ./relay run --log-level debug

does not output the log line INFO relay_statsd: reporting metrics to statsd at 127.0.0.1:8125 compared to when I set it in config.yml

low613 avatar May 22 '25 22:05 low613

Did you also set the reference in the config as mentioned?

metrics:
    statsd: "${STATSD_ENDPOINT}"
    prefix: relay
   ...

Dav1dde avatar May 23 '25 07:05 Dav1dde

I did not try use that format, I was attempting to set up the relay with no config file, rather using environment variables to configure it entirely, this is so that I can use the default docker image without having to mount any volumes or rebuild a custom image with the config file hard baked into it.

low613 avatar Jun 08 '25 23:06 low613

I'd be surprised if you get away without having the need for a file, it depends a bit on what mode you configure but very likely you'll always need to have credentials or at least some properties configured.

Dav1dde avatar Jun 09 '25 16:06 Dav1dde

Closing, as this should work already.

Dav1dde avatar Jun 18 '25 12:06 Dav1dde