diff --git a/CHANGELOG.md b/CHANGELOG.md
index 987d015bc..bfcd9ae08 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
- Add trace origin to span data ([#849](https://github.com/getsentry/sentry-go/pull/849))
- Add ability to skip frames in stacktrace ([#852](https://github.com/getsentry/sentry-go/pull/852))
+- Remove Martini integration ([#861](https://github.com/getsentry/sentry-go/pull/861))
## 0.28.1
diff --git a/README.md b/README.md
index 73cbdbc63..3b67fb45a 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,6 @@ checkout the official documentation:
- [fasthttp](https://docs.sentry.io/platforms/go/guides/fasthttp/)
- [gin](https://docs.sentry.io/platforms/go/guides/gin/)
- [iris](https://docs.sentry.io/platforms/go/guides/iris/)
- - [martini](https://docs.sentry.io/platforms/go/guides/martini/)
- [negroni](https://docs.sentry.io/platforms/go/guides/negroni/)
## Resources
diff --git a/_examples/martini/main.go b/_examples/martini/main.go
deleted file mode 100644
index 2deb9151f..000000000
--- a/_examples/martini/main.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package main
-
-import (
- "fmt"
- "net/http"
-
- sentrymartini "github.com/getsentry/sentry-go/martini"
-
- "github.com/getsentry/sentry-go"
- "github.com/go-martini/martini"
-)
-
-func main() {
- _ = sentry.Init(sentry.ClientOptions{
- Dsn: "",
- BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {
- if hint.Context != nil {
- if req, ok := hint.Context.Value(sentry.RequestContextKey).(*http.Request); ok {
- // You have access to the original Request
- fmt.Println(req)
- }
- }
- fmt.Println(event)
- return event
- },
- Debug: true,
- AttachStacktrace: true,
- })
-
- app := martini.Classic()
-
- app.Use(sentrymartini.New(sentrymartini.Options{
- Repanic: true,
- }))
-
- app.Use(func(rw http.ResponseWriter, r *http.Request, c martini.Context, hub *sentry.Hub) {
- hub.Scope().SetTag("someRandomTag", "maybeYouNeedIt")
- })
-
- app.Get("/", func(rw http.ResponseWriter, r *http.Request, hub *sentry.Hub) {
- hub.WithScope(func(scope *sentry.Scope) {
- scope.SetExtra("unwantedQuery", "someQueryDataMaybe")
- hub.CaptureMessage("User provided unwanted query string, but we recovered just fine")
- })
- rw.WriteHeader(http.StatusOK)
- })
-
- app.Get("/foo", func() string {
- // sentrymartini handler will catch it just fine, and because we attached "someRandomTag"
- // in the middleware before, it will be sent through as well
- panic("y tho")
- })
-
- app.RunOnAddr(":3000")
-}
diff --git a/go.mod b/go.mod
index 7039ba2a2..7dcbfc3cc 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,6 @@ go 1.18
require (
github.com/gin-gonic/gin v1.8.1
github.com/go-errors/errors v1.4.2
- github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab
github.com/gofiber/fiber/v2 v2.52.2
github.com/google/go-cmp v0.5.9
github.com/kataras/iris/v12 v12.2.0
@@ -29,7 +28,6 @@ require (
github.com/ajg/form v1.5.1 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
- github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 // indirect
github.com/fatih/structs v1.1.0 // indirect
diff --git a/go.sum b/go.sum
index 7d2b70126..3d2bbcd52 100644
--- a/go.sum
+++ b/go.sum
@@ -17,8 +17,6 @@ github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer5
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U=
-github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q=
-github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -41,8 +39,6 @@ github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
-github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk=
-github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
diff --git a/martini/README.md b/martini/README.md
deleted file mode 100644
index 4643c51ec..000000000
--- a/martini/README.md
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
-
-
-
-# Official Sentry Martini Handler for Sentry-go SDK
-
-**go.dev:** https://pkg.go.dev/github.com/getsentry/sentry-go/martini
-
-**Example:** https://github.com/getsentry/sentry-go/tree/master/_examples/martini
-
-## Installation
-
-```sh
-go get github.com/getsentry/sentry-go/martini
-```
-
-```go
-import (
- "fmt"
-
- "github.com/getsentry/sentry-go"
- sentrymartini "github.com/getsentry/sentry-go/martini"
- "github.com/go-martini/martini"
-)
-
-// To initialize Sentry's handler, you need to initialize Sentry itself beforehand
-if err := sentry.Init(sentry.ClientOptions{
- Dsn: "your-public-dsn",
-}); err != nil {
- fmt.Printf("Sentry initialization failed: %v\n", err)
-}
-
-// Then create your app
-app := martini.Classic()
-
-// Once it's done, you can attach the handler as one of your middleware
-app.Use(sentrymartini.New(sentrymartini.Options{}))
-
-// Set up routes
-app.Get("/", func() string {
- return "Hello world!"
-})
-
-// And run it
-app.Run()
-```
-
-## Configuration
-
-`sentrymartini` accepts a struct of `Options` that allows you to configure how the handler will behave.
-
-Currently it respects 3 options:
-
-```go
-// Whether Sentry should repanic after recovery, in most cases it should be set to true,
-// as martini.Classic includes its own Recovery middleware that handles http responses.
-Repanic bool
-// Whether you want to block the request before moving forward with the response.
-// Because Martini's default `Recovery` handler doesn't restart the application,
-// it's safe to either skip this option or set it to `false`.
-WaitForDelivery bool
-// Timeout for the event delivery requests.
-Timeout time.Duration
-```
-
-## Usage
-
-`sentrymartini` maps an instance of `*sentry.Hub` (https://pkg.go.dev/github.com/getsentry/sentry-go#Hub) as one of the services available throughout the rest of the request's lifetime.
-You can access it through providing a `hub *sentry.Hub` parameter in any of your proceeding middleware and routes.
-And it should be used instead of the global `sentry.CaptureMessage`, `sentry.CaptureException`, or any other calls, as it keeps the separation of data between the requests.
-
-**Keep in mind that `*sentry.Hub` won't be available in middleware attached before to `sentrymartini`!**
-
-```go
-app := martini.Classic()
-
-app.Use(sentrymartini.New(sentrymartini.Options{
- Repanic: true,
-}))
-
-app.Use(func(rw http.ResponseWriter, r *http.Request, c martini.Context, hub *sentry.Hub) {
- hub.Scope().SetTag("someRandomTag", "maybeYouNeedIt")
-})
-
-app.Get("/", func(rw http.ResponseWriter, r *http.Request, hub *sentry.Hub) {
- if someCondition {
- hub.WithScope(func (scope *sentry.Scope) {
- scope.SetExtra("unwantedQuery", rw.URL.RawQuery)
- hub.CaptureMessage("User provided unwanted query string, but we recovered just fine")
- })
- }
- rw.WriteHeader(http.StatusOK)
-})
-
-app.Get("/foo", func() string {
- // sentrymartini handler will catch it just fine. Also, because we attached "someRandomTag"
- // in the middleware before, it will be sent through as well
- panic("y tho")
-})
-
-app.Run()
-```
-
-### Accessing Request in `BeforeSend` callback
-
-```go
-sentry.Init(sentry.ClientOptions{
- Dsn: "your-public-dsn",
- BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {
- if hint.Context != nil {
- if req, ok := hint.Context.Value(sentry.RequestContextKey).(*http.Request); ok {
- // You have access to the original Request here
- }
- }
-
- return event
- },
-})
-```
diff --git a/martini/sentrymartini.go b/martini/sentrymartini.go
deleted file mode 100644
index 5db83345c..000000000
--- a/martini/sentrymartini.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package sentrymartini
-
-import (
- "context"
- "net/http"
- "time"
-
- "github.com/getsentry/sentry-go"
- "github.com/go-martini/martini"
-)
-
-// The identifier of the Martini SDK.
-const sdkIdentifier = "sentry.go.martini"
-
-type handler struct {
- repanic bool
- waitForDelivery bool
- timeout time.Duration
-}
-
-type Options struct {
- // Repanic configures whether Sentry should repanic after recovery, in most cases it should be set to true,
- // as martini.Classic includes it's own Recovery middleware what handles http responses.
- Repanic bool
- // WaitForDelivery configures whether you want to block the request before moving forward with the response.
- // Because Martini's default Recovery handler doesn't restart the application,
- // it's safe to either skip this option or set it to false.
- WaitForDelivery bool
- // Timeout for the event delivery requests.
- Timeout time.Duration
-}
-
-// New returns a function that satisfies martini.Handler interface
-// It can be used with Use() or Handlers() methods.
-func New(options Options) martini.Handler {
- timeout := options.Timeout
- if timeout == 0 {
- timeout = 2 * time.Second
- }
- return (&handler{
- repanic: options.Repanic,
- timeout: timeout,
- waitForDelivery: options.WaitForDelivery,
- }).handle
-}
-
-func (h *handler) handle(_ http.ResponseWriter, r *http.Request, ctx martini.Context) {
- hub := sentry.GetHubFromContext(r.Context())
- if hub == nil {
- hub = sentry.CurrentHub().Clone()
- }
-
- if client := hub.Client(); client != nil {
- client.SetSDKIdentifier(sdkIdentifier)
- }
-
- hub.Scope().SetRequest(r)
- ctx.Map(hub)
- defer h.recoverWithSentry(hub, r)
- ctx.Next()
-}
-
-func (h *handler) recoverWithSentry(hub *sentry.Hub, r *http.Request) {
- if err := recover(); err != nil {
- eventID := hub.RecoverWithContext(
- context.WithValue(r.Context(), sentry.RequestContextKey, r),
- err,
- )
- if eventID != nil && h.waitForDelivery {
- hub.Flush(h.timeout)
- }
- if h.repanic {
- panic(err)
- }
- }
-}