Documentation
¶
Index ¶
- func AddDBSpan(ctx context.Context, operation Operation, entityKind string) *sentry.Span
- func AddInvokerMetadata(c *gin.Context, uid *string)
- func AddSpan(ctx context.Context, operation Operation, name string) *sentry.Span
- func GetHubFromContext(ctx *gin.Context) *sentry.Hub
- func GetTransactionFromContext(ctx context.Context) *sentry.Span
- func New(service string, options Options) gin.HandlerFunc
- func SetSpanData(span *sentry.Span, key string, value interface{})
- func StartTransaction(ctx context.Context, c *gin.Context, service string) *sentry.Span
- type KV
- type Operation
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInvokerMetadata ¶
AddInvokerMetadata tracks user and project information if available
func AddSpan ¶
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 ¶
GetHubFromContext retrieves attached *sentry.Hub instance from gin.Context.
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 ¶
SetSpanData safely sets span data, checking for nil map and duplicate keys
Types ¶
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
}
Click to show internal directories.
Click to hide internal directories.