Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add two new metrics for blobby commits #19818

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class SessionManager {
throw error
}

// NOTE: This is uncompressed size estimate but thats okay as we currently want to over-flush to see if we can shake out a bug
// NOTE: This is uncompressed size estimate but that's okay as we currently want to over-flush to see if we can shake out a bug
if (this.buffer.sizeEstimate >= this.serverConfig.SESSION_RECORDING_MAX_BUFFER_SIZE_KB * 1024) {
await this.flush('buffer_size')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ const counterKafkaMessageReceived = new Counter({
labelNames: ['partition'],
})

const counterCommitSkippedDueToPotentiallyBlockingSession = new Counter({
name: 'recording_blob_ingestion_commit_skipped_due_to_potentially_blocking_session',
help: 'The number of times we skipped committing due to a potentially blocking session',
})

const histogramActiveSessionsWhenCommitIsBlocked = new Histogram({
name: 'recording_blob_ingestion_active_sessions_when_commit_is_blocked',
help: 'The number of active sessions on a partition when we skip committing due to a potentially blocking session',
buckets: [0, 1, 2, 3, 4, 5, 10, 20, 50, 100, 1000, 10000, Infinity],
})

type PartitionMetrics = {
lastMessageTimestamp?: number
lastMessageOffset?: number
Expand Down Expand Up @@ -648,9 +659,11 @@ export class SessionRecordingIngester {

let potentiallyBlockingSession: SessionManager | undefined

let activeSessionsOnThisPartition = 0
for (const sessionManager of blockingSessions) {
if (sessionManager.partition === partition) {
const lowestOffset = sessionManager.getLowestOffset()
activeSessionsOnThisPartition++
if (
lowestOffset !== null &&
lowestOffset < (potentiallyBlockingSession?.getLowestOffset() || Infinity)
Expand Down Expand Up @@ -684,6 +697,8 @@ export class SessionRecordingIngester {
highestOffsetToCommit,
}
)
counterCommitSkippedDueToPotentiallyBlockingSession.inc()
histogramActiveSessionsWhenCommitIsBlocked.observe(activeSessionsOnThisPartition)
return
}

Expand Down
Loading