sentry

package
v0.0.0-...-1aa08c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package sentry provides an OpenTelemetry exporter for Sentry.

An OpenTelemetry `Span` becomes a Sentry Transaction or Span. The first Span sent through the Sentry `SpanProcessor` is a `Transaction`, and any child Span gets attached to the first Transaction upon checking the parent Span context. This is true for the OpenTelemetry root Span and any top level Span in the system.

For example, a request sent from frontend to backend will create an OpenTelemetry root Span with a corresponding Sentry Transaction. The backend request will create a new Sentry Transaction for the OpenTelemetry Span. The Sentry Transaction and Span are linked as a trace for navigation and error tracking purposes.

More information: https://docs.sentry.io/platforms/go/performance/instrumentation/opentelemetry

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Project DSN provided by Sentry. If the DSN is not set, the client
	// is effectively disabled.
	DSN string `mapstructure:"dsn" yaml:"dsn" json:"dsn"`

	// Environment identifier used for transactions and events.
	Environment string `mapstructure:"environment" yaml:"environment" json:"environment"`

	// Release identifier. Must be unique across all services.
	// Usual format is:
	//   service-name@version+commit-hash
	//
	// Some Sentry features are built around releases, and, thus, reporting
	// events with a non-empty release improves the product experience.
	// See https://docs.sentry.io/product/releases/.
	Release string `mapstructure:"release" yaml:"release" json:"release"`

	// Whether to capture performance-related data.
	EnablePerformanceMonitoring bool `mapstructure:"performance_monitoring" yaml:"performance_monitoring" json:"performance_monitoring"` // nolint: lll

	// The sample rate for sampling traces in the range [0.0, 1.0].
	TracesSampleRate float64 `mapstructure:"traces_sample_rate" yaml:"traces_sample_rate" json:"traces_sample_rate"`

	// The sample rate for profiling traces in the range [0.0, 1.0].
	// Relative to `TracesSampleRate`; i.e., it is a ratio of profiled
	// traces out of all sampled traces.
	ProfilingSampleRate float64 `mapstructure:"profiling_sample_rate" yaml:"profiling_sample_rate" json:"profiling_sample_rate"` // nolint: lll

	// The maximum time to wait for events to be sent before shutdown.
	FlushTimeout time.Duration `mapstructure:"flush_timeout" yaml:"flush_timeout" json:"flush_timeout"`

	// Maximum number of events per-span to keep. Defaults to 100.
	MaxEvents int `mapstructure:"max_events" yaml:"max_events" json:"max_events"`
}

Options defines the configuration settings for the Sentry reporter.

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter provides a Sentry integration for OpenTelemetry.

An OpenTelemetry `Span` becomes a Sentry Transaction or Span. The first Span sent through the Sentry `SpanProcessor` is a `Transaction`, and any child Span gets attached to the first Transaction upon checking the parent Span context. This is true for the OpenTelemetry root Span and any top level Span in the system. For example, a request sent from frontend to backend will create an OpenTelemetry root Span with a corresponding Sentry Transaction. The backend request will create a new Sentry Transaction for the OpenTelemetry Span. The Sentry Transaction and Span are linked as a trace for navigation and error tracking purposes.

More information: https://docs.sentry.io/platforms/go/performance/instrumentation/opentelemetry

func NewReporter

func NewReporter(opts *Options) (*Reporter, error)

NewReporter returns a new Sentry reporter instance.

func (*Reporter) Context

func (sr *Reporter) Context() context.Context

Context returns a new context instance with the current Sentry hub attached.

https://docs.sentry.io/platforms/go/enriching-events/scopes

func (*Reporter) Propagator

func (sr *Reporter) Propagator() propagation.TextMapPropagator

Propagator returns a carrier than handles Sentry-specific details across service boundaries.

func (*Reporter) SpanProcessor

func (sr *Reporter) SpanProcessor() sdkTrace.SpanProcessor

SpanProcessor handles the link between OpenTelemetry spans and Sentry transactions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL