Open flivni opened 1 year ago
Hi @flivni! Thanks for calling attention to this and providing a suggested fix. process_host.display_name
isn’t being applied to log events. This is a change we’d like to make!
The features for log events need to be consistent across all New Relic’s agents. Since this is a new feature, we will need to bring this back to our team before making updates as there are a few other changes that need to take place and processes to go through. We will follow up with updates.
Thanks again for reporting this!
Thanks @hannahramadan. I look forward to the updates.
The logger does not use
process_host.display_name
when settinghostname
in the logs. Instead it usesSocket.gethostname
via a call toNewRelic::Agent::Hostname.get
.I believe it is a bug. (In another issue, a New Relic developer assumes the feature already acts this way when she says "Alternatively, we have the ability to set the app name (entity.name in the default attributes) and hostname by configuration in either the newrelic.yml file or by environment variable"). https://github.com/newrelic/newrelic-ruby-agent/issues/1141
You can see the offending code here: https://github.com/newrelic/newrelic-ruby-agent/blob/74737a46a141d1d7e251c06f8db157743b02f3d8/lib/new_relic/agent/logging.rb#L51
I think the fix is to just replace with:
Agent.config[:'process_host.display_name']
I can create a PR if that would be helpful.
Thanks!