sentrytemporal

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 7 Imported by: 0

README

Sentry Temporal Interceptor

The temporal interceptor captures panic and errors and report them to sentry server.

Installation

go get github.com/sdcxtech/sentrytemporal
	// The client and worker are heavyweight objects that should be created once per process.
	c, err := client.Dial(client.Options{})
	if err != nil {
		log.Fatalln("Unable to create client", err)
	}
	defer c.Close()

	w := worker.New(c, "taskQueue", worker.Options{
		// Create interceptor that will put started time on the logger
		Interceptors: []sdkinterceptor.WorkerInterceptor{
			sentrytemp.New(
				sentry.CurrentHub(),
				sentrytemp.Options{},
			),
		},
	})

Configuration

New accepts a struct of Options that allows you to configure how the inteceptor will behave.

type Options struct {
	// ActivityErrorSkipper configures a function to determine if an error from activity should be skipped.
	ActivityErrorSkipper ErrorSkipper
	// WorkflowErrorSkipper configures a function to determine if an error from workflow should be skipped.
	WorkflowErrorSkipper ErrorSkipper
}

type ErrorSkipper func(err error) bool

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(hub *sentry.Hub, opts Options) interceptor.WorkerInterceptor

New creates a worker interceptor which will report error to sentry.

Types

type ErrorSkipper

type ErrorSkipper func(err error) bool

type Options

type Options struct {
	// ActivityErrorSkipper configures a function to determine if an error from activity should be skipped.
	ActivityErrorSkipper ErrorSkipper
	// WorkflowErrorSkipper configures a function to determine if an error from workflow should be skipped.
	WorkflowErrorSkipper ErrorSkipper
}

Jump to

Keyboard shortcuts

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