trace

package
v0.0.0-...-f9aa2b8 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDBSpan

func AddDBSpan(ctx context.Context, operation Operation, entityKind string) *sentry.Span

func AddInvokerMetadata

func AddInvokerMetadata(c *gin.Context, uid *string)

AddInvokerMetadata tracks user and project information if available

func AddSpan

func AddSpan(ctx context.Context, operation Operation, name string) *sentry.Span

AddSpan will add a span to an existing transaction. Must be called after StartTransaction. Example operation values: db.query, db.update, db.get, db.put, cache.get, cache.put, auth.verify

func GetHubFromContext

func GetHubFromContext(ctx *gin.Context) *sentry.Hub

GetHubFromContext retrieves attached *sentry.Hub instance from gin.Context.

func GetTransactionFromContext

func GetTransactionFromContext(ctx context.Context) *sentry.Span

func New

func New(service string, options Options) gin.HandlerFunc

New returns a function that satisfies gin.HandlerFunc interface It can be used with Use() methods.

func SetSpanData

func SetSpanData(span *sentry.Span, key string, value interface{})

SetSpanData safely sets span data, checking for nil map and duplicate keys

func StartTransaction

func StartTransaction(ctx context.Context, c *gin.Context, service string) *sentry.Span

StartTransaction

Types

type KV

type KV struct {
	Key   string
	Value interface{}
}

type Operation

type Operation string
const (
	ServiceOp       Operation = "http.service"   // Measure the entire incoming http request (sentry transaction)
	IntraServiceOp  Operation = "http.intra"     // Measure an intra-service http request
	DBCreateOp      Operation = "db.create"      // Measure a DB write
	DBGetOp         Operation = "db.get"         // Measure a DB read
	DBQueryOp       Operation = "db.query"       // Measure a DB query
	DBTransactionOp Operation = "db.transaction" // Meaure a DB transaction
	CacheSet        Operation = "cache.set"      // Measure cache set
	CacheGet        Operation = "cache.get"      // Measure cache get
	CacheDel        Operation = "cache.del"      // Measure cache delete
)

type Options

type Options struct {
	// Repanic configures whether Sentry should repanic after recovery, in most cases it should be set to true,
	// as gin.Default includes it's own Recovery middleware what handles http responses.
	Repanic bool
	// WaitForDelivery configures whether you want to block the request before moving forward with the response.
	// Because Gin's default Recovery handler doesn't restart the application,
	// it's safe to either skip this option or set it to false.
	WaitForDelivery bool
	// Timeout for the event delivery requests.
	Timeout time.Duration
}

Jump to

Keyboard shortcuts

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