Skip to content

Commit

Permalink
hotfix: lower trace sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
aldy505 committed Jan 14, 2024
1 parent 46b9a72 commit ec057c3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion controllers/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion controllers/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
33 changes: 19 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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,
})
Expand Down

0 comments on commit ec057c3

Please sign in to comment.