Skip to content

Commit

Permalink
Only apply SampleRate to errors/messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric committed Dec 18, 2023
1 parent fff66d1 commit d57da72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 4 additions & 5 deletions interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d57da72

Please sign in to comment.