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

Error parsing error info in logger translator #430

Open
tpitale opened this issue Mar 19, 2024 · 8 comments
Open

Error parsing error info in logger translator #430

tpitale opened this issue Mar 19, 2024 · 8 comments

Comments

@tpitale
Copy link
Contributor

tpitale commented Mar 19, 2024

Describe the bug

Seem to be having an error on startup in our service where parse_error_info(nil) is being called. If we trace this up the stack we get to some newly changed code around error reporting in the logger translator.

15:52:33.199 [info] Failure while translating Erlang's logger event
** (FunctionClauseError) no function clause matching in NewRelic.Error.Reporter.parse_error_info/1
    (new_relic_agent 1.29.0) lib/new_relic/error/reporter.ex:91: NewRelic.Error.Reporter.parse_error_info(nil)
    (new_relic_agent 1.29.0) lib/new_relic/error/reporter.ex:44: NewRelic.Error.Reporter.report_error/2
    (new_relic_agent 1.29.0) lib/new_relic/error/logger_handler.ex:16: NewRelic.Error.LoggerHandler.translator/4
    (logger 1.15.7) lib/logger/utils.ex:47: Logger.Utils.translate/5
    (logger 1.15.7) lib/logger/utils.ex:28: Logger.Utils.translator/2
    (kernel 9.2.2) logger_backend.erl:101: :logger_backend.do_apply_filters/4
    (kernel 9.2.2) logger_backend.erl:86: :logger_backend.apply_filters/4
    (kernel 9.2.2) logger_backend.erl:32: :logger_backend.log_allowed/3

Environment

  • Erlang 26.2.3
  • Elixir 1.15.7

This line seems different than the docs suggest: https://github.com/newrelic/elixir_agent/pull/421/files#diff-810b4a095e0cf9779a97430561fa26fb924a45377bb2f61394bc4849a14f45a7R22

Docs: https://hexdocs.pm/logger/1.15.7/Logger.Translator.html#c:translate/4

@tpitale
Copy link
Contributor Author

tpitale commented Mar 19, 2024

This causes our translator to be removed and we miss errors.

@tmaszk Do you happen to have any ideas why the report would be nil from the translator function call?

@tpitale
Copy link
Contributor Author

tpitale commented Mar 19, 2024

This code looks like it takes min_level, level, :format | :report, and the report itself, which is either a map or a keyword list.

https://github.com/elixir-lang/elixir/blob/v1.15.7/lib/logger/lib/logger/translator.ex#L35

@tpitale
Copy link
Contributor Author

tpitale commented Mar 20, 2024

I've tried to trigger the translator using Logger.error() and raise. I'm guessing the apparatus is more complicated to get in there. If anyone knows how, let me know and I'll write some tests.

@tpitale
Copy link
Contributor Author

tpitale commented Mar 21, 2024

Okay, in essence, we are getting a message through that does not include :error_info in the kw list. Not sure if best to guard against that case, or continue to dig to try to find out what is being sent to us.

@tpitale
Copy link
Contributor Author

tpitale commented Mar 21, 2024

Going to fork it and update our app to add more logging on this. See what we get on startup.

@tpitale
Copy link
Contributor Author

tpitale commented Mar 21, 2024

Looks like a bunch of kafka messages from erlkaf (an erlang lib). Going to check if it is a :format or :report.

@tpitale
Copy link
Contributor Author

tpitale commented Mar 21, 2024

Okay, so these are only of kind = :format. I think I'm going to PR filtering down to just :report.

@tomtaylor
Copy link
Contributor

I get a very similar exception when I enable tracing on a function using recon_trace. Did you get anywhere with this?

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

2 participants