diff --git a/controllers/add.go b/controllers/add.go index 9a75157..c16c066 100644 --- a/controllers/add.go +++ b/controllers/add.go @@ -14,7 +14,7 @@ import ( // If the submitted paste is a duplicate, it will quickly return // a generated ID based on the SHA224 hash. func (d *Dependency) AddPaste(c *fiber.Ctx) error { - ctx, span := tracer.Start(c.Context(), "Get") + ctx, span := tracer.Start(c.Context(), "AddPaste") defer span.End() body := c.Body() diff --git a/controllers/error.go b/controllers/error.go index 17bb3d4..44b064c 100644 --- a/controllers/error.go +++ b/controllers/error.go @@ -6,9 +6,10 @@ import ( "os" "time" - "github.com/gofiber/contrib/fibersentry" "polarite/platform/logtail" + "github.com/gofiber/contrib/fibersentry" + "github.com/gofiber/fiber/v2" ) diff --git a/main.go b/main.go index 5448b23..19424df 100644 --- a/main.go +++ b/main.go @@ -10,24 +10,24 @@ import ( "strings" "time" - "polarite/controllers" - "polarite/repository" - + "github.com/dgraph-io/badger/v3" + "github.com/getsentry/sentry-go" + sentryotel "github.com/getsentry/sentry-go/otel" "github.com/gofiber/contrib/fibersentry" + "github.com/gofiber/contrib/otelfiber/v2" "github.com/gofiber/fiber/v2" - - "github.com/dgraph-io/badger/v3" + "github.com/gofiber/template/html/v2" "go.opentelemetry.io/otel" + + "polarite/controllers" + "polarite/repository" + sdktrace "go.opentelemetry.io/otel/sdk/trace" - "github.com/getsentry/sentry-go" - "github.com/getsentry/sentry-go/otel" - "github.com/gofiber/contrib/otelfiber/v2" "github.com/gofiber/fiber/v2/middleware/cache" "github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/filesystem" "github.com/gofiber/fiber/v2/middleware/limiter" - "github.com/gofiber/template/html/v2" ) func main() { @@ -69,11 +69,16 @@ func main() { // Setup Sentry err = sentry.Init(sentry.ClientOptions{ - Dsn: sentryDSN, - Debug: environment != "production", - SampleRate: 1.0, - EnableTracing: true, - TracesSampleRate: 0.2, + Dsn: sentryDSN, + Debug: environment != "production", + SampleRate: 1.0, + EnableTracing: true, + TracesSampler: func(ctx sentry.SamplingContext) float64 { + if ctx.Span.Name == "GET /" || ctx.Span.Name == "GET /robots.txt" || ctx.Span.Name == "GET /favicon.ico" { + return 0 + } + return 0.2 + }, ProfilesSampleRate: 0.01, Environment: environment, })