Skip to content

Commit

Permalink
chore: reduce messages to sentry (#21972)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Apr 30, 2024
1 parent 7c0c6ca commit 36de77b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export class SessionRecordingIngester {
})
await runInstrumentedFunction({
statsKey: `recordingingester.handleEachBatch`,
logExecutionTime: true,
sendTimeoutGuardToSentry: false,
func: async () => {
histogramKafkaBatchSize.observe(messages.length)
histogramKafkaBatchSizeKb.observe(messages.reduce((acc, m) => (m.value?.length ?? 0) + acc, 0) / 1024)
Expand Down Expand Up @@ -646,7 +646,6 @@ export class SessionRecordingIngester {
const startTime = Date.now()
await runInstrumentedFunction({
statsKey: `recordingingester.onRevokePartitions.revokeSessions`,
logExecutionTime: true,
timeout: SHUTDOWN_FLUSH_TIMEOUT_MS, // same as the partition lock
func: async () => {
if (this.config.SESSION_RECORDING_PARTITION_REVOKE_OPTIMIZATION) {
Expand Down
9 changes: 8 additions & 1 deletion plugin-server/src/main/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface FunctionInstrumentation<T> {
timeoutContext?: () => Record<string, any>
teamId?: number
logExecutionTime?: boolean
sendTimeoutGuardToSentry?: boolean
}

const logTime = (startTime: number, statsKey: string, error?: any) => {
Expand All @@ -30,8 +31,14 @@ export async function runInstrumentedFunction<T>({
statsKey,
teamId,
logExecutionTime = false,
sendTimeoutGuardToSentry = true,
}: FunctionInstrumentation<T>): Promise<T> {
const t = timeoutGuard(timeoutMessage ?? `Timeout warning for '${statsKey}'!`, timeoutContext, timeout)
const t = timeoutGuard(
timeoutMessage ?? `Timeout warning for '${statsKey}'!`,
timeoutContext,
timeout,
sendTimeoutGuardToSentry
)
const startTime = performance.now()
const end = instrumentedFunctionDuration.startTimer({
function: statsKey,
Expand Down

0 comments on commit 36de77b

Please sign in to comment.