🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: reset gauges in batch retention to prevent stale metrics (#11815)
Valery Meleshkin40f507c5a3cb
diff --git a/worker/src/features/batch-data-retention-cleaner/index.ts b/worker/src/features/batch-data-retention-cleaner/index.tsindex bd2f0678f7..4479bed91e 100644--- a/worker/src/features/batch-data-retention-cleaner/index.ts+++ b/worker/src/features/batch-data-retention-cleaner/index.ts@@ -150,6 +150,15 @@ export class BatchDataRetentionCleaner extends PeriodicExclusiveRunner {protected async execute(): Promise<void> {const timestampColumn = TIMESTAMP_COLUMN_MAP[this.tableName];+ // Reset gauges before attempting lock - ensures they don't appear stuck+ // if another worker holds the lock+ recordGauge(`${METRIC_PREFIX}.pending_projects`, 0, {+ table: this.tableName,+ });+ recordGauge(`${METRIC_PREFIX}.seconds_past_cutoff`, 0, {+ table: this.tableName,+ });+await this.withLock(async () => {// Step 1: Get project workloads (chunked CH counts + PG retention config)diff --git a/worker/src/features/media-retention-cleaner/index.ts b/worker/src/features/media-retention-cleaner/index.tsindex 1b2e98c4c6..4519c22096 100644--- a/worker/src/features/media-retention-cleaner/index.ts+++ b/worker/src/features/media-retention-cleaner/index.ts@@ -64,6 +64,10 @@ export class MediaRetentionCleaner extends PeriodicExclusiveRunner {* Preflight and deletion are both under lock to avoid redundant expensive queries.*/protected async execute(): Promise<void> {+ // Reset gauge before attempting lock - ensures it doesn't appear stuck+ // if another worker holds the lock+ recordGauge(`${METRIC_PREFIX}.seconds_past_cutoff`, 0);+await this.withLock(async () => {// Get the project with most expired media (single project per iteration)