Skip to content

Error Tracking: Fix collecting errors for golang

What does this MR do and why?

The current JSON schema for error events does not correctly validate Go error events, as implemented here: !72050 (merged)

How to set up and validate locally

package main

import (
	"fmt"
	"log"
	"time"

	"github.com/getsentry/sentry-go"
)

func main() {
	if err := sentry.Init(sentry.ClientOptions{
		Dsn:   "https://key@gitlab.com/api/v4/error_tracking/collector/...",
		Debug: true,
	}); err != nil {
		fmt.Printf("Sentry initialization failed: %v\n", err)
	}
	log.Println(sentry.CaptureException(fmt.Errorf("test")))
	log.Println(sentry.Flush(1 * time.Second))
}

See https://gitlab.com/splattael/error-tracking-example-golang/

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Bastian Ike

Merge request reports

Loading