Movatterモバイル変換


[0]ホーム

URL:


sentry

packagemodule
v0.42.0Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License:MITImports:36Imported by:3,429

Details

Repository

github.com/getsentry/sentry-go

Links

README

Sentry

Official Sentry SDK for Go

Build StatusGo Report CardDiscordX Followgo.dev

sentry-go provides a Sentry client implementation for the Go programminglanguage. This is the next generation of the Go SDK forSentry,intended to replace theraven-go package.

Looking for the oldraven-go SDK documentation? See the Legacy client sectionhere.If you want to start usingsentry-go instead, check out themigration guide.

Requirements

The only requirement is a Go compiler.

We verify this package against the 3 most recent releases of Go. Those are thesupported versions. The exact versions are defined inGitHub workflow.

In addition, we run tests against the current master branch of the Go toolchain,though support for this configuration is best-effort.

Installation

sentry-go can be installed like any other Go library throughgo get:

$ go get github.com/getsentry/sentry-go@latest

Check out thelist of released versions.

Configuration

To usesentry-go, you’ll need to import thesentry-go package and initializeit with your DSN and otheroptions.

If not specified in the SDK initialization, theDSN,Release andEnvironmentare read from the environment variablesSENTRY_DSN,SENTRY_RELEASE andSENTRY_ENVIRONMENT, respectively.

More on this in theConfiguration section of the official Sentry Go SDK documentation.

Usage

The SDK supports reporting errors and tracking application performance.

To get started, have a look at one of ourexamples:

We also provide acomplete API reference.

For more detailed information about how to get the most out ofsentry-go,check out the official documentation:

Resources

License

Licensed underThe MIT License, seeLICENSE.

Community

Join Sentry's#go channel on Discord to getinvolved and help us improve the SDK!

Documentation

Overview

Package repository:https://github.com/getsentry/sentry-go/

For more information about Sentry and SDK features, please have a look at the official documentation site:https://docs.sentry.io/platforms/go/

Example (TransportWithHooks)

Initializing the SDK with a custom HTTP transport gives a lot of flexibilityto inspect requests and responses. This example adds before and after hooks.

package mainimport ("fmt""net/http""net/http/httputil""os""time""github.com/getsentry/sentry-go")// TransportWithHooks is an http.RoundTripper that wraps an existing// http.RoundTripper adding hooks that run before and after each round trip.type TransportWithHooks struct {http.RoundTripperBefore func(*http.Request) errorAfter  func(*http.Request, *http.Response, error) (*http.Response, error)}func (t *TransportWithHooks) RoundTrip(req *http.Request) (*http.Response, error) {if err := t.Before(req); err != nil {return nil, err}resp, err := t.RoundTripper.RoundTrip(req)return t.After(req, resp, err)}// Initializing the SDK with a custom HTTP transport gives a lot of flexibility// to inspect requests and responses. This example adds before and after hooks.func main() {err := sentry.Init(sentry.ClientOptions{// Either set your DSN here or set the SENTRY_DSN environment variable.Dsn:   "",Debug: true,HTTPTransport: &TransportWithHooks{RoundTripper: http.DefaultTransport,Before: func(req *http.Request) error {if b, err := httputil.DumpRequestOut(req, true); err != nil {fmt.Println(err)} else {fmt.Printf("%s\n", b)}return nil},After: func(_ *http.Request, resp *http.Response, err error) (*http.Response, error) {if b, err := httputil.DumpResponse(resp, true); err != nil {fmt.Println(err)} else {fmt.Printf("%s\n", b)}return resp, err},},})if err != nil {fmt.Fprintf(os.Stderr, "sentry.Init: %s\n", err)os.Exit(1)}defer sentry.Flush(2 * time.Second)sentry.CaptureMessage("test")}

Index

Examples

Constants

View Source
const (MechanismTypeGenericstring = "generic"MechanismTypeChainedstring = "chained"MechanismTypeUnwrapstring = "unwrap"MechanismSourceCausestring = "cause")
View Source
const (// HubContextKey is the key used to store the current Hub.HubContextKey = contextKey(1)// RequestContextKey is the key used to store the current http.Request.RequestContextKey = contextKey(2))

Keys used to store values in a Context. Use with Context.Value to accessvalues stored by the SDK.

View Source
const (LogSeverityTraceint = 1LogSeverityDebugint = 5LogSeverityInfoint = 9LogSeverityWarningint = 13LogSeverityErrorint = 17LogSeverityFatalint = 21)
View Source
const (UnitNanosecond  = "nanosecond"UnitMicrosecond = "microsecond"UnitMillisecond = "millisecond"UnitSecond      = "second"UnitMinute      = "minute"UnitHour        = "hour"UnitDay         = "day"UnitWeek        = "week")

Duration Units.

View Source
const (UnitBit      = "bit"UnitByte     = "byte"UnitKilobyte = "kilobyte"UnitKibibyte = "kibibyte"UnitMegabyte = "megabyte"UnitMebibyte = "mebibyte"UnitGigabyte = "gigabyte"UnitGibibyte = "gibibyte"UnitTerabyte = "terabyte"UnitTebibyte = "tebibyte"UnitPetabyte = "petabyte"UnitPebibyte = "pebibyte"UnitExabyte  = "exabyte"UnitExbibyte = "exbibyte")

Information Units.

View Source
const (UnitRatio   = "ratio"UnitPercent = "percent")

Fraction Units.

View Source
const (SentryTraceHeader   = "sentry-trace"SentryBaggageHeader = "baggage"TraceparentHeader   = "traceparent")
View Source
const (SpanOriginManual   = "manual"SpanOriginEcho     = "auto.http.echo"SpanOriginFastHTTP = "auto.http.fasthttp"SpanOriginFiber    = "auto.http.fiber"SpanOriginGin      = "auto.http.gin"SpanOriginStdLib   = "auto.http.stdlib"SpanOriginIris     = "auto.http.iris"SpanOriginNegroni  = "auto.http.negroni")
View Source
const SDKVersion = "0.42.0"

The version of the SDK.

Variables

View Source
var DebugLogger =debuglog.GetLogger()

DebugLogger is an instance of log.Logger that is used to provide debug information about running Sentry Clientcan be enabled by either using debuglog.SetOutput directly or with Debug client option.

Functions

funcAddBreadcrumb

func AddBreadcrumb(breadcrumb *Breadcrumb)

AddBreadcrumb records a new breadcrumb.

The total number of breadcrumbs that can be recorded are limited by theconfiguration on the client.

funcAddGlobalEventProcessor

func AddGlobalEventProcessor(processorEventProcessor)

AddGlobalEventProcessor adds processor to the global list of eventprocessors. Global event processors apply to all events.

AddGlobalEventProcessor is deprecated. Most users will prefer to initializethe SDK with Init and provide a ClientOptions.BeforeSend function or useScope.AddEventProcessor instead.

funcConfigureScope

func ConfigureScope(f func(scope *Scope))

ConfigureScope is a shorthand for CurrentHub().ConfigureScope.

funcFlush

func Flush(timeouttime.Duration)bool

Flush waits until the underlying Transport sends any buffered events to theSentry server, blocking for at most the given timeout. It returns false ifthe timeout was reached. In that case, some events may not have been sent.

Flush should be called before terminating the program to avoidunintentionally dropping events.

Do not call Flush indiscriminately after every call to CaptureEvent,CaptureException or CaptureMessage. Instead, to have the SDK send events overthe network synchronously, configure it to use the HTTPSyncTransport in thecall to Init.

funcFlushWithContextadded inv0.34.0

func FlushWithContext(ctxcontext.Context)bool

funcHasHubOnContext

func HasHubOnContext(ctxcontext.Context)bool

HasHubOnContext checks whether Hub instance is bound to a given Context struct.

funcInit

func Init(optionsClientOptions)error

Init initializes the SDK with options. The returned error is non-nil ifoptions is invalid, for instance if a malformed DSN is provided.

funcPointeradded inv0.28.0

func Pointer[Tany](v T) *T

funcPopScope

func PopScope()

PopScope is a shorthand for CurrentHub().PopScope.

funcPushScope

func PushScope()

PushScope is a shorthand for CurrentHub().PushScope.

funcSetHubOnContext

func SetHubOnContext(ctxcontext.Context, hub *Hub)context.Context

SetHubOnContext stores given Hub instance on the Context struct and returns a new Context.

funcWithScope

func WithScope(f func(scope *Scope))

WithScope is a shorthand for CurrentHub().WithScope.

Types

typeAttachmentadded inv0.23.0

type Attachment struct {FilenamestringContentTypestringPayload     []byte}

Attachment allows associating files with your events to aid in investigation.An event may contain one or more attachments.

typeAttrTypeadded inv0.35.0

type AttrTypestring
const (AttributeInvalidAttrType = ""AttributeBoolAttrType = "boolean"AttributeIntAttrType = "integer"AttributeFloatAttrType = "double"AttributeStringAttrType = "string")

typeAttributeadded inv0.33.0

type Attribute struct {Valueany      `json:"value"`TypeAttrType `json:"type"`}

typeBreadcrumb

type Breadcrumb struct {Typestring                 `json:"type,omitempty"`Categorystring                 `json:"category,omitempty"`Messagestring                 `json:"message,omitempty"`Data      map[string]interface{} `json:"data,omitempty"`LevelLevel                  `json:"level,omitempty"`Timestamptime.Time              `json:"timestamp"`}

Breadcrumb specifies an application event that occurred before a Sentry event.An event may contain one or more breadcrumbs.

func (*Breadcrumb)MarshalJSONadded inv0.6.0

func (b *Breadcrumb) MarshalJSON() ([]byte,error)

MarshalJSON converts the Breadcrumb struct to JSON.

typeBreadcrumbHint

type BreadcrumbHint map[string]interface{}

BreadcrumbHint contains information that can be associated with a Breadcrumb.

typeCheckInadded inv0.23.0

type CheckIn struct {// Check-In ID (unique and client generated)IDEventID `json:"check_in_id"`// The distinct slug of the monitor.MonitorSlugstring `json:"monitor_slug"`// The status of the check-in.StatusCheckInStatus `json:"status"`// The duration of the check-in. Will only take effect if the status is ok or error.Durationtime.Duration `json:"duration,omitempty"`}

typeCheckInStatusadded inv0.23.0

type CheckInStatusstring
const (CheckInStatusInProgressCheckInStatus = "in_progress"CheckInStatusOKCheckInStatus = "ok"CheckInStatusErrorCheckInStatus = "error")

typeClient

type Client struct {// Transport is read-only. Replacing the transport of an existing client is// not supported, create a new client instead.TransportTransport// contains filtered or unexported fields}

Client is the underlying processor that is used by the main API and Hubinstances. It must be created with NewClient.

funcNewClient

func NewClient(optionsClientOptions) (*Client,error)

NewClient creates and returns an instance of Client configured usingClientOptions.

Most users will not create clients directly. Instead, initialize the SDK withInit and use the package-level functions (for simple programs that run on asingle goroutine) or hub methods (for concurrent programs, for example webservers).

func (*Client)AddEventProcessor

func (client *Client) AddEventProcessor(processorEventProcessor)

AddEventProcessor adds an event processor to the client. It must not becalled from concurrent goroutines. Most users will prefer to useClientOptions.BeforeSend or Scope.AddEventProcessor instead.

Note that typical programs have only a single client created by Init and theclient is shared among multiple hubs, one per goroutine, such that adding anevent processor to the client affects all hubs that share the client.

func (*Client)CaptureCheckInadded inv0.23.0

func (client *Client) CaptureCheckIn(checkIn *CheckIn, monitorConfig *MonitorConfig, scopeEventModifier) *EventID

CaptureCheckIn captures a check in.

func (*Client)CaptureEvent

func (client *Client) CaptureEvent(event *Event, hint *EventHint, scopeEventModifier) *EventID

CaptureEvent captures an event on the currently active client if any.

The event must already be assembled. Typically, code would instead usethe utility methods like CaptureException. The return value is theevent ID. In case Sentry is disabled or event was dropped, the return value will be nil.

func (*Client)CaptureException

func (client *Client) CaptureException(exceptionerror, hint *EventHint, scopeEventModifier) *EventID

CaptureException captures an error.

func (*Client)CaptureMessage

func (client *Client) CaptureMessage(messagestring, hint *EventHint, scopeEventModifier) *EventID

CaptureMessage captures an arbitrary message.

func (*Client)Closeadded inv0.31.0

func (client *Client) Close()

Close clean up underlying Transport resources.

Close should be called after Flush and before terminating the programotherwise some events may be lost.

func (*Client)EventFromCheckInadded inv0.23.0

func (client *Client) EventFromCheckIn(checkIn *CheckIn, monitorConfig *MonitorConfig) *Event

EventFromCheckIn creates a new Sentry event from the given `check_in` instance.

func (*Client)EventFromExceptionadded inv0.21.0

func (client *Client) EventFromException(exceptionerror, levelLevel) *Event

EventFromException creates a new Sentry event from the given `error` instance.

func (*Client)EventFromMessageadded inv0.21.0

func (client *Client) EventFromMessage(messagestring, levelLevel) *Event

EventFromMessage creates an event from the given message string.

func (*Client)Flush

func (client *Client) Flush(timeouttime.Duration)bool

Flush waits until the underlying Transport sends any buffered events to theSentry server, blocking for at most the given timeout. It returns false ifthe timeout was reached. In that case, some events may not have been sent.

Flush should be called before terminating the program to avoidunintentionally dropping events.

Do not call Flush indiscriminately after every call to CaptureEvent,CaptureException or CaptureMessage. Instead, to have the SDK send events overthe network synchronously, configure it to use the HTTPSyncTransport in thecall to Init.

func (*Client)FlushWithContextadded inv0.34.0

func (client *Client) FlushWithContext(ctxcontext.Context)bool

func (*Client)GetSDKIdentifieradded inv0.24.0

func (client *Client) GetSDKIdentifier()string

func (*Client)Options

func (client *Client) Options()ClientOptions

Options return ClientOptions for the current Client.

func (*Client)Recover

func (client *Client) Recover(err interface{}, hint *EventHint, scopeEventModifier) *EventID

Recover captures a panic.Returns EventID if successfully, or nil if there's no error to recover from.

func (*Client)RecoverWithContext

func (client *Client) RecoverWithContext(ctxcontext.Context,err interface{},hint *EventHint,scopeEventModifier,) *EventID

RecoverWithContext captures a panic and passes relevant context object.Returns EventID if successfully, or nil if there's no error to recover from.

func (*Client)SetSDKIdentifieradded inv0.24.0

func (client *Client) SetSDKIdentifier(identifierstring)

typeClientOptions

type ClientOptions struct {// The DSN to use. If the DSN is not set, the client is effectively// disabled.Dsnstring// In debug mode, the debug information is printed to stdout to help you// understand what sentry is doing.Debugbool// Configures whether SDK should generate and attach stacktraces to pure// capture message calls.AttachStacktracebool// The sample rate for event submission in the range [0.0, 1.0]. By default,// all events are sent. Thus, as a historical special case, the sample rate// 0.0 is treated as if it was 1.0. To drop all events, set the DSN to the// empty string.SampleRatefloat64// Enable performance tracing.EnableTracingbool// The sample rate for sampling traces in the range [0.0, 1.0].TracesSampleRatefloat64// Used to customize the sampling of traces, overrides TracesSampleRate.TracesSamplerTracesSampler// Control with URLs trace propagation should be enabled. Does not support regex patterns.TracePropagationTargets []string// PropagateTraceparent is used to control whether the W3C Trace Context HTTP traceparent header// is propagated on outgoing http requests.PropagateTraceparentbool// List of regexp strings that will be used to match against event's message// and if applicable, caught errors type and value.// If the match is found, then a whole event will be dropped.IgnoreErrors []string// List of regexp strings that will be used to match against a transaction's// name.  If a match is found, then the transaction  will be dropped.IgnoreTransactions []string// If this flag is enabled, certain personally identifiable information (PII) is added by active integrations.// By default, no such data is sent.SendDefaultPIIbool// BeforeSend is called before error events are sent to Sentry.// You can use it to mutate the event or return nil to discard it.BeforeSend func(event *Event, hint *EventHint) *Event// BeforeSendLong is called before log events are sent to Sentry.// You can use it to mutate the log event or return nil to discard it.BeforeSendLog func(event *Log) *Log// BeforeSendTransaction is called before transaction events are sent to Sentry.// Use it to mutate the transaction or return nil to discard the transaction.BeforeSendTransaction func(event *Event, hint *EventHint) *Event// Before breadcrumb add callback.BeforeBreadcrumb func(breadcrumb *Breadcrumb, hint *BreadcrumbHint) *Breadcrumb// BeforeSendMetric is called before metric events are sent to Sentry.// You can use it to mutate the metric or return nil to discard it.BeforeSendMetric func(metric *Metric) *Metric// Integrations to be installed on the current Client, receives default// integrations.Integrations func([]Integration) []Integration// io.Writer implementation that should be used with the Debug mode.DebugWriterio.Writer// The transport to use. Defaults to HTTPTransport.TransportTransport// The server name to be reported.ServerNamestring// The release to be sent with events.//// 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/.//// If Release is not set, the SDK will try to derive a default value// from environment variables or the Git repository in the working// directory.//// If you distribute a compiled binary, it is recommended to set the// Release value explicitly at build time. As an example, you can use://// go build -ldflags='-X main.release=VALUE'//// That will set the value of a predeclared variable 'release' in the// 'main' package to 'VALUE'. Then, use that variable when initializing// the SDK://// sentry.Init(ClientOptions{Release: release})//// Seehttps://golang.org/cmd/go/ andhttps://golang.org/cmd/link/ for// the official documentation of -ldflags and -X, respectively.Releasestring// The dist to be sent with events.Diststring// The environment to be sent with events.Environmentstring// Maximum number of breadcrumbs// when MaxBreadcrumbs is negative then ignore breadcrumbs.MaxBreadcrumbsint// Maximum number of spans.//// Seehttps://develop.sentry.dev/sdk/envelopes/#size-limits for size limits// applied during event ingestion. Events that exceed these limits might get dropped.MaxSpansint// An optional pointer to http.Client that will be used with a default// HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy,// HTTPSProxy and CaCerts options ignored.HTTPClient *http.Client// An optional pointer to http.Transport that will be used with a default// HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy// and CaCerts options ignored.HTTPTransporthttp.RoundTripper// An optional HTTP proxy to use.// This will default to the HTTP_PROXY environment variable.HTTPProxystring// An optional HTTPS proxy to use.// This will default to the HTTPS_PROXY environment variable.// HTTPS_PROXY takes precedence over HTTP_PROXY for https requests.HTTPSProxystring// An optional set of SSL certificates to use.CaCerts *x509.CertPool// MaxErrorDepth is the maximum number of errors reported in a chain of errors.// This protects the SDK from an arbitrarily long chain of wrapped errors.//// An additional consideration is that arguably reporting a long chain of errors// is of little use when debugging production errors with Sentry. The Sentry UI// is not optimized for long chains either. The top-level error together with a// stack trace is often the most useful information.MaxErrorDepthint// Default event tags. These are overridden by tags set on a scope.Tags map[string]string// EnableLogs controls when logs should be emitted.EnableLogsbool// DisableMetrics controls when metrics should be emitted.DisableMetricsbool// TraceIgnoreStatusCodes is a list of HTTP status codes that should not be traced.// Each element can be either:// - A single-element slice [code] for a specific status code// - A two-element slice [min, max] for a range of status codes (inclusive)// When an HTTP request results in a status code that matches any of these codes or ranges,// the transaction will not be sent to Sentry.//// Examples://   [][]int{{404}}                           // ignore only status code 404//   [][]int{{400, 405}}                     // ignore status codes 400-405//   [][]int{{404}, {500}}                   // ignore status codes 404 and 500//   [][]int{{404}, {400, 405}, {500, 599}}  // ignore 404, range 400-405, and range 500-599//// By default, this ignores 404 status codes.//// IMPORTANT: to not ignore any status codes, the option should be an empty slice and not nil. The nil option is// used for defaulting to 404 ignores.TraceIgnoreStatusCodes [][]int// DisableTelemetryBuffer disables the telemetry buffer layer for prioritizing events and uses the old transport layer.DisableTelemetryBufferbool}

ClientOptions that configures a SDK Client.

typeContextadded inv0.14.0

type Context = map[string]interface{}

typeDebugMetaadded inv0.20.0

type DebugMeta struct {SdkInfo *DebugMetaSdkInfo `json:"sdk_info,omitempty"`Images  []DebugMetaImage  `json:"images,omitempty"`}

The DebugMeta interface is not used in Golang apps, but may be populatedwhen proxying Events from other platforms, like iOS, Android, and theWeb. (See:https://develop.sentry.dev/sdk/event-payloads/debugmeta/ ).

typeDebugMetaImageadded inv0.20.0

type DebugMetaImage struct {Typestring `json:"type,omitempty"`// allImageAddrstring `json:"image_addr,omitempty"`// macho,elf,peImageSizeint    `json:"image_size,omitempty"`// macho,elf,peDebugIDstring `json:"debug_id,omitempty"`// macho,elf,pe,wasm,sourcemapDebugFilestring `json:"debug_file,omitempty"`// macho,elf,pe,wasmCodeIDstring `json:"code_id,omitempty"`// macho,elf,pe,wasmCodeFilestring `json:"code_file,omitempty"`// macho,elf,pe,wasm,sourcemapImageVmaddrstring `json:"image_vmaddr,omitempty"`// macho,elf,peArchstring `json:"arch,omitempty"`// macho,elf,peUUIDstring `json:"uuid,omitempty"`// proguard}

typeDebugMetaSdkInfoadded inv0.20.0

type DebugMetaSdkInfo struct {SdkNamestring `json:"sdk_name,omitempty"`VersionMajorint    `json:"version_major,omitempty"`VersionMinorint    `json:"version_minor,omitempty"`VersionPatchlevelint    `json:"version_patchlevel,omitempty"`}

typeDsn

type Dsn struct {protocol.Dsn}

Dsn is used as the remote address source to client transport.

funcNewDsn

func NewDsn(rawURLstring) (*Dsn,error)

NewDsn creates a Dsn by parsing rawURL. Most users will never call thisfunction directly. It is provided for use in custom Transportimplementations.

func (Dsn)RequestHeadersdeprecated

func (dsnDsn) RequestHeaders() map[string]string

RequestHeaders returns all the necessary headers that have to be used in the transport when sending eventsto the /store endpoint.

Deprecated: This method shall only be used if you want to implement your own transport that sends events tothe /store endpoint. If you're using the transport provided by the SDK, all necessary headers to authenticateagainst the /envelope endpoint are added automatically.

typeDsnParseError

type DsnParseError =protocol.DsnParseError

DsnParseError represents an error that occurs if a SentryDSN cannot be parsed.

typeDynamicSamplingContextadded inv0.16.0

type DynamicSamplingContext struct {Entries map[string]stringFrozenbool}

DynamicSamplingContext holds information about the current event that can be used to make dynamic sampling decisions.

funcDynamicSamplingContextFromHeaderadded inv0.16.0

func DynamicSamplingContextFromHeader(header []byte) (DynamicSamplingContext,error)

funcDynamicSamplingContextFromScopeadded inv0.29.0

func DynamicSamplingContextFromScope(scope *Scope, client *Client)DynamicSamplingContext

Constructs a new DynamicSamplingContext using a scope and client. Accessingfields on the scope are not thread safe, and this function should only becalled within scope methods.

funcDynamicSamplingContextFromTransactionadded inv0.16.0

func DynamicSamplingContextFromTransaction(span *Span)DynamicSamplingContext

func (DynamicSamplingContext)HasEntriesadded inv0.16.0

func (dDynamicSamplingContext) HasEntries()bool

func (DynamicSamplingContext)IsFrozenadded inv0.16.0

func (dDynamicSamplingContext) IsFrozen()bool

func (DynamicSamplingContext)Stringadded inv0.16.0

typeEvent

type Event struct {Breadcrumbs []*Breadcrumb          `json:"breadcrumbs,omitempty"`Contexts    map[string]Context     `json:"contexts,omitempty"`Diststring                 `json:"dist,omitempty"`Environmentstring                 `json:"environment,omitempty"`EventIDEventID                `json:"event_id,omitempty"`Extra       map[string]interface{} `json:"extra,omitempty"`Fingerprint []string               `json:"fingerprint,omitempty"`LevelLevel                  `json:"level,omitempty"`Messagestring                 `json:"message,omitempty"`Platformstring                 `json:"platform,omitempty"`Releasestring                 `json:"release,omitempty"`SdkSdkInfo                `json:"sdk,omitempty"`ServerNamestring                 `json:"server_name,omitempty"`Threads     []Thread               `json:"threads,omitempty"`Tags        map[string]string      `json:"tags,omitempty"`Timestamptime.Time              `json:"timestamp"`Transactionstring                 `json:"transaction,omitempty"`UserUser                   `json:"user,omitempty"`Loggerstring                 `json:"logger,omitempty"`Modules     map[string]string      `json:"modules,omitempty"`Request     *Request               `json:"request,omitempty"`Exception   []Exception            `json:"exception,omitempty"`DebugMeta   *DebugMeta             `json:"debug_meta,omitempty"`Attachments []*Attachment          `json:"-"`Typestring           `json:"type,omitempty"`StartTimetime.Time        `json:"start_timestamp"`Spans           []*Span          `json:"spans,omitempty"`TransactionInfo *TransactionInfo `json:"transaction_info,omitempty"`CheckIn       *CheckIn       `json:"check_in,omitempty"`MonitorConfig *MonitorConfig `json:"monitor_config,omitempty"`// The fields below are only relevant for logsLogs []Log `json:"-"`// The fields below are only relevant for metricsMetrics []Metric `json:"-"`// contains filtered or unexported fields}

Event is the fundamental data structure that is sent to Sentry.

funcNewEvent

func NewEvent() *Event

NewEvent creates a new Event.

func (*Event)GetCategoryadded inv0.38.0

func (e *Event) GetCategory()ratelimit.Category

GetCategory returns the rate limit category for this event.

func (*Event)GetDynamicSamplingContextadded inv0.38.0

func (e *Event) GetDynamicSamplingContext() map[string]string

GetDynamicSamplingContext returns trace context for the envelope header.

func (*Event)GetEventIDadded inv0.38.0

func (e *Event) GetEventID()string

GetEventID returns the event ID.

func (*Event)GetSdkInfoadded inv0.38.0

func (e *Event) GetSdkInfo() *protocol.SdkInfo

GetSdkInfo returns SDK information for the envelope header.

func (*Event)MarshalJSONadded inv0.6.0

func (e *Event) MarshalJSON() ([]byte,error)

MarshalJSON converts the Event struct to JSON.

func (*Event)SetExceptionadded inv0.21.0

func (e *Event) SetException(exceptionerror, maxErrorDepthint)

SetException appends the unwrapped errors to the event's exception list.

maxErrorDepth is the maximum depth of the error chain we will lookinto while unwrapping the errors. If maxErrorDepth is -1, we willunwrap all errors in the chain.

func (*Event)ToEnvelopeItemadded inv0.38.0

func (e *Event) ToEnvelopeItem() (*protocol.EnvelopeItem,error)

ToEnvelopeItem converts the Event to a Sentry envelope item.

typeEventHint

type EventHint struct {Data               interface{}EventIDstringOriginalExceptionerrorRecoveredException interface{}Contextcontext.ContextRequest            *http.RequestResponse           *http.Response}

EventHint contains information that can be associated with an Event.

typeEventID

type EventIDstring

EventID is a hexadecimal string representing a unique uuid4 for an Event.An EventID must be 32 characters long, lowercase and not have any dashes.

funcCaptureCheckInadded inv0.23.0

func CaptureCheckIn(checkIn *CheckIn, monitorConfig *MonitorConfig) *EventID

CaptureCheckIn captures a (cron) monitor check-in.

funcCaptureEvent

func CaptureEvent(event *Event) *EventID

CaptureEvent captures an event on the currently active client if any.

The event must already be assembled. Typically code would instead usethe utility methods like CaptureException. The return value is theevent ID. In case Sentry is disabled or event was dropped, the return value will be nil.

funcCaptureException

func CaptureException(exceptionerror) *EventID

CaptureException captures an error.

funcCaptureMessage

func CaptureMessage(messagestring) *EventID

CaptureMessage captures an arbitrary message.

funcLastEventID

func LastEventID()EventID

LastEventID returns an ID of last captured event.

funcRecover

func Recover() *EventID

Recover captures a panic.

funcRecoverWithContext

func RecoverWithContext(ctxcontext.Context) *EventID

RecoverWithContext captures a panic and passes relevant context object.

typeEventModifier

type EventModifier interface {ApplyToEvent(event *Event, hint *EventHint, client *Client) *Event}

EventModifier is the interface that wraps the ApplyToEvent method.

ApplyToEvent changes an event based on external data and/oran event hint.

typeEventProcessor

type EventProcessor func(event *Event, hint *EventHint) *Event

EventProcessor is a function that processes an event.Event processors are used to change an event before it is sent to Sentry.

typeException

type Exception struct {Typestring      `json:"type,omitempty"`// used as the main issue titleValuestring      `json:"value,omitempty"`// used as the main issue subtitleModulestring      `json:"module,omitempty"`ThreadIDuint64      `json:"thread_id,omitempty"`Stacktrace *Stacktrace `json:"stacktrace,omitempty"`Mechanism  *Mechanism  `json:"mechanism,omitempty"`}

Exception specifies an error that occurred.

typeFrame

type Frame struct {Functionstring `json:"function,omitempty"`Symbolstring `json:"symbol,omitempty"`// Module is, despite the name, the Sentry protocol equivalent of a Go// package's import path.Modulestring                 `json:"module,omitempty"`Filenamestring                 `json:"filename,omitempty"`AbsPathstring                 `json:"abs_path,omitempty"`Linenoint                    `json:"lineno,omitempty"`Colnoint                    `json:"colno,omitempty"`PreContext  []string               `json:"pre_context,omitempty"`ContextLinestring                 `json:"context_line,omitempty"`PostContext []string               `json:"post_context,omitempty"`InAppbool                   `json:"in_app"`Vars        map[string]interface{} `json:"vars,omitempty"`// Package and the below are not used for Go stack trace frames.  In// other platforms it refers to a container where the Module can be// found.  For example, a Java JAR, a .NET Assembly, or a native// dynamic library.  They exists for completeness, allowing the// construction and reporting of custom event payloads.Packagestring `json:"package,omitempty"`InstructionAddrstring `json:"instruction_addr,omitempty"`AddrModestring `json:"addr_mode,omitempty"`SymbolAddrstring `json:"symbol_addr,omitempty"`ImageAddrstring `json:"image_addr,omitempty"`Platformstring `json:"platform,omitempty"`StackStartbool   `json:"stack_start,omitempty"`}

Frame represents a function call and it's metadata. Frames are associatedwith a Stacktrace.

funcNewFrame

func NewFrame(fruntime.Frame)Frame

NewFrame assembles a stacktrace frame out of runtime.Frame.

typeHTTPSyncTransport

type HTTPSyncTransport struct {// HTTP Client request timeout. Defaults to 30 seconds.Timeouttime.Duration// contains filtered or unexported fields}

HTTPSyncTransport is a blocking implementation of Transport.

Clients using this transport will send requests to Sentry sequentially andblock until a response is returned.

The blocking behavior is useful in a limited set of use cases. For example,use it when deploying code to a Function as a Service ("Serverless")platform, where any work happening in a background goroutine is notguaranteed to execute.

For most cases, prefer HTTPTransport.

funcNewHTTPSyncTransport

func NewHTTPSyncTransport() *HTTPSyncTransport

NewHTTPSyncTransport returns a new pre-configured instance of HTTPSyncTransport.

func (*HTTPSyncTransport)Closeadded inv0.31.0

func (t *HTTPSyncTransport) Close()

func (*HTTPSyncTransport)Configure

func (t *HTTPSyncTransport) Configure(optionsClientOptions)

Configure is called by the Client itself, providing it it's own ClientOptions.

func (*HTTPSyncTransport)Flush

Flush is a no-op for HTTPSyncTransport. It always returns true immediately.

func (*HTTPSyncTransport)FlushWithContextadded inv0.34.0

func (t *HTTPSyncTransport) FlushWithContext(_context.Context)bool

FlushWithContext is a no-op for HTTPSyncTransport. It always returns true immediately.

func (*HTTPSyncTransport)SendEvent

func (t *HTTPSyncTransport) SendEvent(event *Event)

SendEvent assembles a new packet out of Event and sends it to the remote server.

func (*HTTPSyncTransport)SendEventWithContextadded inv0.28.0

func (t *HTTPSyncTransport) SendEventWithContext(ctxcontext.Context, event *Event)

SendEventWithContext assembles a new packet out of Event and sends it to the remote server.

typeHTTPTransport

type HTTPTransport struct {// Size of the transport buffer. Defaults to 30.BufferSizeint// HTTP Client request timeout. Defaults to 30 seconds.Timeouttime.Duration// contains filtered or unexported fields}

HTTPTransport is the default, non-blocking, implementation of Transport.

Clients using this transport will enqueue requests in a buffer and return tothe caller before any network communication has happened. Requests are sentto Sentry sequentially from a background goroutine.

funcNewHTTPTransport

func NewHTTPTransport() *HTTPTransport

NewHTTPTransport returns a new pre-configured instance of HTTPTransport.

func (*HTTPTransport)Closeadded inv0.31.0

func (t *HTTPTransport) Close()

Close will terminate events sending loop.It useful to prevent goroutines leak in case of multiple HTTPTransport instances initiated.

Close should be called after Flush and before terminating the programotherwise some events may be lost.

func (*HTTPTransport)Configure

func (t *HTTPTransport) Configure(optionsClientOptions)

Configure is called by the Client itself, providing it it's own ClientOptions.

func (*HTTPTransport)Flush

func (t *HTTPTransport) Flush(timeouttime.Duration)bool

Flush waits until any buffered events are sent to the Sentry server, blockingfor at most the given timeout. It returns false if the timeout was reached.In that case, some events may not have been sent.

Flush should be called before terminating the program to avoidunintentionally dropping events.

Do not call Flush indiscriminately after every call to SendEvent. Instead, tohave the SDK send events over the network synchronously, configure it to usethe HTTPSyncTransport in the call to Init.

func (*HTTPTransport)FlushWithContextadded inv0.34.0

func (t *HTTPTransport) FlushWithContext(ctxcontext.Context)bool

FlushWithContext works like Flush, but it accepts a context.Context instead of a timeout.

func (*HTTPTransport)SendEvent

func (t *HTTPTransport) SendEvent(event *Event)

SendEvent assembles a new packet out of Event and sends it to the remote server.

func (*HTTPTransport)SendEventWithContextadded inv0.28.0

func (t *HTTPTransport) SendEventWithContext(ctxcontext.Context, event *Event)

SendEventWithContext assembles a new packet out of Event and sends it to the remote server.

typeHub

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

Hub is the central object that manages scopes and clients.

This can be used to capture events and manage the scope.The default hub that is available automatically.

In most situations developers do not need to interface the hub. Insteadtoplevel convenience functions are exposed that will automatically dispatchto global (CurrentHub) hub. In some situations this might not bepossible in which case it might become necessary to manually work with thehub. This is for instance the case when working with async code.

funcCurrentHub

func CurrentHub() *Hub

CurrentHub returns an instance of previously initialized Hub stored in the global namespace.

funcGetHubFromContext

func GetHubFromContext(ctxcontext.Context) *Hub

GetHubFromContext tries to retrieve Hub instance from the given Context structor return nil if one is not found.

funcNewHub

func NewHub(client *Client, scope *Scope) *Hub

NewHub returns an instance of a Hub with provided Client and Scope bound.

func (*Hub)AddBreadcrumb

func (hub *Hub) AddBreadcrumb(breadcrumb *Breadcrumb, hint *BreadcrumbHint)

AddBreadcrumb records a new breadcrumb.

The total number of breadcrumbs that can be recorded are limited by theconfiguration on the client.

func (*Hub)BindClient

func (hub *Hub) BindClient(client *Client)

BindClient binds a new Client for the current Hub.

func (*Hub)CaptureCheckInadded inv0.23.0

func (hub *Hub) CaptureCheckIn(checkIn *CheckIn, monitorConfig *MonitorConfig) *EventID

CaptureCheckIn calls the method of the same name on currently bound Client instancepassing it a top-level Scope.Returns CheckInID if the check-in was captured successfully, or nil otherwise.

func (*Hub)CaptureEvent

func (hub *Hub) CaptureEvent(event *Event) *EventID

CaptureEvent calls the method of a same name on currently bound Client instancepassing it a top-level Scope.Returns EventID if successfully, or nil if there's no Scope or Client available.

func (*Hub)CaptureException

func (hub *Hub) CaptureException(exceptionerror) *EventID

CaptureException calls the method of a same name on currently bound Client instancepassing it a top-level Scope.Returns EventID if successfully, or nil if there's no Scope or Client available.

func (*Hub)CaptureMessage

func (hub *Hub) CaptureMessage(messagestring) *EventID

CaptureMessage calls the method of a same name on currently bound Client instancepassing it a top-level Scope.Returns EventID if successfully, or nil if there's no Scope or Client available.

func (*Hub)Client

func (hub *Hub) Client() *Client

Client returns top-level Client of the current Hub or nil if no Client is bound.

func (*Hub)Clone

func (hub *Hub) Clone() *Hub

Clone returns a copy of the current Hub with top-most scope and client copied over.

func (*Hub)ConfigureScope

func (hub *Hub) ConfigureScope(f func(scope *Scope))

ConfigureScope runs f in the current scope.

It is useful to set data that applies to all events that share the currentscope.

Modifying the scope affects all references to the current scope.

See also WithScope for making isolated temporary changes.

func (*Hub)Flush

func (hub *Hub) Flush(timeouttime.Duration)bool

Flush waits until the underlying Transport sends any buffered events to theSentry server, blocking for at most the given timeout. It returns false ifthe timeout was reached. In that case, some events may not have been sent.

Flush should be called before terminating the program to avoidunintentionally dropping events.

Do not call Flush indiscriminately after every call to CaptureEvent,CaptureException or CaptureMessage. Instead, to have the SDK send events overthe network synchronously, configure it to use the HTTPSyncTransport in thecall to Init.

func (*Hub)FlushWithContextadded inv0.34.0

func (hub *Hub) FlushWithContext(ctxcontext.Context)bool

func (*Hub)GetBaggageadded inv0.29.0

func (hub *Hub) GetBaggage()string

GetBaggage returns the current Sentry baggage string, to be used as a HTTP header valueor HTML meta tag value.This function is context aware, as in it either returns the baggage basedon the current span or the scope's propagation context.

func (*Hub)GetTraceparentadded inv0.29.0

func (hub *Hub) GetTraceparent()string

GetTraceparent returns the current Sentry traceparent string, to be used as a HTTP header valueor HTML meta tag value.This function is context aware, as in it either returns the traceparent basedon the current span, or the scope's propagation context.

func (*Hub)GetTraceparentW3Cadded inv0.41.0

func (hub *Hub) GetTraceparentW3C()string

GetTraceparentW3C returns the current traceparent string in W3C format.This is intended for propagation to downstream services that expect the W3C header.

func (*Hub)LastEventID

func (hub *Hub) LastEventID()EventID

LastEventID returns the ID of the last event (error or message) capturedthrough the hub and sent to the underlying transport.

Transactions and events dropped by sampling or event processors do not changethe last event ID.

LastEventID is a convenience method to cover use cases in which errors arecaptured indirectly and the ID is needed. For example, it can be used as partof an HTTP middleware to log the ID of the last error, if any.

For more flexibility, consider instead using the ClientOptions.BeforeSendfunction or event processors.

func (*Hub)PopScope

func (hub *Hub) PopScope()

PopScope drops the most recent scope.

Calls to PopScope must be coordinated with PushScope. For most cases, usingWithScope should be more convenient.

Calls to PopScope that do not match previous calls to PushScope are silentlyignored.

func (*Hub)PushScope

func (hub *Hub) PushScope() *Scope

PushScope pushes a new scope for the current Hub and reuses previously bound Client.

func (*Hub)Recover

func (hub *Hub) Recover(err interface{}) *EventID

Recover calls the method of a same name on currently bound Client instancepassing it a top-level Scope.Returns EventID if successfully, or nil if there's no Scope or Client available.

func (*Hub)RecoverWithContext

func (hub *Hub) RecoverWithContext(ctxcontext.Context, err interface{}) *EventID

RecoverWithContext calls the method of a same name on currently bound Client instancepassing it a top-level Scope.Returns EventID if successfully, or nil if there's no Scope or Client available.

func (*Hub)Scope

func (hub *Hub) Scope() *Scope

Scope returns top-level Scope of the current Hub or nil if no Scope is bound.

func (*Hub)WithScope

func (hub *Hub) WithScope(f func(scope *Scope))

WithScope runs f in an isolated temporary scope.

It is useful when extra data should be sent with a single capture call, forinstance a different level or tags.

The scope passed to f starts as a clone of the current scope and can befreely modified without affecting the current scope.

It is a shorthand for PushScope followed by PopScope.

typeIntegration

type Integration interface {Name()stringSetupOnce(client *Client)}

Integration allows for registering a functions that modify or discard captured events.

typeLevel

type Levelstring

Level marks the severity of the event.

const (LevelDebugLevel = "debug"LevelInfoLevel = "info"LevelWarningLevel = "warning"LevelErrorLevel = "error"LevelFatalLevel = "fatal")

Describes the severity of the event.

typeLogadded inv0.33.0

type Log struct {Timestamptime.Time            `json:"timestamp"`TraceIDTraceID              `json:"trace_id"`SpanIDSpanID               `json:"span_id,omitempty"`LevelLogLevel             `json:"level"`Severityint                  `json:"severity_number,omitempty"`Bodystring               `json:"body"`Attributes map[string]Attribute `json:"attributes,omitempty"`}

func (*Log)GetCategoryadded inv0.38.0

func (l *Log) GetCategory()ratelimit.Category

GetCategory returns the rate limit category for logs.

func (*Log)GetDynamicSamplingContextadded inv0.38.0

func (l *Log) GetDynamicSamplingContext() map[string]string

GetDynamicSamplingContext returns nil (trace context set when batching).

func (*Log)GetEventIDadded inv0.38.0

func (l *Log) GetEventID()string

GetEventID returns empty string (event ID set when batching).

func (*Log)GetSdkInfoadded inv0.38.0

func (l *Log) GetSdkInfo() *protocol.SdkInfo

GetSdkInfo returns nil (SDK info set when batching).

func (*Log)MarshalJSONadded inv0.41.0

func (l *Log) MarshalJSON() ([]byte,error)

MarshalJSON converts a Log to JSON that skips SpanID and timestamp when zero.

typeLogEntryadded inv0.35.0

type LogEntry interface {// WithCtx creates a new LogEntry with the specified context without overwriting the previous one.WithCtx(ctxcontext.Context)LogEntry// String adds a string attribute to the LogEntry.String(key, valuestring)LogEntry// Int adds an int attribute to the LogEntry.Int(keystring, valueint)LogEntry// Int64 adds an int64 attribute to the LogEntry.Int64(keystring, valueint64)LogEntry// Float64 adds a float64 attribute to the LogEntry.Float64(keystring, valuefloat64)LogEntry// Bool adds a bool attribute to the LogEntry.Bool(keystring, valuebool)LogEntry// Emit emits the LogEntry with the provided arguments.Emit(args ...interface{})// Emitf emits the LogEntry using a format string and arguments.Emitf(formatstring, args ...interface{})}

LogEntry defines the interface for a log entry that supports chaining attributes.

typeLogLeveladded inv0.33.0

type LogLevelstring
const (LogLevelTraceLogLevel = "trace"LogLevelDebugLogLevel = "debug"LogLevelInfoLogLevel = "info"LogLevelWarnLogLevel = "warn"LogLevelErrorLogLevel = "error"LogLevelFatalLogLevel = "fatal")

typeLogger

type Logger interface {// Write implements the io.Writer interface. Currently, the [sentry.Hub] is// context aware, in order to get the correct trace correlation. Using this// might result in incorrect span association on logs. If you need to use// Write it is recommended to create a NewLogger so that the associated context// is passed correctly.Write(p []byte) (nint, errerror)// SetAttributes allows attaching parameters to the logger using the attribute API.// These attributes will be included in all subsequent log entries.SetAttributes(...attribute.Builder)// Trace defines the [sentry.LogLevel] for the log entry.Trace()LogEntry// Debug defines the [sentry.LogLevel] for the log entry.Debug()LogEntry// Info defines the [sentry.LogLevel] for the log entry.Info()LogEntry// Warn defines the [sentry.LogLevel] for the log entry.Warn()LogEntry// Error defines the [sentry.LogLevel] for the log entry.Error()LogEntry// Fatal defines the [sentry.LogLevel] for the log entry.Fatal()LogEntry// Panic defines the [sentry.LogLevel] for the log entry.Panic()LogEntry// GetCtx returns the [context.Context] set on the logger.GetCtx()context.Context}

Logger provides a chaining API for structured logging to Sentry.

funcNewLoggeradded inv0.33.0

func NewLogger(ctxcontext.Context)Logger

NewLogger returns a Logger that emits logs to Sentry. If logging is turned off, all logs get discarded.

typeMechanismadded inv0.19.0

type Mechanism struct {Typestring         `json:"type"`Descriptionstring         `json:"description,omitempty"`HelpLinkstring         `json:"help_link,omitempty"`Sourcestring         `json:"source,omitempty"`Handled          *bool          `json:"handled,omitempty"`ParentID         *int           `json:"parent_id,omitempty"`ExceptionIDint            `json:"exception_id"`IsExceptionGroupbool           `json:"is_exception_group,omitempty"`Data             map[string]any `json:"data,omitempty"`}

Mechanism is the mechanism by which an exception was generated and handled.

func (*Mechanism)SetUnhandledadded inv0.19.0

func (m *Mechanism) SetUnhandled()

SetUnhandled indicates that the exception is an unhandled exception, i.e.from a panic.

typeMeteradded inv0.42.0

type Meter interface {// WithCtx returns a new Meter that uses the given context for trace/span association.WithCtx(ctxcontext.Context)Meter// SetAttributes allows attaching parameters to the meter using the attribute API.// These attributes will be included in all subsequent metrics.SetAttributes(attrs ...attribute.Builder)// Count records a count metric.Count(namestring, countint64, opts ...MeterOption)// Gauge records a gauge metric.Gauge(namestring, valuefloat64, opts ...MeterOption)// Distribution records a distribution metric.Distribution(namestring, samplefloat64, opts ...MeterOption)}

Meter provides an interface for recording metrics.

funcNewMeteradded inv0.42.0

func NewMeter(ctxcontext.Context)Meter

NewMeter returns a new Meter. If there is no Client bound to the current hub, or if metrics are disabled,it returns a no-op Meter that discards all metrics.

typeMeterOptionadded inv0.42.0

type MeterOption func(*meterOptions)

MeterOption configures a metric recording call.

funcWithAttributesadded inv0.42.0

func WithAttributes(attrs ...attribute.Builder)MeterOption

WithAttributes sets attributes for the metric.

funcWithScopeOverrideadded inv0.42.0

func WithScopeOverride(scope *Scope)MeterOption

WithScopeOverride sets a custom scope for the metric, overriding the default scope from the hub.

funcWithUnitadded inv0.42.0

func WithUnit(unitstring)MeterOption

WithUnit sets the unit for the metric (e.g., "millisecond", "byte").

typeMetricadded inv0.28.0

type Metric struct {Timestamptime.Time            `json:"timestamp"`TraceIDTraceID              `json:"trace_id"`SpanIDSpanID               `json:"span_id,omitempty"`TypeMetricType           `json:"type"`Namestring               `json:"name"`ValueMetricValue          `json:"value"`Unitstring               `json:"unit,omitempty"`Attributes map[string]Attribute `json:"attributes,omitempty"`}

func (*Metric)GetCategoryadded inv0.42.0

func (m *Metric) GetCategory()ratelimit.Category

GetCategory returns the rate limit category for metrics.

func (*Metric)GetDynamicSamplingContextadded inv0.42.0

func (m *Metric) GetDynamicSamplingContext() map[string]string

GetDynamicSamplingContext returns nil (trace context set when batching).

func (*Metric)GetEventIDadded inv0.42.0

func (m *Metric) GetEventID()string

GetEventID returns empty string (event ID set when batching).

func (*Metric)GetSdkInfoadded inv0.42.0

func (m *Metric) GetSdkInfo() *protocol.SdkInfo

GetSdkInfo returns nil (SDK info set when batching).

func (*Metric)MarshalJSONadded inv0.42.0

func (m *Metric) MarshalJSON() ([]byte,error)

MarshalJSON converts a Metric to JSON that skips SpanID and timestamp when zero.

typeMetricTypeadded inv0.42.0

type MetricTypestring
const (MetricTypeInvalidMetricType = ""MetricTypeCounterMetricType = "counter"MetricTypeGaugeMetricType = "gauge"MetricTypeDistributionMetricType = "distribution")

typeMetricValueadded inv0.42.0

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

MetricValue stores metric values with full precision.It supports int64 (for counters) and float64 (for gauges and distributions).

funcFloat64MetricValueadded inv0.42.0

func Float64MetricValue(vfloat64)MetricValue

Float64MetricValue creates a MetricValue from a float64.Used for gauge and distribution metrics.

funcInt64MetricValueadded inv0.42.0

func Int64MetricValue(vint64)MetricValue

Int64MetricValue creates a MetricValue from an int64.Used for counter metrics to preserve full int64 precision.

func (MetricValue)AsInterfaceadded inv0.42.0

func (vMetricValue) AsInterface()any

AsInterface returns the value as int64 or float64.Use type assertion or type switch to handle the result.

func (MetricValue)Float64added inv0.42.0

func (vMetricValue) Float64() (float64,bool)

Float64 returns the value as float64 if it holds a float64.The second return value indicates whether the type matched.

func (MetricValue)Int64added inv0.42.0

func (vMetricValue) Int64() (int64,bool)

Int64 returns the value as int64 if it holds an int64.The second return value indicates whether the type matched.

func (MetricValue)MarshalJSONadded inv0.42.0

func (vMetricValue) MarshalJSON() ([]byte,error)

MarshalJSON serializes the value as a bare number.

func (MetricValue)Typeadded inv0.42.0

func (vMetricValue) Type()attribute.Type

Type returns the type of the stored value (attribute.INT64 or attribute.FLOAT64).

typeMockScopeadded inv0.32.0

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

MockScope implementsScope for use in tests.

func (*MockScope)AddBreadcrumbadded inv0.32.0

func (scope *MockScope) AddBreadcrumb(breadcrumb *Breadcrumb, _int)

func (*MockScope)ApplyToEventadded inv0.32.0

func (scope *MockScope) ApplyToEvent(event *Event, _ *EventHint, _ *Client) *Event

typeMockTransportadded inv0.32.0

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

MockTransport implementsTransport for use in tests.

func (*MockTransport)Closeadded inv0.32.0

func (t *MockTransport) Close()

func (*MockTransport)Configureadded inv0.32.0

func (t *MockTransport) Configure(_ClientOptions)

func (*MockTransport)Eventsadded inv0.32.0

func (t *MockTransport) Events() []*Event

func (*MockTransport)Flushadded inv0.32.0

func (t *MockTransport) Flush(_time.Duration)bool

func (*MockTransport)FlushWithContextadded inv0.34.0

func (t *MockTransport) FlushWithContext(_context.Context)bool

func (*MockTransport)SendEventadded inv0.32.0

func (t *MockTransport) SendEvent(event *Event)

typeMonitorConfigadded inv0.23.0

type MonitorConfig struct {ScheduleMonitorSchedule `json:"schedule,omitempty"`// The allowed margin of minutes after the expected check-in time that// the monitor will not be considered missed for.CheckInMarginint64 `json:"checkin_margin,omitempty"`// The allowed duration in minutes that the monitor may be `in_progress`// for before being considered failed due to timeout.MaxRuntimeint64 `json:"max_runtime,omitempty"`// A tz database string representing the timezone which the monitor's execution schedule is in.// See:https://en.wikipedia.org/wiki/List_of_tz_database_time_zonesTimezonestring `json:"timezone,omitempty"`// The number of consecutive failed check-ins it takes before an issue is created.FailureIssueThresholdint64 `json:"failure_issue_threshold,omitempty"`// The number of consecutive OK check-ins it takes before an issue is resolved.RecoveryThresholdint64 `json:"recovery_threshold,omitempty"`}

typeMonitorScheduleadded inv0.23.0

type MonitorSchedule interface {// contains filtered or unexported methods}

funcCrontabScheduleadded inv0.23.0

func CrontabSchedule(scheduleStringstring)MonitorSchedule

CrontabSchedule defines the MonitorSchedule with a cron format.Example: "8 * * * *".

funcIntervalScheduleadded inv0.23.0

func IntervalSchedule(valueint64, unitMonitorScheduleUnit)MonitorSchedule

IntervalSchedule defines the MonitorSchedule with an interval format.

Example:

IntervalSchedule(1, sentry.MonitorScheduleUnitDay)

typeMonitorScheduleUnitadded inv0.23.0

type MonitorScheduleUnitstring
const (MonitorScheduleUnitMinuteMonitorScheduleUnit = "minute"MonitorScheduleUnitHourMonitorScheduleUnit = "hour"MonitorScheduleUnitDayMonitorScheduleUnit = "day"MonitorScheduleUnitWeekMonitorScheduleUnit = "week"MonitorScheduleUnitMonthMonitorScheduleUnit = "month"MonitorScheduleUnitYearMonitorScheduleUnit = "year")

typePropagationContextadded inv0.29.0

type PropagationContext struct {TraceIDTraceID                `json:"trace_id"`SpanIDSpanID                 `json:"span_id"`ParentSpanIDSpanID                 `json:"parent_span_id"`DynamicSamplingContextDynamicSamplingContext `json:"-"`}

funcNewPropagationContextadded inv0.29.0

func NewPropagationContext()PropagationContext

funcPropagationContextFromHeadersadded inv0.29.0

func PropagationContextFromHeaders(trace, baggagestring) (PropagationContext,error)

func (PropagationContext)Mapadded inv0.29.0

func (pPropagationContext) Map() map[string]interface{}

func (PropagationContext)MarshalJSONadded inv0.29.0

func (pPropagationContext) MarshalJSON() ([]byte,error)

typeRequest

type Request struct {URLstring            `json:"url,omitempty"`Methodstring            `json:"method,omitempty"`Datastring            `json:"data,omitempty"`QueryStringstring            `json:"query_string,omitempty"`Cookiesstring            `json:"cookies,omitempty"`Headers     map[string]string `json:"headers,omitempty"`Env         map[string]string `json:"env,omitempty"`}

Request contains information on a HTTP request related to the event.

funcNewRequestadded inv0.6.0

func NewRequest(r *http.Request) *Request

NewRequest returns a new Sentry Request from the given http.Request.

NewRequest avoids operations that depend on network access. In particular, itdoes not read r.Body.

typeSDKMetaDataadded inv0.16.0

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

SDKMetaData is a struct to stash data which is needed at some point in the SDK's event processing pipelinebut which shouldn't get send to Sentry.

typeSampledadded inv0.9.0

type Sampledint8

Sampled signifies a sampling decision.

const (SampledFalseSampled = -1SampledUndefinedSampled = 0SampledTrueSampled = 1)

The possible trace sampling decisions are: SampledFalse, SampledUndefined(default) and SampledTrue.

func (Sampled)Booladded inv0.9.0

func (sSampled) Bool()bool

Bool returns true if the sample decision is SampledTrue, false otherwise.

func (Sampled)Stringadded inv0.9.0

func (sSampled) String()string

typeSamplingContextadded inv0.9.0

type SamplingContext struct {Span   *Span// The current span, always non-nil.Parent *Span// The parent span, may be nil.}

A SamplingContext is passed to a TracesSampler to determine a samplingdecision.

TODO(tracing): possibly expand SamplingContext to include custom /user-provided data.

typeScope

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

Scope holds contextual data for the current scope.

The scope is an object that can cloned efficiently and stores data that islocally relevant to an event. For instance the scope will hold recordedbreadcrumbs and similar information.

The scope can be interacted with in two ways. First, the scope is routinelyupdated with information by functions such as AddBreadcrumb which will modifythe current scope. Second, the current scope can be configured through theConfigureScope function or Hub method of the same name.

The scope is meant to be modified but not inspected directly. When preparingan event for reporting, the current client adds information from the currentscope into the event.

funcNewScope

func NewScope() *Scope

NewScope creates a new Scope.

func (*Scope)AddAttachmentadded inv0.23.0

func (scope *Scope) AddAttachment(attachment *Attachment)

AddAttachment adds new attachment to the current scope.

func (*Scope)AddBreadcrumb

func (scope *Scope) AddBreadcrumb(breadcrumb *Breadcrumb, limitint)

AddBreadcrumb adds new breadcrumb to the current scopeand optionally throws the old one if limit is reached.

func (*Scope)AddEventProcessor

func (scope *Scope) AddEventProcessor(processorEventProcessor)

AddEventProcessor adds an event processor to the current scope.

func (*Scope)ApplyToEvent

func (scope *Scope) ApplyToEvent(event *Event, hint *EventHint, client *Client) *Event

ApplyToEvent takes the data from the current scope and attaches it to the event.

func (*Scope)Clear

func (scope *Scope) Clear()

Clear removes the data from the current scope. Not safe for concurrent use.

func (*Scope)ClearAttachmentsadded inv0.23.0

func (scope *Scope) ClearAttachments()

ClearAttachments clears all attachments from the current scope.

func (*Scope)ClearBreadcrumbs

func (scope *Scope) ClearBreadcrumbs()

ClearBreadcrumbs clears all breadcrumbs from the current scope.

func (*Scope)Clone

func (scope *Scope) Clone() *Scope

Clone returns a copy of the current scope with all data copied over.

func (*Scope)GetSpanadded inv0.33.0

func (scope *Scope) GetSpan() *Span

GetSpan returns the span from the current scope.

func (*Scope)RemoveContext

func (scope *Scope) RemoveContext(keystring)

RemoveContext removes a context from the current scope.

func (*Scope)RemoveExtra

func (scope *Scope) RemoveExtra(keystring)

RemoveExtra removes a extra from the current scope.

func (*Scope)RemoveTag

func (scope *Scope) RemoveTag(keystring)

RemoveTag removes a tag from the current scope.

func (*Scope)SetContext

func (scope *Scope) SetContext(keystring, valueContext)

SetContext adds a context to the current scope.

func (*Scope)SetContexts

func (scope *Scope) SetContexts(contexts map[string]Context)

SetContexts assigns multiple contexts to the current scope.

func (*Scope)SetExtra

func (scope *Scope) SetExtra(keystring, value interface{})

SetExtra adds an extra to the current scope.

func (*Scope)SetExtras

func (scope *Scope) SetExtras(extra map[string]interface{})

SetExtras assigns multiple extras to the current scope.

func (*Scope)SetFingerprint

func (scope *Scope) SetFingerprint(fingerprint []string)

SetFingerprint sets new fingerprint for the current scope.

func (*Scope)SetLevel

func (scope *Scope) SetLevel(levelLevel)

SetLevel sets new level for the current scope.

func (*Scope)SetPropagationContextadded inv0.29.0

func (scope *Scope) SetPropagationContext(propagationContextPropagationContext)

SetPropagationContext sets the propagation context for the current scope.

func (*Scope)SetRequest

func (scope *Scope) SetRequest(r *http.Request)

SetRequest sets the request for the current scope.

func (*Scope)SetRequestBodyadded inv0.6.0

func (scope *Scope) SetRequestBody(b []byte)

SetRequestBody sets the request body for the current scope.

This method should only be called when the body bytes are already availablein memory. Typically, the request body is buffered lazily from theRequest.Body from SetRequest.

func (*Scope)SetSpanadded inv0.29.0

func (scope *Scope) SetSpan(span *Span)

SetSpan sets a span for the current scope.

func (*Scope)SetTag

func (scope *Scope) SetTag(key, valuestring)

SetTag adds a tag to the current scope.

func (*Scope)SetTags

func (scope *Scope) SetTags(tags map[string]string)

SetTags assigns multiple tags to the current scope.

func (*Scope)SetUser

func (scope *Scope) SetUser(userUser)

SetUser sets the user for the current scope.

typeSdkInfo

type SdkInfo =protocol.SdkInfo

SdkInfo contains all metadata about the SDK.

typeSdkPackage

type SdkPackage =protocol.SdkPackage

typeSpanadded inv0.7.0

type Span struct {TraceIDTraceID           `json:"trace_id"`SpanIDSpanID            `json:"span_id"`ParentSpanIDSpanID            `json:"parent_span_id"`Namestring            `json:"name,omitempty"`Opstring            `json:"op,omitempty"`Descriptionstring            `json:"description,omitempty"`StatusSpanStatus        `json:"status,omitempty"`Tags         map[string]string `json:"tags,omitempty"`StartTimetime.Time         `json:"start_timestamp"`EndTimetime.Time         `json:"timestamp"`// Deprecated: use Data instead. To be removed in 0.33.0Extra   map[string]interface{} `json:"-"`Data    map[string]interface{} `json:"data,omitempty"`SampledSampled                `json:"-"`SourceTransactionSource      `json:"-"`OriginSpanOrigin             `json:"origin,omitempty"`// contains filtered or unexported fields}

A Span is the building block of a Sentry transaction. Spans build up a treestructure of timed operations. The span tree makes up a transaction eventthat is sent to Sentry when the root span is finished.

Spans must be started with either StartSpan or Span.StartChild.

funcSpanFromContextadded inv0.23.0

func SpanFromContext(ctxcontext.Context) *Span

SpanFromContext returns the last span stored in the context, or nil if no spanis set on the context.

funcStartSpanadded inv0.9.0

func StartSpan(ctxcontext.Context, operationstring, options ...SpanOption) *Span

StartSpan starts a new span to describe an operation. The new span will be achild of the last span stored in ctx, if any.

One or more options can be used to modify the span properties. Typically oneoption as a function literal is enough. Combining multiple options can beuseful to define and reuse specific properties with named functions.

Caller should call the Finish method on the span to mark its end. Finishing aroot span sends the span and all of its children, recursively, as atransaction to Sentry.

funcStartTransactionadded inv0.15.0

func StartTransaction(ctxcontext.Context, namestring, options ...SpanOption) *Span

StartTransaction will create a transaction (root span) if there's no existingtransaction in the context otherwise, it will return the existing transaction.

funcTransactionFromContextadded inv0.9.0

func TransactionFromContext(ctxcontext.Context) *Span

TransactionFromContext returns the root span of the current transaction. Itreturns nil if no transaction is tracked in the context.

func (*Span)Contextadded inv0.9.0

func (s *Span) Context()context.Context

Context returns the context containing the span.

func (*Span)Finishadded inv0.9.0

func (s *Span) Finish()

Finish sets the span's end time, unless already set. If the span is the rootof a span tree, Finish sends the span tree to Sentry as a transaction.

The logic is executed at most once per span, so that (incorrectly) calling it twicenever double sends to Sentry.

func (*Span)GetTransactionadded inv0.18.0

func (s *Span) GetTransaction() *Span

GetTransaction returns the transaction that contains this span.

For transaction spans it returns itself. For spans that were created manuallythe method returns "nil".

func (*Span)IsTransactionadded inv0.18.0

func (s *Span) IsTransaction()bool

IsTransaction checks if the given span is a transaction.

func (*Span)MarshalJSONadded inv0.9.0

func (s *Span) MarshalJSON() ([]byte,error)

func (*Span)SetContextadded inv0.20.0

func (s *Span) SetContext(keystring, valueContext)

SetContext sets a context on the span. It is recommended to use SetContext instead ofaccessing the contexts map directly as SetContext takes care of initializing the mapwhen necessary.

func (*Span)SetDataadded inv0.18.0

func (s *Span) SetData(namestring, value interface{})

SetData sets a data on the span. It is recommended to use SetData instead ofaccessing the data map directly as SetData takes care of initializing the mapwhen necessary.

func (*Span)SetDynamicSamplingContextadded inv0.18.0

func (s *Span) SetDynamicSamplingContext(dscDynamicSamplingContext)

SetDynamicSamplingContext sets the given dynamic sampling context on thecurrent transaction.

func (*Span)SetTagadded inv0.9.0

func (s *Span) SetTag(name, valuestring)

SetTag sets a tag on the span. It is recommended to use SetTag instead ofaccessing the tags map directly as SetTag takes care of initializing the mapwhen necessary.

func (*Span)StartChildadded inv0.9.0

func (s *Span) StartChild(operationstring, options ...SpanOption) *Span

StartChild starts a new child span.

The call span.StartChild(operation, options...) is a shortcut forStartSpan(span.Context(), operation, options...).

func (*Span)ToBaggageadded inv0.16.0

func (s *Span) ToBaggage()string

ToBaggage returns the serialized DynamicSamplingContext from a transaction.Use this function to propagate the DynamicSamplingContext to a downstream SDK,either as the value of the "baggage" HTTP header, or as an html "baggage" meta tag.

func (*Span)ToSentryTraceadded inv0.9.0

func (s *Span) ToSentryTrace()string

ToSentryTrace returns the serialized TraceParentContext from a transaction/span.Use this function to propagate the TraceParentContext to a downstream SDK,either as the value of the "sentry-trace" HTTP header, or as an html "sentry-trace" meta tag.

func (*Span)ToTraceparentadded inv0.41.0

func (s *Span) ToTraceparent()string

ToTraceparent returns the W3C traceparent header value for the span.

typeSpanIDadded inv0.9.0

type SpanID [8]byte

SpanID identifies a span.

func (SpanID)Hexadded inv0.9.0

func (idSpanID) Hex() []byte

func (SpanID)MarshalTextadded inv0.9.0

func (idSpanID) MarshalText() ([]byte,error)

func (SpanID)Stringadded inv0.9.0

func (idSpanID) String()string

typeSpanOptionadded inv0.9.0

type SpanOption func(s *Span)

A SpanOption is a function that can modify the properties of a span.

funcContinueFromHeadersadded inv0.16.0

func ContinueFromHeaders(trace, baggagestring)SpanOption

ContinueFromHeaders returns a span option that updates the span to continuean existing TraceID and propagates the Dynamic Sampling context.

funcContinueFromRequestadded inv0.9.0

func ContinueFromRequest(r *http.Request)SpanOption

ContinueFromRequest returns a span option that updates the span to continuean existing trace. If it cannot detect an existing trace in the request, thespan will be left unchanged.

ContinueFromRequest is an alias for:

ContinueFromHeaders(r.Header.Get(SentryTraceHeader), r.Header.Get(SentryBaggageHeader)).

funcContinueFromTraceadded inv0.14.0

func ContinueFromTrace(tracestring)SpanOption

ContinueFromTrace returns a span option that updates the span to continuean existing TraceID.

funcContinueTraceadded inv0.29.0

func ContinueTrace(hub *Hub, traceparent, baggagestring)SpanOption

ContinueTrace continues a trace based on traceparent and baggage values.If the SDK is configured with tracing enabled,this function returns populated SpanOption.In any other cases, it populates the propagation context on the scope.

funcWithDescriptionadded inv0.26.0

func WithDescription(descriptionstring)SpanOption

WithDescription sets the description of a span.

funcWithOpNameadded inv0.21.0

func WithOpName(namestring)SpanOption

WithOpName sets the operation name for a given span.

funcWithSpanOriginadded inv0.29.0

func WithSpanOrigin(originSpanOrigin)SpanOption

WithSpanOrigin sets the origin of the span.

funcWithSpanSampledadded inv0.21.0

func WithSpanSampled(sampledSampled)SpanOption

WithSpanSampled updates the sampling flag for a given span.

funcWithTransactionNameadded inv0.21.0

func WithTransactionName(namestring)SpanOption

WithTransactionName option sets the name of the current transaction.

A span tree has a single transaction name, therefore using this option whenstarting a span affects the span tree as a whole, potentially overwriting aname set previously.

funcWithTransactionSourceadded inv0.21.0

func WithTransactionSource(sourceTransactionSource)SpanOption

WithTransactionSource sets the source of the transaction name.

Note: if the transaction source is not a valid source (as describedby the spechttps://develop.sentry.dev/sdk/event-payloads/transaction/#transaction-annotations),it will be corrected to "custom" eventually, before the transaction is sent.

typeSpanOriginadded inv0.29.0

type SpanOriginstring

SpanOrigin indicates what created a trace or a span. See:https://develop.sentry.dev/sdk/performance/trace-origin/

typeSpanStatusadded inv0.9.0

type SpanStatusuint8

SpanStatus is the status of a span.

const (SpanStatusUndefinedSpanStatus =iotaSpanStatusOKSpanStatusCanceledSpanStatusUnknownSpanStatusInvalidArgumentSpanStatusDeadlineExceededSpanStatusNotFoundSpanStatusAlreadyExistsSpanStatusPermissionDeniedSpanStatusResourceExhaustedSpanStatusFailedPreconditionSpanStatusAbortedSpanStatusOutOfRangeSpanStatusUnimplementedSpanStatusInternalErrorSpanStatusUnavailableSpanStatusDataLossSpanStatusUnauthenticated)

funcHTTPtoSpanStatusadded inv0.22.0

func HTTPtoSpanStatus(codeint)SpanStatus

HTTPtoSpanStatus converts an HTTP status code to a SpanStatus.

func (SpanStatus)MarshalJSONadded inv0.9.0

func (ssSpanStatus) MarshalJSON() ([]byte,error)

func (SpanStatus)Stringadded inv0.9.0

func (ssSpanStatus) String()string

typeStacktrace

type Stacktrace struct {Frames        []Frame `json:"frames,omitempty"`FramesOmitted []uint  `json:"frames_omitted,omitempty"`}

Stacktrace holds information about the frames of the stack.

funcExtractStacktrace

func ExtractStacktrace(errerror) *Stacktrace

ExtractStacktrace creates a new Stacktrace based on the given error.

funcNewStacktrace

func NewStacktrace() *Stacktrace

NewStacktrace creates a stacktrace using runtime.Callers.

typeThread

type Thread struct {IDstring      `json:"id,omitempty"`Namestring      `json:"name,omitempty"`Stacktrace *Stacktrace `json:"stacktrace,omitempty"`Crashedbool        `json:"crashed,omitempty"`Currentbool        `json:"current,omitempty"`}

Thread specifies threads that were running at the time of an event.

typeTraceContextadded inv0.7.0

type TraceContext struct {TraceIDTraceID                `json:"trace_id"`SpanIDSpanID                 `json:"span_id"`ParentSpanIDSpanID                 `json:"parent_span_id"`Opstring                 `json:"op,omitempty"`Descriptionstring                 `json:"description,omitempty"`StatusSpanStatus             `json:"status,omitempty"`Data         map[string]interface{} `json:"data,omitempty"`}

A TraceContext carries information about an ongoing trace and is meant to bestored in Event.Contexts (as *TraceContext).

func (TraceContext)Mapadded inv0.14.0

func (tcTraceContext) Map() map[string]interface{}

func (*TraceContext)MarshalJSONadded inv0.9.0

func (tc *TraceContext) MarshalJSON() ([]byte,error)

typeTraceIDadded inv0.9.0

type TraceID [16]byte

TraceID identifies a trace.

func (TraceID)Hexadded inv0.9.0

func (idTraceID) Hex() []byte

func (TraceID)MarshalTextadded inv0.9.0

func (idTraceID) MarshalText() ([]byte,error)

func (TraceID)Stringadded inv0.9.0

func (idTraceID) String()string

typeTraceParentContextadded inv0.18.0

type TraceParentContext struct {TraceIDTraceIDParentSpanIDSpanIDSampledSampled}

TraceParentContext describes the context of a (remote) parent span.

The context is normally extracted from a received "sentry-trace" header andused to initialize a new transaction.

Note: the name might be not the best one. It was taken mostly to stay alignedwith other SDKs, and it alludes to W3C "traceparent" header (https://www.w3.org/TR/trace-context/),which serves a similar purpose to "sentry-trace". We should eventually considermaking this type internal-only and give it a better name.

funcParseTraceParentContextadded inv0.18.0

func ParseTraceParentContext(header []byte) (traceParentContextTraceParentContext, validbool)

ParseTraceParentContext parses a sentry-trace header and builds a TraceParentContext from theparsed values. If the header was parsed correctly, the second returned argument("valid") will be set to true, otherwise (e.g., empty or malformed header) it willbe false.

typeTracesSampleradded inv0.9.0

type TracesSampler func(ctxSamplingContext)float64

The TracesSample type is an adapter to allow the use of ordinaryfunctions as a TracesSampler.

func (TracesSampler)Sampleadded inv0.9.0

typeTransactionInfoadded inv0.16.0

type TransactionInfo struct {SourceTransactionSource `json:"source,omitempty"`}

Contains information about how the name of the transaction was determined.

typeTransactionSourceadded inv0.16.0

type TransactionSourcestring

Contains information about how the name of the transaction was determined.

const (SourceCustomTransactionSource = "custom"SourceURLTransactionSource = "url"SourceRouteTransactionSource = "route"SourceViewTransactionSource = "view"SourceComponentTransactionSource = "component"SourceTaskTransactionSource = "task")

typeTransport

type Transport interface {Flush(timeouttime.Duration)boolFlushWithContext(ctxcontext.Context)boolConfigure(optionsClientOptions)SendEvent(event *Event)Close()}

Transport is used by the Client to deliver events to remote server.

typeUser

type User struct {IDstring            `json:"id,omitempty"`Emailstring            `json:"email,omitempty"`IPAddressstring            `json:"ip_address,omitempty"`Usernamestring            `json:"username,omitempty"`Namestring            `json:"name,omitempty"`Data      map[string]string `json:"data,omitempty"`}

User describes the user associated with an Event. If this is used, at leastan ID or an IP address should be provided.

func (User)IsEmptyadded inv0.15.0

func (uUser) IsEmpty()bool

Source Files

View all Source files

Directories

PathSynopsis
_examples
basiccommand
This is an example program that makes an HTTP request and prints response headers.
This is an example program that makes an HTTP request and prints response headers.
cronscommand
echocommand
fasthttpcommand
fibercommand
flushcommand
gincommand
httpcommand
This is an example web server to demonstrate how to instrument error and performance monitoring with Sentry.
This is an example web server to demonstrate how to instrument error and performance monitoring with Sentry.
httpclientcommand
iriscommand
logruscommand
logscommand
metricscommand
negronicommand
recovercommand
recover-repaniccommand
This is an example program that demonstrates an advanced use of the Sentry SDK using Hub, Scope and EventProcessor to recover from runtime panics, report to Sentry filtering specific frames from the stack trace and then letting the program crash as usual.
This is an example program that demonstrates an advanced use of the Sentry SDK using Hub, Scope and EventProcessor to recover from runtime panics, report to Sentry filtering specific frames from the stack trace and then letting the program crash as usual.
slogcommand
with_extracommand
zerologcommand
echomodule
fasthttpmodule
fibermodule
ginmodule
Package sentryhttp provides Sentry integration for servers based on the net/http package.
Package sentryhttp provides Sentry integration for servers based on the net/http package.
Package sentryhttpclient provides Sentry integration for Requests modules to enable distributed tracing between services.
Package sentryhttpclient provides Sentry integration for Requests modules to enable distributed tracing between services.
internal
otel/baggage/internal/baggage
Package baggage provides base types and functionality to store and retrieve baggage in Go context.
Package baggage provides base types and functionality to store and retrieve baggage in Go context.
ratelimit
Package ratelimit provides tools to work with rate limits imposed by Sentry's data ingestion pipeline.
Package ratelimit provides tools to work with rate limits imposed by Sentry's data ingestion pipeline.
irismodule
logrusmodule
negronimodule
otelmodule
slogmodule
zerologmodule

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2026 Movatter.jp