From 73b320a72808cf129e6998d8a41fdd7f16b3b87b Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Mon, 14 Apr 2025 18:06:12 +0100 Subject: [PATCH 1/4] refactor: migrate Golang and related guides to inline product options sytnax related to #13361 --- docs/platforms/go/guides/echo/index.mdx | 10 ++++++---- docs/platforms/go/guides/fasthttp/index.mdx | 10 ++++++---- docs/platforms/go/guides/gin/index.mdx | 10 ++++++---- docs/platforms/go/guides/http/index.mdx | 10 ++++++---- docs/platforms/go/guides/iris/index.mdx | 4 +++- docs/platforms/go/guides/logrus/index.mdx | 4 +++- docs/platforms/go/guides/negroni/index.mdx | 4 +++- 7 files changed, 33 insertions(+), 19 deletions(-) diff --git a/docs/platforms/go/guides/echo/index.mdx b/docs/platforms/go/guides/echo/index.mdx index 7740fefdea4ac6..22966f0cc2c7c9 100644 --- a/docs/platforms/go/guides/echo/index.mdx +++ b/docs/platforms/go/guides/echo/index.mdx @@ -29,7 +29,7 @@ go get github.com/getsentry/sentry-go/echo -```go {"onboardingOptions": {"performance": "14-17"}} +```go import ( "fmt" "net/http" @@ -43,13 +43,15 @@ import ( // To initialize Sentry's handler, you need to initialize Sentry itself beforehand if err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production, TracesSampleRate: 1.0, - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // ___PRODUCT_OPTION_END___ performance + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/fasthttp/index.mdx b/docs/platforms/go/guides/fasthttp/index.mdx index 5a340ab08b0c33..7647048b72796d 100644 --- a/docs/platforms/go/guides/fasthttp/index.mdx +++ b/docs/platforms/go/guides/fasthttp/index.mdx @@ -29,7 +29,7 @@ go get github.com/getsentry/sentry-go/fasthttp -```go {"onboardingOptions": {"performance": "12-16"}} +```go import ( "fmt" "net/http" @@ -41,14 +41,16 @@ import ( // To initialize Sentry's handler, you need to initialize Sentry itself beforehand if err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", + // ___PRODUCT_OPTION_START___ performance EnableTracing: true, // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production, TracesSampleRate: 1.0, - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // ___PRODUCT_OPTION_END___ performance + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/gin/index.mdx b/docs/platforms/go/guides/gin/index.mdx index 2528835c4a546b..446137a5c90a56 100644 --- a/docs/platforms/go/guides/gin/index.mdx +++ b/docs/platforms/go/guides/gin/index.mdx @@ -29,7 +29,7 @@ go get github.com/getsentry/sentry-go/gin -```go {"onboardingOptions": {"performance": "13-17"}} +```go import ( "fmt" "net/http" @@ -42,14 +42,16 @@ import ( // To initialize Sentry's handler, you need to initialize Sentry itself beforehand if err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", + // ___PRODUCT_OPTION_START___ performance EnableTracing: true, // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production, TracesSampleRate: 1.0, - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // ___PRODUCT_OPTION_END___ performance + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/http/index.mdx b/docs/platforms/go/guides/http/index.mdx index 42d8ff3a2d4c4e..2a76d03f495c5e 100644 --- a/docs/platforms/go/guides/http/index.mdx +++ b/docs/platforms/go/guides/http/index.mdx @@ -29,7 +29,7 @@ go get github.com/getsentry/sentry-go/http -```go {"onboardingOptions": {"performance": "12-16"}} +```go import ( "fmt" "net/http" @@ -41,14 +41,16 @@ import ( // To initialize Sentry's handler, you need to initialize Sentry itself beforehand if err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", + // ___PRODUCT_OPTION_START___ performance EnableTracing: true, // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production, TracesSampleRate: 1.0, - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // ___PRODUCT_OPTION_END___ performance + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/iris/index.mdx b/docs/platforms/go/guides/iris/index.mdx index 03326cfa6ea865..da85f1c40c2879 100644 --- a/docs/platforms/go/guides/iris/index.mdx +++ b/docs/platforms/go/guides/iris/index.mdx @@ -29,7 +29,7 @@ go get github.com/getsentry/sentry-go/iris -```go {"onboardingOptions": {"performance": "12-16"}} +```go import ( "fmt" @@ -41,11 +41,13 @@ import ( // To initialize Sentry's handler, you need to initialize Sentry itself beforehand if err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", + // ___PRODUCT_OPTION_START___ performance EnableTracing: true, // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production, TracesSampleRate: 1.0, + // ___PRODUCT_OPTION_END___ performance // Adds request headers and IP for users, // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info SendDefaultPII: true, diff --git a/docs/platforms/go/guides/logrus/index.mdx b/docs/platforms/go/guides/logrus/index.mdx index b80f504ead0fec..3c984fb1dadda4 100644 --- a/docs/platforms/go/guides/logrus/index.mdx +++ b/docs/platforms/go/guides/logrus/index.mdx @@ -23,7 +23,7 @@ go get github.com/getsentry/sentry-go/logrus -```go {"onboardingOptions": {"performance": "14-17"}} +```go import ( "fmt" "net/http" @@ -42,8 +42,10 @@ import ( logger.Level = logrus.DebugLevel logger.Out = os.Stderr + // ___PRODUCT_OPTION_START___ performance // Send only ERROR and higher level logs to Sentry sentryLevels := []logrus.Level{logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel} + // ___PRODUCT_OPTION_END___ performance // Initialize Sentry sentryHook, err := sentrylogrus.New(sentryLevels, sentry.ClientOptions{ diff --git a/docs/platforms/go/guides/negroni/index.mdx b/docs/platforms/go/guides/negroni/index.mdx index e0e45eddd63e07..8ff5c4b7eae71c 100644 --- a/docs/platforms/go/guides/negroni/index.mdx +++ b/docs/platforms/go/guides/negroni/index.mdx @@ -29,7 +29,7 @@ go get github.com/getsentry/sentry-go/negroni -```go {"onboardingOptions": {"performance": "13-17"}} +```go import ( "fmt" "net/http" @@ -42,11 +42,13 @@ import ( // To initialize Sentry's handler, you need to initialize Sentry itself beforehand if err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", + // ___PRODUCT_OPTION_START___ performance EnableTracing: true, // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production, TracesSampleRate: 1.0, + // ___PRODUCT_OPTION_END___ performance // Adds request headers and IP for users, // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info SendDefaultPII: true, From 373cbde6e364affb62fbe23ff23682046b64900c Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Thu, 17 Apr 2025 13:24:03 +0100 Subject: [PATCH 2/4] add onboarding product options to fiber --- docs/platforms/go/guides/fiber/index.mdx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/platforms/go/guides/fiber/index.mdx b/docs/platforms/go/guides/fiber/index.mdx index 247d9e43ec9c3c..04921e27f0914b 100644 --- a/docs/platforms/go/guides/fiber/index.mdx +++ b/docs/platforms/go/guides/fiber/index.mdx @@ -12,6 +12,13 @@ documentation](https://godoc.org/github.com/getsentry/sentry-go/fiber). ## Install + + ```shell go get github.com/getsentry/sentry-go/fiber ``` @@ -30,11 +37,13 @@ import ( // To initialize Sentry's handler, you need to initialize Sentry itself beforehand if err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", + // ___PRODUCT_OPTION_START___ performance EnableTracing: true, // Set TracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production, TracesSampleRate: 1.0, + // ___PRODUCT_OPTION_END___ performance // Adds request headers and IP for users, // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info SendDefaultPII: true, From 136802c2aa4cfb3662240a7ec4dd1638910dd339 Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Thu, 17 Apr 2025 13:29:50 +0100 Subject: [PATCH 3/4] fix indentation (swap spaces for tabs) --- docs/platforms/go/guides/echo/index.mdx | 6 +++--- docs/platforms/go/guides/fasthttp/index.mdx | 6 +++--- docs/platforms/go/guides/fiber/index.mdx | 6 +++--- docs/platforms/go/guides/gin/index.mdx | 6 +++--- docs/platforms/go/guides/iris/index.mdx | 6 +++--- docs/platforms/go/guides/negroni/index.mdx | 4 ++-- docs/platforms/go/guides/zerolog/index.mdx | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/platforms/go/guides/echo/index.mdx b/docs/platforms/go/guides/echo/index.mdx index 22966f0cc2c7c9..a210da1475ab5b 100644 --- a/docs/platforms/go/guides/echo/index.mdx +++ b/docs/platforms/go/guides/echo/index.mdx @@ -49,9 +49,9 @@ if err := sentry.Init(sentry.ClientOptions{ // We recommend adjusting this value in production, TracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/fasthttp/index.mdx b/docs/platforms/go/guides/fasthttp/index.mdx index 7647048b72796d..1e6f9231ab2c4f 100644 --- a/docs/platforms/go/guides/fasthttp/index.mdx +++ b/docs/platforms/go/guides/fasthttp/index.mdx @@ -48,9 +48,9 @@ if err := sentry.Init(sentry.ClientOptions{ // We recommend adjusting this value in production, TracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/fiber/index.mdx b/docs/platforms/go/guides/fiber/index.mdx index 04921e27f0914b..afea6ab5bca7b3 100644 --- a/docs/platforms/go/guides/fiber/index.mdx +++ b/docs/platforms/go/guides/fiber/index.mdx @@ -44,9 +44,9 @@ if err := sentry.Init(sentry.ClientOptions{ // We recommend adjusting this value in production, TracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/gin/index.mdx b/docs/platforms/go/guides/gin/index.mdx index 446137a5c90a56..2031baf9b78b5d 100644 --- a/docs/platforms/go/guides/gin/index.mdx +++ b/docs/platforms/go/guides/gin/index.mdx @@ -49,9 +49,9 @@ if err := sentry.Init(sentry.ClientOptions{ // We recommend adjusting this value in production, TracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/iris/index.mdx b/docs/platforms/go/guides/iris/index.mdx index da85f1c40c2879..4559e3a746cc8d 100644 --- a/docs/platforms/go/guides/iris/index.mdx +++ b/docs/platforms/go/guides/iris/index.mdx @@ -48,9 +48,9 @@ if err := sentry.Init(sentry.ClientOptions{ // We recommend adjusting this value in production, TracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/negroni/index.mdx b/docs/platforms/go/guides/negroni/index.mdx index 8ff5c4b7eae71c..6b3f3076def159 100644 --- a/docs/platforms/go/guides/negroni/index.mdx +++ b/docs/platforms/go/guides/negroni/index.mdx @@ -50,8 +50,8 @@ if err := sentry.Init(sentry.ClientOptions{ TracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }); err != nil { fmt.Printf("Sentry initialization failed: %v\n", err) } diff --git a/docs/platforms/go/guides/zerolog/index.mdx b/docs/platforms/go/guides/zerolog/index.mdx index c05cc58d927c97..f916eb8ade8ec5 100644 --- a/docs/platforms/go/guides/zerolog/index.mdx +++ b/docs/platforms/go/guides/zerolog/index.mdx @@ -43,8 +43,8 @@ func main() { err := sentry.Init(sentry.ClientOptions{ Dsn: "___PUBLIC_DSN___", // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event { // Modify or filter events before sending them to Sentry return event From b0a5b3378bed0e6a03ade98f04f24f779f480c68 Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Thu, 17 Apr 2025 16:02:54 +0100 Subject: [PATCH 4/4] cleanup error monitoring only getting started pages --- docs/platforms/go/guides/logrus/index.mdx | 9 --------- docs/platforms/go/guides/slog/index.mdx | 10 ++-------- docs/platforms/go/guides/zerolog/index.mdx | 8 +------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/docs/platforms/go/guides/logrus/index.mdx b/docs/platforms/go/guides/logrus/index.mdx index 3c984fb1dadda4..1a05e4879ee1f5 100644 --- a/docs/platforms/go/guides/logrus/index.mdx +++ b/docs/platforms/go/guides/logrus/index.mdx @@ -9,12 +9,6 @@ Go API documentation for the [`sentrylogrus` package](https://pkg.go.dev/github. ## Install - - ```bash go get github.com/getsentry/sentry-go/logrus ``` @@ -42,10 +36,8 @@ import ( logger.Level = logrus.DebugLevel logger.Out = os.Stderr - // ___PRODUCT_OPTION_START___ performance // Send only ERROR and higher level logs to Sentry sentryLevels := []logrus.Level{logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel} - // ___PRODUCT_OPTION_END___ performance // Initialize Sentry sentryHook, err := sentrylogrus.New(sentryLevels, sentry.ClientOptions{ @@ -91,4 +83,3 @@ import ( ## Usage Use `logrus` as you normally would, and it will automatically send logs at or above the specified levels to Sentry. - diff --git a/docs/platforms/go/guides/slog/index.mdx b/docs/platforms/go/guides/slog/index.mdx index fdb47e5bd70783..ba1bf1aef5158d 100644 --- a/docs/platforms/go/guides/slog/index.mdx +++ b/docs/platforms/go/guides/slog/index.mdx @@ -9,12 +9,6 @@ Go API documentation for the [`sentryslog` package](https://pkg.go.dev/github.co ## Install - - ```bash go get github.com/getsentry/sentry-go/slog ``` @@ -43,8 +37,8 @@ func main() { Dsn: "___PUBLIC_DSN___", EnableTracing: false, // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info - SendDefaultPII: true, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, }) if err != nil { log.Fatal(err) diff --git a/docs/platforms/go/guides/zerolog/index.mdx b/docs/platforms/go/guides/zerolog/index.mdx index f916eb8ade8ec5..32696e70eba014 100644 --- a/docs/platforms/go/guides/zerolog/index.mdx +++ b/docs/platforms/go/guides/zerolog/index.mdx @@ -9,12 +9,6 @@ For a complete example, visit the [Go SDK source code repository](https://github ## Install - - ```bash go get github.com/getsentry/sentry-go/zerolog ``` @@ -26,7 +20,7 @@ go get github.com/getsentry/sentry-go/zerolog To integrate Sentry with Zerolog, you need to set up a custom writer that sends logs to Sentry based on the configured levels. -```go {"onboardingOptions": {"performance": "12-16"}} +```go import ( "errors" "time"