Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aereal/go-problem-reporter
go-problem-reporter captures HTTP responses that conform to RFC7807 Problem Details from your web application and sends to error reporting services.
https://github.com/aereal/go-problem-reporter
go go-http-middleware golang-library problemdetails
Last synced: 2 months ago
JSON representation
go-problem-reporter captures HTTP responses that conform to RFC7807 Problem Details from your web application and sends to error reporting services.
- Host: GitHub
- URL: https://github.com/aereal/go-problem-reporter
- Owner: aereal
- License: mit
- Created: 2021-09-19T05:58:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-14T19:24:44.000Z (3 months ago)
- Last Synced: 2024-10-15T15:44:24.960Z (3 months ago)
- Topics: go, go-http-middleware, golang-library, problemdetails
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![status][ci-status-badge]][ci-status]
[![PkgGoDev][pkg-go-dev-badge]][pkg-go-dev]# go-problem-reporter
go-problem-reporter captures HTTP responses that conform to [RFC7807 Problem Details][rfc7807] from your web application and sends to error reporting services.
Currently supported services:
- [Sentry][]
## Synopsis
```go
package mainimport (
"github.com/getsentry/sentry-go"
"github.com/moogar0880/problems"
sentryhttp "github.com/getsentry/sentry-go/http"
sentryreporter "github.com/aereal/go-problem-reporter/sentry"
)func main() {
h := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
p := problems.NewDetailedProblem(http.StatusInternalServerError, "some details"),
problems.StatusProblemHandler(p).ServeHTTP(rw, r)
})
mw := sentryreporter.New(sentryreporter.Options{WaitForDelivery: true})
withSentryHub := sentryhttp.New(sentryhttp.Options{}).Handle
&http.Server{
Handler: withSentryHub(mw(h)),
}
}
```## Installation
```sh
go get github.com/aereal/go-problem-reporter
```## License
See LICENSE file.
[pkg-go-dev]: https://pkg.go.dev/github.com/aereal/go-problem-reporter
[pkg-go-dev-badge]: https://pkg.go.dev/badge/aereal/go-problem-reporter
[ci-status-badge]: https://github.com/aereal/go-problem-reporter/workflows/CI/badge.svg?branch=main
[ci-status]: https://github.com/aereal/go-problem-reporter/actions/workflows/CI
[rfc7807]: https://datatracker.ietf.org/doc/html/rfc7807
[Sentry]: https://sentry.io/welcome/