sentryadam

package
v0.0.0-...-0d878e0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sentryadam provides utilities to use sentry with adam.

Index

Constants

This section is empty.

Variables

View Source
var (
	HubKey  = sentrystate.HubKey
	SpanKey = spanKey(invokeSpan)
)

Functions

func Hub

func Hub(ctx *plugin.Context) *sentry.Hub

Hub retrieves the *sentry.Hub from the passed *event.Base. In order for Hub to return with a non-nil *sentry.Hub, a hub must have previously been stored under the HubKey by a middleware, such as the three middlewares provided by sentryadam.

func NoPerformanceMonitoring

func NoPerformanceMonitoring(source string, id plugin.ID)

NoPerformanceMonitoring disables performance monitoring for the command with the given source name and id.

Performance monitoring may be further limited depending on the settings given to the wrapper.

func Transaction

func Transaction(ctx *plugin.Context) *sentry.Span

Transaction retrieves the *sentry.Span from the passed *event.Base. In order for Transaction to return with a non-nil *sentry.Span, a spanType must have previously been stored under the SpanKey by a middleware, such as the three middlewares provided by sentryadam. Further, performance monitoring must be enabled for the command.

Types

type Options

type Options struct {
	// Hub is the required hub used to power the wrapper.
	Hub *sentry.Hub

	// PerformanceSources are the names of the sources whose performance
	// shall be monitored.
	//
	// Set this to []string{} to disable performance monitoring.
	//
	// Performance monitoring may be further limited by the disabling
	// monitoring for certain commands globally.
	//
	// Default: []string{plugin.BuiltInSource}
	PerformanceSources []string
}

type Wrapper

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

func New

func New(o Options) *Wrapper

New creates a new *Wrapper from the given options.

You must add all middlewares according to their documentation to the bot, in order for tracing to work.

func (*Wrapper) PostRouteMiddleware

func (w *Wrapper) PostRouteMiddleware(next bot.CommandFunc) bot.CommandFunc

PostRouteMiddleware is the middleware that must be added immediately after the bot's default middlewares.

func (*Wrapper) PreInvokeMiddleware

func (w *Wrapper) PreInvokeMiddleware(next bot.CommandFunc) bot.CommandFunc

PreInvokeMiddleware is the post middleware that must be added last.

func (*Wrapper) PreRouteMiddleware

func (w *Wrapper) PreRouteMiddleware(next bot.CommandFunc) bot.CommandFunc

PreRouteMiddleware is the first middleware to be added to the bot. It adds a *sentry.Hub to the *plugin.Context and starts a transaction.

The bot's NoDefaultMiddlewares option must be enabled, and the default middleware must manually be added after the middleware returned by NewPreRouteMiddleware.

Jump to

Keyboard shortcuts

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