mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
setry transaction
This commit is contained in:
parent
4ae233f9a3
commit
e100f50def
1 changed files with 22 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/a-h/templ"
|
"github.com/a-h/templ"
|
||||||
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/labstack/gommon/log"
|
"github.com/labstack/gommon/log"
|
||||||
u "github.com/rjNemo/underscore"
|
u "github.com/rjNemo/underscore"
|
||||||
|
|
@ -20,6 +21,27 @@ import (
|
||||||
|
|
||||||
func handleListBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFunc {
|
func handleListBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
|
ctx := c.Request().Context()
|
||||||
|
hub := sentry.GetHubFromContext(ctx)
|
||||||
|
if hub == nil {
|
||||||
|
// Check the concurrency guide for more details: https://docs.sentry.io/platforms/go/concurrency/
|
||||||
|
hub = sentry.CurrentHub().Clone()
|
||||||
|
ctx = sentry.SetHubOnContext(ctx, hub)
|
||||||
|
}
|
||||||
|
|
||||||
|
options := []sentry.SpanOption{
|
||||||
|
// Set the OP based on values from https://develop.sentry.dev/sdk/performance/span-operations/
|
||||||
|
sentry.WithOpName("http.server"),
|
||||||
|
sentry.ContinueFromRequest(c.Request()),
|
||||||
|
sentry.WithTransactionSource(sentry.SourceURL),
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction := sentry.StartTransaction(ctx,
|
||||||
|
fmt.Sprintf("%s %s", c.Request().Method, c.Request().URL.Path),
|
||||||
|
options...,
|
||||||
|
)
|
||||||
|
defer transaction.Finish()
|
||||||
|
|
||||||
bookings := bs.All()
|
bookings := bs.All()
|
||||||
|
|
||||||
bvm := u.Map(bookings, func(b *booking.Line) *view.ListBookingsViewModel {
|
bvm := u.Map(bookings, func(b *booking.Line) *view.ListBookingsViewModel {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue