Skip to content

docs(go): align guides with recent SDK releases - #18990

Open
giortzisg wants to merge 4 commits into
masterfrom
docs/go-sdk-release-gaps
Open

docs(go): align guides with recent SDK releases#18990
giortzisg wants to merge 4 commits into
masterfrom
docs/go-sdk-release-gaps

Conversation

@giortzisg

Copy link
Copy Markdown
Collaborator

Summary

  • add concise Fiber v3 setup and automatic instrumentation coverage
  • document recent sentry-go upgrade notes and PushScope behavior
  • update logging and scope examples for current SDK APIs

Testing

  • git diff --check
  • Prettier run on changed documentation files

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sentry-docs Ready Ready Preview Aug 10, 2026 11:36am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
develop-docs Ignored Ignored Preview Aug 10, 2026 11:36am

Request Review

@giortzisg
giortzisg force-pushed the docs/go-sdk-release-gaps branch from c12b9ca to ad94e7e Compare August 10, 2026 08:00

@szokeasaurusrex szokeasaurusrex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly lgtm, have a couple comments and questions though

Comment on lines 42 to 50
`PushScope` returns the new scope, so you can configure a temporary scope directly:

```go
scope := sentry.PushScope()
defer sentry.PopScope()
scope.SetTag("request.type", "background")
```

The most useful operation when working with scopes is the <PlatformIdentifier name="configure-scope" /> function. It can be used to reconfigure the current scope.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: I might be missing something, but it seems odd to combine this all into the same section. If I understand correctly, PushScope is an alternative to using ConfigureScope, so it likely makes sense to put it in a separate (sub-)section

Comment on lines 78 to 79
logger.Errorf("oh no!")

// Fatal level is sent as an error event to Sentry and terminates the application
logger.Fatalf("can't continue...")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Would add comments before each of these lines to stay consistent with other lines here and to make it clear to users what they should expect

Comment on lines -135 to -171
### EventHook

You also have two ways to create a new `EventHook`. Either by using `sentrylogrus.NewEventHook()` and passing the `sentry.ClientOptions`, or
by using `sentrylogrus.NewEventFromClient()` and passing an already created `sentry.Client`. These hook captures log entries and
send them as events. This is helpful for error tracking and alerting.

#### NewEventHook
```go
eventHook, err := sentrylogrus.NewEventHook(
[]logrus.Level{logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel},
sentry.ClientOptions{
Dsn: "___PUBLIC_DSN___",
Debug: true,
AttachStacktrace: true,
},
)
```
#### NewEventHookFromClient

Use `NewEventHookFromClient` if you've already initialized the Sentry SDK.
```go
if err := sentry.Init(sentry.ClientOptions{
Dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
}); err != nil {
log.Fatalf("Sentry initialization failed: %v", err)
}
hub := sentry.CurrentHub()
client := hub.Client()
if client != nil {
eventHook := sentrylogrus.NewEventHookFromClient(
[]logrus.Level{logrus.InfoLevel, logrus.WarnLevel},
client,
)
} else {
log.Fatalf("Sentrylogrus initialization failed: nil client")
}
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] are these no longer supported, or simply discouraged?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer supported


For a quick reference, see the [Fiber v3 example](https://github.com/getsentry/sentry-go/tree/master/_examples/fiber) in the Go SDK source code repository.

[Go Dev-style API documentation](https://pkg.go.dev/github.com/getsentry/sentry-go/fiberv3) is also available.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question]: It looks like the Go dev docs page duplicates the content on this page. How will these stay in sync?

I would consider avoiding duplicating the docs if the sync process is manual

Comment thread docs/platforms/go/guides/negroni/index.mdx

@szokeasaurusrex szokeasaurusrex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, left some nits that could still be improved but consider them optional

logger.Errorf("oh no!")

// Fatal level is sent as an error event to Sentry and terminates the application
// Fatal also sends an error level log to Sentry, while also terminating the current process.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: you're missing a newline

Suggested change
// Fatal also sends an error level log to Sentry, while also terminating the current process.
// Fatal also sends an error level log to Sentry, while also terminating the current process.

})

// Info level is sent as a log to Sentry
// Sending an info level log to Sentry.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: adding a hyphen makes it a bit clearer that "info" is referring to the log level

Suggested change
// Sending an info level log to Sentry.
// Sending an info-level log to Sentry.

logger.WithField("user", "test-user").Error("An error occurred")

// Error level is sent as an error event to Sentry
// Sending an error level log to Sentry.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l:

Suggested change
// Sending an error level log to Sentry.
// Sending an error-level log to Sentry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants