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

Feat: report request and error to rollbar #1

Closed
wants to merge 2 commits into from
Closed

Feat: report request and error to rollbar #1

wants to merge 2 commits into from

Conversation

jmfederico
Copy link
Contributor

Rollbar knows how to report extra request data and extract information from errors if it is explicitly told to do so.

This PR takes inspiration from the official rollbar-go client and its Log function to do so.

Change sin this PR:

  • Implement a default ReplaceAttr to remove *http.Request attributes (as rollbar breaks if they are passed to it)
  • Extract *http.Request and error objects from slog.Record
  • Dispatch the correct reporter method following the same logic as the official rollbar-go client

@jmfederico
Copy link
Contributor Author

Closing in favour of #2.
New branch name needed since go would not allow having "/" in version specifier for replace directive in go.mod

This is valid:
replace github.com/samber/slog-rollbar/v2 v2.6.0 => github.com/jmfederico/slog-rollbar/v2 report-request-and-error

This is not
replace github.com/samber/slog-rollbar/v2 v2.6.0 => github.com/jmfederico/slog-rollbar/v2 feat/report-request-and-error

@jmfederico jmfederico closed this Aug 27, 2024
@jmfederico jmfederico deleted the feat/report-request-and-error branch August 27, 2024 20:27
@samber
Copy link
Owner

samber commented Aug 27, 2024

i was reviewing it anyway ;)

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

Successfully merging this pull request may close these issues.

2 participants