epsagon

package
v0.0.0-...-2096857 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultErrorType = "Error"

DefaultErrorType Default custom error type

View Source
const MaxMetadataSize = 10 * 1024

MaxMetadataSize Maximum size of event metadata

View Source
const TimeoutErrorCode protocol.ErrorCode = 3

Variables

This section is empty.

Functions

func ContextWithTracer

func ContextWithTracer(t tracer.Tracer, ctx ...context.Context) context.Context

ContextWithTracer creates a context with given tracer

func DebugLog

func DebugLog(debugMode bool, args ...interface{})

func Error

func Error(value interface{}, args ...context.Context)

Error adds an error to the sent trace

func ExtractRequestData

func ExtractRequestData(req *http.Request) (headers string, body string)

ExtractRequestData extracts headers and body from http.Request

func ExtractTracer

func ExtractTracer(ctx []context.Context) tracer.Tracer

ExtractTracer Extracts the tracer from given contexts (using first context), returns Global tracer if no context is given and GlobalTracer is valid (= non nil, not stopped)

func FormatHeaders

func FormatHeaders(headers http.Header) (string, error)

FormatHeaders format HTTP headers to string - using first header value, ignoring the rest

func GeneralEpsagonRecover

func GeneralEpsagonRecover(exceptionType, msg string, currentTracer tracer.Tracer)

GeneralEpsagonRecover recover function that will send exception to epsagon exceptionType, msg are strings that will be added to the exception

func Label

func Label(key string, value interface{}, args ...context.Context)

Label adds a label to the sent trace

func MatchUserError

func MatchUserError(exception interface{}) types.GomegaMatcher

MatchUserError matches epsagon exceptions

func NewReadCloser

func NewReadCloser(body []byte, err error) io.ReadCloser

NewReadCloser returns an io.ReadCloser will mimick read from body depending on given error

func ShouldIgnoreRequest

func ShouldIgnoreRequest(contentType string, path string) bool

ShouldIgnoreRequest checks whether HTTP request should be ignored according to given content type and request path

func TypeError

func TypeError(value interface{}, errorType string, args ...context.Context)

TypeError adds an error to the sent trace with specific error type

func WrapLambdaHandler

func WrapLambdaHandler(config *Config, handler interface{}) interface{}

WrapLambdaHandler wraps a generic wrapper for lambda function with epsagon tracing

Types

type APIGatewayEventFields

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

type Config

type Config struct {
	tracer.Config
}

Config is the configuration for Epsagon's tracer

func NewTracerConfig

func NewTracerConfig(applicationName, token string) *Config

NewTracerConfig creates a new tracer Config

type GenericFunction

type GenericFunction func(args ...interface{}) []reflect.Value

GenericFunction type

func ConcurrentGoWrapper

func ConcurrentGoWrapper(config *Config, wrappedFunction interface{}, args ...string) GenericFunction

ConcurrentGoWrapper wraps the function with epsagon's tracer

func GoWrapper

func GoWrapper(config *Config, wrappedFunction interface{}, args ...string) GenericFunction

GoWrapper wraps the function with epsagon's tracer

type GenericWrapper

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

GenericWrapper is a generic lambda function type

func WrapGenericFunction

func WrapGenericFunction(
	handler interface{}, config *Config, tracer tracer.Tracer, injectContext bool, resourceName string) *GenericWrapper

WrapGenericFunction return an epsagon wrapper for a generic function

func (*GenericWrapper) Call

func (wrapper *GenericWrapper) Call(args ...interface{}) (results []reflect.Value)

Call the wrapped function

func (*GenericWrapper) GetRunnerEvent

func (wrapper *GenericWrapper) GetRunnerEvent() *protocol.Event

GetRunnerEvent returns the wrapper runner event

Jump to

Keyboard shortcuts

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