Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't nest attributes under message in newrelic logs appender #300

Open
fabn opened this issue Oct 2, 2024 · 0 comments
Open

Don't nest attributes under message in newrelic logs appender #300

fabn opened this issue Oct 2, 2024 · 0 comments

Comments

@fabn
Copy link

fabn commented Oct 2, 2024

Environment

Provide at least:

  • Ruby Version: 3.2.2
  • Semantic Logger Version: 4.16.0
  • Application/framework names and versions (Rails 7.x)
  • Rails Semantic Logger Version, if applicable. 4.17.0

Expected Behavior

In JSON should be something like:

{
  "entity.guid": "MTQ0ODQ2MHxBUE18QVBQTElDQVRJT058OTY2Mjk2ODk",
  "entity.guids": "MTQ0ODQ2MHxBUE18QVBQTElDQVRJT058OTY2Mjk2ODk",
  "entity.name": "Motohelp Rails (staging)",
  "entity.type": "SERVICE",
  "file.name": "(pry)",
  "hostname": "worker-6b6c685bf7-8b8c8",
  "level": "INFO",
  "line.number": "2",
  "logger.name": "Test",
  "application": "Semantic Logger",
  "duration": 100,
  "duration_human": "100.0ms",
  "environment": "production",
  "message": "Login time",
  "payload.ip_address": "127.0.0.1",
  "payload.user": "Joe",
  "tags": "[]",
  "newrelic.source": "logs.APM",
  "thread.name": "6500",
  "timestamp": 1727874680026
}

Actual Behavior

Current behavior implemented in #222 is to nest everything under message key (I guess because NR method to log doesn't support attributes), so by using your appender we get this:

image

It would be super nice to lift everything in top level, They implemented newrelic/newrelic-ruby-agent#2084 (and also have a proposal to have them contextually newrelic/newrelic-ruby-agent#2297)

I don't know if NewRelic::Agent.agent.log_event_aggregator.add_custom_attributes(foo: 'bar', baz: 'bat') can be used as is, but it could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant