← All platforms

FastHTTP error tracking

You chose FastHTTP for the request path. Keep a clear path back to its errors, too. The Sentry Go integration sends the reports to your Telebugs server.

~/hoofnotes  go get github.com/getsentry/sentry-go/fasthttp
~/hoofnotes  nvim error_tracking.go main.go
package main
import "github.com/getsentry/sentry-go"
func initErrorTracking() error {
return sentry.Init(sentry.ClientOptions{
// Copy the complete Telebugs DSN, key and path included.
Dsn: "YOUR_TELEBUGS_DSN",
})
}
package main
import (
"time"
"github.com/getsentry/sentry-go"
sentryfasthttp "github.com/getsentry/sentry-go/fasthttp"
"github.com/valyala/fasthttp"
)
func main() {
if err := initErrorTracking(); err != nil {
panic(err)
}
defer sentry.Flush(2 * time.Second)
handler := sentryfasthttp.New(sentryfasthttp.Options{
Repanic: true,
WaitForDelivery: true,
})
if err := fasthttp.ListenAndServe(":3000", handler.Handle(notesHandler)); err != nil {
panic(err)
}
}
~/hoofnotes  go run .

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep sentry-go and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

Does this need net/http?

No. The SDK has a FastHTTP handler wrapper. It captures request panics and carries the context from FastHTTP rather than requiring you to change HTTP libraries.

What about errors I return instead of panicking?

Go errors are values. Report one explicitly with CaptureException when it matters. A middleware connection doesn’t automatically turn every returned error into a report.