Skip to content

Add lease transaction statistics - #22

Draft
pkaminski wants to merge 3 commits into
masterfrom
codex/add-lease-transaction-stats
Draft

Add lease transaction statistics#22
pkaminski wants to merge 3 commits into
masterfrom
codex/add-lease-transaction-stats

Conversation

@pkaminski

@pkaminski pkaminski commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

  • track acquired and contended task lease transactions, including NodeFire tries and duration metadata
  • expose additive leaseTransactions rollups at physical source, logical queue, and global levels
  • add resetLeaseTransactions() snapshot-and-reset support for interval-based StatsD and Sentry metrics
  • add a per-queue captureLeaseTransactionMetrics(outcome, tries, duration) callback for acquired, contended, and failed transactions
  • expose a worker-local, non-enumerable _lease.firstAcquisition flag on a task's first acquisition
  • isolate metric callback failures from lease processing
  • preserve the lifetime-cumulative tasksAcquired field and bump the package to 4.2.0

Motivation

Running several Firelease instances can amplify Firebase transaction load when they race to acquire the same task. These counters and the callback make that amplification measurable without changing lease behavior, while the reset API lets parent applications publish non-cumulative metrics safely. The first-acquisition flag lets parent workers distinguish newly queued work from retries without persisting instrumentation state.

Validation

  • yarn test (10 tests passed)
  • yarn lint
  • yarn check-types
  • yarn pack --dry-run
  • git diff --check

This change is Reviewable

@pkaminski
pkaminski force-pushed the codex/add-lease-transaction-stats branch from b36b916 to a375ed4 Compare August 5, 2026 23:20
@pkaminski
pkaminski force-pushed the codex/add-lease-transaction-stats branch from a375ed4 to a501e92 Compare August 5, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant