Closed rparcus closed 6 months ago
I think this issue is already solved in one of the recent releases, take a look: https://github.com/Nebo15/logger_json/pull/87. You can override the hostname with any value reading it from the system environment or just avoid setting it and let DataDog agent to put it for you.
FYI: The problem with swapping them is that not everyone is using --name
option and even :net_adm.localhost()
is not reliable in some cases, for example for our production environment results for both of those functions are precisely the same and not a FQDN:
iex(talkinto-domain@10-3-0-14.talkinto.pod.cluster.local)1> :inet.gethostname()
{:ok, 'talkinto-workers-messaging-5f7996c66f-n9t5s'}
iex(talkinto-domain@10-3-0-14.talkinto.pod.cluster.local)2> :net_adm.localhost()
'talkinto-workers-messaging-5f7996c66f-n9t5s'
There are some limitations for which those two options do not work for us.
Would adding a config that allows users to pick between :inet.gethostname()
and :net_adm.localhost()
be ok?
This can be set in the current version using the hostname
option of the formatter.
We noticed that
:inet.gethostname()
is not sending fully qualified domain names to datadog. A simple fix would be to use:net_adm.localhost()
and the--name
option.We can have a PR swapping the two functions and call it a day. Would you see any drawbacks in abandoning
:inet.gethostname/0
?cc: @rudebono