Go telemetry
Use github.com/qase-tms/tiden-telemetry-go for Go applications.
Install
go get github.com/qase-tms/tiden-telemetry-go
Initialize
import tiden "github.com/qase-tms/tiden-telemetry-go"
func main() {
if err := tiden.Init(tiden.Options{
DSN: os.Getenv("TIDEN_DSN"),
Release: "my-app@1.2.3",
Environment: "production",
}); err != nil {
log.Fatal(err)
}
}
Capture errors
if err := doWork(); err != nil {
tiden.CaptureException(err)
}
tiden.CaptureMessage("checkout completed", "info")
Recover panics
func worker() {
defer tiden.Recover()
mightPanic()
}
net/http middleware
log.Fatal(http.ListenAndServe(":8080", tiden.Middleware(mux)))
The middleware reports panics in handlers and returns HTTP 500 instead of crashing the process.
Context
tiden.SetTag("plan", "pro")
tiden.SetUser(map[string]any{"id": "u_123"})
Options
Important options include DSN, Release, Environment, SendDefaultPII,
BeforeSend, and HTTPTimeout.