-
Notifications
You must be signed in to change notification settings - Fork 1
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
Set session from Logger metadata #29
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdfrens
requested review from
samgranieri,
Serneum,
wumbabum,
cbourg2,
PhiMed and
spearce-citybase
April 1, 2024 18:44
jdfrens
force-pushed
the
set-session-from-logger-metadata
branch
from
April 1, 2024 18:48
57d67fa
to
b64271f
Compare
wumbabum
approved these changes
Apr 1, 2024
backtrace: Backtrace.from_stacktrace(stacktrace) | ||
def new(exception, stacktrace, opts) when is_list(exception) do | ||
%__MODULE__{ | ||
errors: [Builder.build_error(exception, stacktrace)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner 👍 👍
samgranieri
approved these changes
Apr 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The basic use case we wanted to solve was to add a
request_id
in an Airbrake report. This makes the most sense in thesession
field for the report. We also realized that we're storing therequest_id
in the Logger metadata, and we're storing a lot of useful information in the Logger metadata. Let's face it: if it's in the Logger metadata, it's good for debugging. So it seems natural to also include it in an Airbrake report.Adding Logger metadata to the session is optional. You need to set
session: :include_logger_metadata
in the:airbrake_client
config.All values from
Logger.metadata()
are added to thesession
field. The map for:session
in theopts
passed to areport/?
function overrides the Logger metadata.Testing
I used this code to manually test:
Ran it like this:
mix compile && iex -S mix run manual_test.exs
Screenshots: