Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHubFromContext ¶
func GetHubFromContext(ctx iris.Context) *sentry.Hub
GetHubFromContext retrieves attached *sentry.Hub instance from iris.Context.
func GetSpanFromContext ¶ added in v0.28.0
func GetSpanFromContext(ctx iris.Context) *sentry.Span
GetSpanFromContext retrieves attached *sentry.Span instance from iris.Context. If there is no transaction on iris.Context, it will return nil.
Example ¶
app := iris.New() app.Use(sentryiris.New(sentryiris.Options{})) app.Get("/", func(ctx iris.Context) { expensiveThing := func(ctx context.Context) { span := sentry.StartSpan(ctx, "expensive_thing") defer span.Finish() // do resource intensive thing } // Acquire transaction on current hub that's created by the SDK. // Be careful, it might be a nil value if you didn't set up sentryiris middleware. sentrySpan := sentryiris.GetSpanFromContext(ctx) // Pass in the `.Context()` method from `*sentry.Span` struct. // The `context.Context` instance inherits the context from `iris.Context`. expensiveThing(sentrySpan.Context()) ctx.StatusCode(http.StatusOK) })
Output:
Types ¶
type Options ¶
type Options struct { // Repanic configures whether Sentry should repanic after recovery, in most cases it should be set to true, // as iris.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 Iris'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.