beam-telemetry / telemetry_metrics_statsd

Telemetry.Metrics reporter for StatsD-compatible metric servers
https://hexdocs.pm/telemetry_metrics_statsd
MIT License
75 stars 44 forks source link

Fix incorrect state when hostname resolution fails #96

Closed juanperi closed 4 months ago

juanperi commented 4 months ago

This PR is much less ambitious than #94 (and so I expect it would be an easier merge). In this case, we just fix the issue when the process is already started, but an error in the resolution of the hostname leads to an incorrect internal state.

Without this patch, the new_state will be :ok, as that is the return from the logger function. Afterwards, when going to the terminate callback, then we try to call EventHandler.detach(state.handler_ids), which translates to EventHandler.detach(:ok.handler_ids) and fails.

sunnybit commented 4 months ago

👍

sunnybit commented 4 months ago

@arkgil could you review this PR, this enables us to move away from forked version of the library

arkgil commented 4 months ago

Thanks!