Go

Installeren go get github.com/blipit-io/blipit-go

Voeg de module blipit-go toe en roep Init één keer aan in main met de publieke sleutel en het project-id van je project. Flush voordat het proces stopt, zodat de laatste events niet verloren gaan.

1Installeren

sh
go get github.com/blipit-io/blipit-go

2Initialiseer in main

go
import (
    "log"
    "time"

    "github.com/blipit-io/blipit-go"
)

func main() {
    if err := blipit.Init(blipit.Options{
        Key:         "<public key>",
        Project:     "<project id>",
        Environment: "production",
        Release:     "myapp@1.4.2",
    }); err != nil {
        log.Fatal(err)
    }
    defer blipit.Flush(2 * time.Second)
}

3Handmatige capture en inlogpogingen

go
blipit.CaptureException(err)
blipit.CaptureMessage("cache miss rate above 50%")
blipit.SetUser(blipit.User{ID: "42", Email: "ana@example.com"})
blipit.CaptureSecurity(blipit.Security{Kind: "login_failed", Actor: email, IP: ip, UserAgent: agent, Outcome: "bad_password"})

4Check of het werkt

Open Issues in app.blipit.io. Het eerste event verschijnt binnen een paar seconden, gegroepeerd in een issue, en de verantwoordelijken krijgen een e-mail.

go
blipit.CaptureMessage("Hello from Go")

Goed om te weten

  • TracesSampleRate: 0.2 in Options stuurt requests naar de pagina Performance.
  • Al op sentry-go? Die werkt ongewijzigd met de DSN https://<public key>@in.blipit.io/<project id>.

Kom je er niet uit? Mail support@blipit.io. Sleutels en de exacte DSN van elk project staan onder API-sleutels in app.blipit.io.