You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/go/common/index.mdx
-14Lines changed: 0 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,20 +10,6 @@ Check out the other SDKs we support in the left-hand dropdown.
10
10
11
11
* If you don't have an account and Sentry project established already, please head over to [Sentry](https://sentry.io/signup/), and then return to this page.
12
12
13
-
## Features
14
-
15
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/).
16
-
17
-
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
Copy file name to clipboardExpand all lines: docs/platforms/go/guides/echo/index.mdx
+40-59Lines changed: 40 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,79 +7,25 @@ For a quick reference, there is a [complete example](https://github.com/getsentr
7
7
8
8
[Go Dev-style API documentation](https://pkg.go.dev/github.com/getsentry/sentry-go/echo) is also available.
9
9
10
-
## Features
11
-
12
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/).
13
-
14
-
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
15
-
16
10
## Install
17
11
18
-
<OnboardingOptionButtons
19
-
options={[
20
-
'error-monitoring',
21
-
'performance'
22
-
]}
23
-
/>
24
-
25
12
```bash
13
+
go get github.com/getsentry/sentry-go
26
14
go get github.com/getsentry/sentry-go/echo
27
15
```
28
16
29
17
<Break />
30
18
19
+
## Configure
31
20
32
-
```go
33
-
import (
34
-
"fmt"
35
-
"net/http"
36
-
37
-
"github.com/getsentry/sentry-go"
38
-
sentryecho "github.com/getsentry/sentry-go/echo"
39
-
"github.com/labstack/echo/v4"
40
-
"github.com/labstack/echo/v4/middleware"
41
-
)
42
-
43
-
// To initialize Sentry's handler, you need to initialize Sentry itself beforehand
44
-
iferr:= sentry.Init(sentry.ClientOptions{
45
-
Dsn: "___PUBLIC_DSN___",
46
-
// ___PRODUCT_OPTION_START___ performance
47
-
// Set TracesSampleRate to 1.0 to capture 100%
48
-
// of transactions for tracing.
49
-
// We recommend adjusting this value in production,
50
-
TracesSampleRate: 1.0,
51
-
// ___PRODUCT_OPTION_END___ performance
52
-
// Adds request headers and IP for users,
53
-
// visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info
`sentryecho` accepts a struct of `Options` that allows you to configure how the handler will behave.
80
28
81
-
Currently it respects 3 options:
82
-
83
29
```go
84
30
// Repanic configures whether Sentry should repanic after recovery, in most cases it should be set to true,
85
31
// as echo includes its own Recover middleware that handles http responses.
@@ -92,6 +38,41 @@ WaitForDelivery bool
92
38
Timeout time.Duration
93
39
```
94
40
41
+
<Break />
42
+
43
+
```go
44
+
app:= echo.New()
45
+
app.Use(sentryecho.New(sentryecho.Options{
46
+
// you can modify these options
47
+
Repanic: true,
48
+
WaitForDelivery: false,
49
+
Timeout: 5 * time.Second,
50
+
}))
51
+
```
52
+
53
+
## Verify
54
+
55
+
```go
56
+
app:= echo.New()
57
+
app.Use(middleware.Logger())
58
+
app.Use(middleware.Recover())
59
+
60
+
// Attach the sentryecho handler as one of your middlewares
61
+
app.Use(sentryecho.New(sentryecho.Options{
62
+
// specify options here...
63
+
}))
64
+
65
+
// Set up routes
66
+
app.GET("/", func(ctx echo.Context) error {
67
+
// capturing an error intentionally to simulate usage
68
+
sentry.CaptureMessage("It works!")
69
+
70
+
return ctx.String(http.StatusOK, "Hello, World!")
71
+
})
72
+
73
+
app.Logger.Fatal(app.Start(":3000"))
74
+
```
75
+
95
76
## Usage
96
77
97
78
`sentryecho` attaches an instance of `*sentry.Hub` (https://pkg.go.dev/github.com/getsentry/sentry-go#Hub) to the `echo.Context`, which makes it available throughout the rest of the request's lifetime.
Copy file name to clipboardExpand all lines: docs/platforms/go/guides/fasthttp/index.mdx
+40-56Lines changed: 40 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,60 +7,62 @@ For a quick reference, there is a [complete example](https://github.com/getsentr
7
7
8
8
[Go Dev-style API documentation](https://pkg.go.dev/github.com/getsentry/sentry-go/fasthttp) is also available.
9
9
10
-
## Features
11
-
12
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/).
13
-
14
-
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
`sentryfasthttp` accepts a struct of `Options` that allows you to configure how the handler will behave.
77
-
78
-
Currently, it respects three options:
79
-
80
-
```go
81
-
// Repanic configures whether Sentry should repanic after recovery, in most cases, it defaults to false,
82
-
// as fasthttp doesn't include its own Recovery handler.
83
-
Repanic bool
84
-
// WaitForDelivery configures whether you want to block the request before moving forward with the response.
85
-
// Because fasthttp doesn't include its own `Recovery` handler, it will restart the application,
86
-
// and the event won't be delivered otherwise.
87
-
WaitForDelivery bool
88
-
// Timeout for the event delivery requests.
89
-
Timeout time.Duration
90
-
```
91
-
92
76
## Usage
93
77
94
78
`sentryfasthttp` attaches an instance of `*sentry.Hub` (https://pkg.go.dev/github.com/getsentry/sentry-go#Hub) to the request's context, which makes it available throughout the rest of the request's lifetime.
0 commit comments