-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multi Error Reporting, Custom Report Attrs, and Clean Up
Implemented ability to report multiple apm errors from one log. If a user adds multiple "reportable" error attributes to the log msg (default is "error" & "err"), instead of trying to join the errors into one or discarding one, the apmslog handler will report both errors. Added ability for a user to define what slog attribute keys they want to report as errors. Because there is no standard way in slog to attach an error to a msg log, I wanted to add the ability for the user to decide what is and what is not going to be reported. By default, slog attribute keys that are "error" or "err" are reported, but with the new `WithErrorRecordAttrs(keys)` function a user can define which keys will be reported. Cleaned up `ApmHandler` struct and methods. Since we want the user to use the included `NewApmHandler` function and its functional option functions, I decided to make all Struct fields private. Additionally added a check on if the `ApmHandler`'s `tracer` field is nill before trying to use it. It is still possible for a user to pass in a nil tracer using the `WithTracer` functional option. New tests and documentation added.
- Loading branch information
1 parent
815703c
commit 09e015c
Showing
6 changed files
with
327 additions
and
66 deletions.
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.