logger_json
logger_json copied to clipboard
App not passing FQDNs to datadog.
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.
iex([email protected])3> :inet.gethostname()
{:ok, 'corp-7220'}
iex([email protected])4> :net_adm.localhost()
'corp-7220.us-central1-c.c.corp-integ-0.internal'
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
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([email protected])1> :inet.gethostname()
{:ok, 'talkinto-workers-messaging-5f7996c66f-n9t5s'}
iex([email protected])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.