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

Can't get filter_args: false to work #368

Closed
joshuap opened this issue Jun 21, 2021 · 2 comments
Closed

Can't get filter_args: false to work #368

joshuap opened this issue Jun 21, 2021 · 2 comments

Comments

@joshuap
Copy link
Member

joshuap commented Jun 21, 2021

I've been trying to test out the feature where method arguments are included in the stack trace (see filter_args config option), but can't make it work. What am I doing wrong?

Steps to Reproduce

  1. Bootstrap a new Phoenix app
# https://hexdocs.pm/phoenix/installation.html
# https://hexdocs.pm/phoenix/up_and_running.html
mix archive.install hex phx_new 1.5.9
mix phx.new hello
cd hello
mix ecto.create
mix phx.server
# or: iex -S mix phx.server
  1. Install honeybadger package
defp deps do
  [{:honeybadger, "~> 0.12"}]
end
  1. Configure honeybadger in config/config.exs
config :honeybadger,
  api_key: "project API key",
  environment_name: :prod,
  use_logger: false,
  filter_args: false
  1. Add Honeybadger Plug to lib/hello_web/router.ex
defmodule HelloWeb.Router do
  use HelloWeb, :router
  use Honeybadger.Plug

  # ...
end
  1. Edit lib/hello_web/controllers/page_controller.ex
defmodule HelloWeb.PageController do
  use HelloWeb, :controller
  
  def index(conn, _params) do
    # render(conn, "index.html")
    raise_error(conn, "random string")
  end
  
  defp raise_error(conn, string) do
    raise "test error"
  end
end

Result

No args:

image

I'm expecting to see something like: raise_error(%{ conn inspect output }, "random string")

@TraceyOnim
Copy link
Contributor

@joshuap I have debugged the issue, here is the stack trace that I'm receiving from my phoenix app , which I'm suspecting is the same stack trace that honey badger might be receiving from your end.

{HelloWeb.PageController, :new,  2,
   [file: 'lib/hello_web/controllers/page_controller.ex', line: 8]}

In this case , the args is received as an integer which represents the arity of the function.
The format_args/2 which takes in the arg and filter_args will always match line backtrace.ex 56 returning an empty list hence not displaying the function with its argument i.e raise_error(%{ conn inspect output }, "random string")

@joshuap
Copy link
Member Author

joshuap commented Jul 7, 2021

@TraceyOnim ah, I forgot that there are some known cases where the full arguments are not available. Here is some relevant info:

#115 (comment)
#123

I'll continue to track improvements to this feature in #123.

Thanks for double-checking!

@joshuap joshuap closed this as completed Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants