Categorygithub.com/Cleanshelf/sentry-go
modulepackage
0.16.0
Repository: https://github.com/cleanshelf/sentry-go.git
Documentation: pkg.go.dev

# README

Sentry

Official Sentry SDK for Go

Build Status Go Report Card Discord GoDoc go.dev

sentry-go provides a Sentry client implementation for the Go programming language. This is the next generation of the Go SDK for Sentry, intended to replace the raven-go package.

Looking for the old raven-go SDK documentation? See the Legacy client section here. If you want to start using sentry-go instead, check out the migration guide.

Requirements

The only requirement is a Go compiler.

We verify this package against the 3 most recent releases of Go. Those are the supported versions. The exact versions are defined in GitHub 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 through go get:

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

Check out the list of released versions.

Configuration

To use sentry-go, you’ll need to import the sentry-go package and initialize it with your DSN and other options.

If not specified in the SDK initialization, the DSN, Release and Environment are read from the environment variables SENTRY_DSN, SENTRY_RELEASE and SENTRY_ENVIRONMENT, respectively.

More on this in the Configuration 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 our examples:

We also provide a complete API reference.

For more detailed information about how to get the most out of sentry-go, checkout the official documentation:

Resources

License

Licensed under The 2-Clause BSD License, see LICENSE.

Community

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

# Packages

No description provided by the author
Package sentryhttp provides Sentry integration for servers based on the net/http package.
Package sentrylogrus provides a simple Logrus hook for Sentry.

# Functions

AddBreadcrumb records a new breadcrumb.
AddGlobalEventProcessor adds processor to the global list of event processors.
CaptureEvent captures an event on the currently active client if any.
CaptureException captures an error.
CaptureMessage captures an arbitrary message.
ConfigureScope is a shorthand for CurrentHub().ConfigureScope.
ContinueFromHeaders returns a span option that updates the span to continue an existing TraceID and propagates the Dynamic Sampling context.
ContinueFromRequest returns a span option that updates the span to continue an existing trace.
ContinueFromTrace returns a span option that updates the span to continue an existing TraceID.
CurrentHub returns an instance of previously initialized Hub stored in the global namespace.
No description provided by the author
No description provided by the author
ExtractStacktrace creates a new Stacktrace based on the given error.
Flush waits until the underlying Transport sends any buffered events to the Sentry server, blocking for at most the given timeout.
GetHubFromContext tries to retrieve Hub instance from the given Context struct or return nil if one is not found.
HasHubOnContext checks whether Hub instance is bound to a given Context struct.
Init initializes the SDK with options.
LastEventID returns an ID of last captured event.
NewClient creates and returns an instance of Client configured using ClientOptions.
NewDsn creates a Dsn by parsing rawURL.
NewEvent creates a new Event.
NewFrame assembles a stacktrace frame out of runtime.Frame.
NewHTTPSyncTransport returns a new pre-configured instance of HTTPSyncTransport.
NewHTTPTransport returns a new pre-configured instance of HTTPTransport.
NewHub returns an instance of a Hub with provided Client and Scope bound.
NewRequest returns a new Sentry Request from the given http.Request.
NewScope creates a new Scope.
NewStacktrace creates a stacktrace using runtime.Callers.
OpName sets the operation name for a given span.
PopScope is a shorthand for CurrentHub().PopScope.
PushScope is a shorthand for CurrentHub().PushScope.
Recover captures a panic.
RecoverWithContext captures a panic and passes relevant context object.
SetHubOnContext stores given Hub instance on the Context struct and returns a new Context.
StartSpan starts a new span to describe an operation.
StartTransaction will create a transaction (root span) if there's no existing transaction in the context otherwise, it will return the existing transaction.
TransactionFromContext returns the root span of the current transaction.
The TransactionName option sets the name of the current transaction.
TransctionSource sets the source of the transaction name.
WithScope is a shorthand for CurrentHub().WithScope.

# Constants

HubContextKey is the key used to store the current Hub.
Describes the severity of the event.
Describes the severity of the event.
Describes the severity of the event.
Describes the severity of the event.
Describes the severity of the event.
RequestContextKey is the key used to store the current http.Request.
The possible trace sampling decisions are: SampledFalse, SampledUndefined (default) and SampledTrue.
The possible trace sampling decisions are: SampledFalse, SampledUndefined (default) and SampledTrue.
The possible trace sampling decisions are: SampledFalse, SampledUndefined (default) and SampledTrue.
The identifier of the SDK.
Version is the version of the SDK.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Deprecated: Use SDKVersion instead.

# Variables

Logger is an instance of log.Logger that is use to provide debug information about running Sentry Client can be enabled by either using Logger.SetOutput directly or with Debug client option.

# Structs

Breadcrumb specifies an application event that occurred before a Sentry event.
Client is the underlying processor that is used by the main API and Hub instances.
ClientOptions that configures a SDK Client.
Dsn is used as the remote address source to client transport.
DsnParseError represents an error that occurs if a Sentry DSN cannot be parsed.
DynamicSamplingContext holds information about the current event that can be used to make dynamic sampling decisions.
Event is the fundamental data structure that is sent to Sentry.
EventHint contains information that can be associated with an Event.
Exception specifies an error that occurred.
Frame represents a function call and it's metadata.
HTTPSyncTransport is a blocking implementation of Transport.
HTTPTransport is the default, non-blocking, implementation of Transport.
Hub is the central object that manages scopes and clients.
Request contains information on a HTTP request related to the event.
A SamplingContext is passed to a TracesSampler to determine a sampling decision.
Scope holds contextual data for the current scope.
SdkInfo contains all metadata about about the SDK being used.
SDKMetaData is a struct to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get send to Sentry.
SdkPackage describes a package that was installed.
A Span is the building block of a Sentry transaction.
Stacktrace holds information about the frames of the stack.
Thread specifies threads that were running at the time of an event.
A TraceContext carries information about an ongoing trace and is meant to be stored in Event.Contexts (as *TraceContext).
Contains information about how the name of the transaction was determined.
User describes the user associated with an Event.

# Interfaces

EventModifier is the interface that wraps the ApplyToEvent method.
Integration allows for registering a functions that modify or discard captured events.
Transport is used by the Client to deliver events to remote server.

# Type aliases

BreadcrumbHint contains information that can be associated with a Breadcrumb.
No description provided by the author
EventID is a hexadecimal string representing a unique uuid4 for an Event.
EventProcessor is a function that processes an event.
Level marks the severity of the event.
Sampled signifies a sampling decision.
SpanID identifies a span.
A SpanOption is a function that can modify the properties of a span.
SpanStatus is the status of a span.
TraceID identifies a trace.
The TracesSample type is an adapter to allow the use of ordinary functions as a TracesSampler.
Contains information about how the name of the transaction was determined.