Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
resolve agent ip on init
Browse files Browse the repository at this point in the history
to avoid millions of lookups to an adress that
will almost never change
  • Loading branch information
josh barney committed Jun 11, 2017
1 parent c39a879 commit 5b987f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions rebar.lock
@@ -0,0 +1,8 @@
{"1.1.0",
[{<<"stillir">>,{pkg,<<"stillir">>,<<"1.0.0">>},0},
{<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"2.1.0">>},0}]}.
[
{pkg_hash,[
{<<"stillir">>, <<"9E77EAADD2418A61EC7398C01E29DEA26D14F51C42E0B309084493E3ED33337A">>},
{<<"worker_pool">>, <<"6A5C16DDC93705FEBA768F1489EF1CF0D3C787EFDAA7008684D67130E8697891">>}]}
].
3 changes: 2 additions & 1 deletion src/dogstatsd_worker.erl
Expand Up @@ -33,9 +33,10 @@ init([]) ->
State = case stillir:get_config(dogstatsd, send_metrics) of
true ->
{ok, Socket} = gen_udp:open(0),
Ip = inet:getaddr(stillir:get_config(dogstatsd, agent_address), inet),
#state{
socket = Socket,
host = stillir:get_config(dogstatsd, agent_address),
host = Ip,
port = stillir:get_config(dogstatsd, agent_port),
prefix = stillir:get_config(dogstatsd, global_prefix),
tags = stillir:get_config(dogstatsd, global_tags)
Expand Down

0 comments on commit 5b987f4

Please sign in to comment.