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: 11 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 (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-08-10T15:04:16.000Z (11 months ago)
- Last Synced: 2025-08-10T17:16:35.513Z (11 months ago)
- Topics: go, go-http-middleware, golang-library, problemdetails
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
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 main
import (
"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/