Skip to content

Instantly share code, notes, and snippets.

@tony612
Created May 22, 2019 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tony612/30219f899bc455e326e3ca1d4e0411c9 to your computer and use it in GitHub Desktop.
Save tony612/30219f899bc455e326e3ca1d4e0411c9 to your computer and use it in GitHub Desktop.
defmodule Sentry.Fingerprinter do
def custom_fingerprints(metadata, _msg) do
file = Keyword.get(metadata, :file)
line = Keyword.get(metadata, :line)
if file && line do
%{
application: Keyword.get(metadata, :application),
module: Keyword.get(metadata, :module),
function: Keyword.get(metadata, :function),
file: file,
line: line
}
|> Enum.reject(fn {_, v} -> is_nil(v) end)
|> Enum.map(fn {k, v} ->
"#{k}:#{v}"
end)
else
crash_reason = Keyword.get(metadata, :crash_reason)
case crash_reason do
{err, stacktrace} ->
["error:#{Exception.format(:error, err, stacktrace)}"]
_ ->
nil
end
end
rescue
_ ->
nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment