Using Sentry SDK client with Uptrace

Ingest Sentry

TIP

Sentry integration is a new feature that will be improved based on the demand and feedback from users. So if you are interested in this feature or encounter any issues, please let us know on GitHubopen in new window.

Sentry is an open-source error tracking and monitoring tool that helps developers track, prioritize, and fix issues in real-time. It is used to monitor and report errors and exceptions in web and mobile applications.

Sentry SDK has been actively developed and maintained for 10+ years and has a large and active community of users and contributors.

If you need to monitor JavaScript Web applications, using Sentry SDK instead of OpenTelemetry JS might provide a better result.

Sentry for browsers

Sentry SDK for browsers supports a wide range of web technologies and frameworks, including React, Angular, Vue.js, and more. It also provides detailed error reports and data, including stack traces, error messages, and user data, helping developers identify and fix errors quickly.

To install Sentry SDK for browsers:

# npm
npm install --save @sentry/browser

# yarn
yarn add @sentry/browser

Then you need to initialize the SDK using Uptrace OTLP/HTTP DSN:

import { init, captureMessage } from '@sentry/browser'

init({
  dsn: 'https://token@api.uptrace.dev/project_id',
  // ...
})

captureMessage('Hello, world!')
import { init, captureMessage } from '@sentry/browser'

init({
  dsn: 'http://project2_secret_token@localhost:14318?grpc=14317',
  // ...
})

captureMessage('Hello, world!')

Sentry also provides packages for Reactopen in new window, Vue.jsopen in new window, Angularopen in new window, and many more. For details, see sentry-javascriptopen in new window documentation.

Sentry Go

Sentry provides an SDK for the Go programming language, allowing developers to monitor and track errors and exceptions in Go applications.

Install sentry-go:

go get github.com/getsentry/sentry-go

Then use Uptrace OTLP/HTTP DSN to initialize Sentry SDK:

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

func main() {
	err := sentry.Init(sentry.ClientOptions{
		Dsn:              "https://token@api.uptrace.dev/project_id",
		EnableTracing:    true,
		TracesSampleRate: 1.0,
	})
	if err != nil {
		panic(err)
	}
	defer sentry.Flush(3 * time.Second)
}
import "github.com/getsentry/sentry-go"

func main() {
	err := sentry.Init(sentry.ClientOptions{
		Dsn:              "http://project2_secret_token@localhost:14318?grpc=14317",
		EnableTracing:    true,
		TracesSampleRate: 1.0,
	})
	if err != nil {
		panic(err)
	}
	defer sentry.Flush(3 * time.Second)
}

For more details, see sentry-goopen in new window documentation.

Last Updated: