From d57da7298b845db58ca00de0c5cff02f6e174baa Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Mon, 18 Dec 2023 21:18:35 +0100 Subject: [PATCH] Only apply `SampleRate ` to errors/messages --- client.go | 6 +++--- interfaces.go | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/client.go b/client.go index 0e14658af..ee492407f 100644 --- a/client.go +++ b/client.go @@ -605,9 +605,9 @@ func (client *Client) processEvent(event *Event, hint *EventHint, scope EventMod } // Transactions are sampled by options.TracesSampleRate or - // options.TracesSampler when they are started. All other events - // (errors, messages) are sampled here. - if event.Type != transactionType && !sample(client.options.SampleRate) { + // options.TracesSampler when they are started. Other events + // (errors, messages) are sampled here. Does not apply to check-ins. + if event.Type == eventType && !sample(client.options.SampleRate) { Logger.Println("Event dropped due to SampleRate hit.") return nil } diff --git a/interfaces.go b/interfaces.go index 497792887..13517f647 100644 --- a/interfaces.go +++ b/interfaces.go @@ -11,15 +11,14 @@ import ( "time" ) -// Protocol Docs (kinda) -// https://github.com/getsentry/rust-sentry-types/blob/master/src/protocol/v7.rs +// eventType is the type of an error event. +const eventType = "event" // transactionType is the type of a transaction event. const transactionType = "transaction" -// eventType is the type of an error event. -const eventType = "event" - +// profileType is the type of a profile event. +// currently, profiles are always sent as part of a transaction event. const profileType = "profile" // checkInType is the type of a check in event.