Skip to content

feat(jobsdb): pending events gauge for the gw jobsdb - #7447

Merged
atzoum merged 3 commits into
masterfrom
feat-gw-pending-events
Oct 13, 2026
Merged

atzoum merged 3 commits into
masterfrom
feat-gw-pending-events

Conversation

@atzoum

@atzoum atzoum commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds jobsdb_gw_pending_events_count, per workspace, source and consumer, so a gw backlog can be attributed to a source, and, once gw is multi-consumer, to the processor or the archiver. gw had no such gauge because its jobs are stored by other processes, which breaks the in-process tracking that rt/batch_rt/proc use.

A new pendingEventsTracker decorates the gw reader handle. It counts the jobs of sealed datasets once and then decrements them in memory as terminal statuses commit, and polls only the last dataset, only when its pg_stat counters changed. A status that commits during a count is subtracted only if the count's postgres snapshot didn't see its transaction. No state is stored in the database, so a restart rebuilds it. It is disabled by default and enabled with JobsDB.gw.pendingEvents.enabled.

📐 Design: Pending events gauge for the gateway jobsdb

Linear Ticket

resolves PIPE-3461

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

🤖 Generated with Claude Code

@atzoum
atzoum force-pushed the feat-gw-pending-events branch 5 times, most recently from 8ed3e38 to 2ac0133 Compare October 1, 2026 12:36
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.19527% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.04%. Comparing base (d05fcbb) to head (3f8d2f0).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
jobsdb/jobsdb_pending_tracker_loop.go 91.35% 14 Missing ⚠️
jobsdb/jobsdb_pending_tracker_decorate.go 95.23% 2 Missing ⚠️
jobsdb/jobsdb_pending_tracker_lifecycle.go 90.00% 2 Missing ⚠️
jobsdb/jobsdb_pending_tracker_query.go 95.34% 2 Missing ⚠️
app/apphandlers/embeddedAppHandler.go 66.66% 1 Missing ⚠️
app/apphandlers/processorAppHandler.go 66.66% 1 Missing ⚠️
app/apphandlers/setup.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7447      +/-   ##
==========================================
- Coverage   85.05%   85.04%   -0.01%     
==========================================
  Files         625      631       +6     
  Lines       62514    62850     +336     
==========================================
+ Hits        53169    53450     +281     
- Misses       9342     9397      +55     
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@atzoum
atzoum force-pushed the feat-gw-pending-events branch 24 times, most recently from e3a1cdd to 0e65551 Compare October 5, 2026 16:31
@atzoum
atzoum force-pushed the feat-gw-pending-events branch 2 times, most recently from 0556744 to 928424b Compare October 6, 2026 06:59
@atzoum
atzoum force-pushed the feat-gw-pending-events branch 2 times, most recently from 1f495e4 to 3619df2 Compare October 12, 2026 08:02

@mihir20 mihir20 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread jobsdb/jobsdb_pending_tracker_loop.go Resolved
atzoum and others added 2 commits October 13, 2026 11:51
Add a pending-events tracker that decorates the gw reader handle and exports
jobsdb_gw_pending_events_count per workspace, source and consumer.

Jobs of sealed datasets are counted once and then decremented in memory as
their terminal statuses commit; the last dataset is polled, and only when its
pg_stat counters changed. A count and the decrements that race with it are
reconciled through the count's Postgres snapshot and the transaction id that
each status write records.

Sealed datasets are counted at most JobsDB.pendingEvents.maxDSPerTransition
(default 3) at a time, in back-to-back transitions, so a startup with many
datasets never needs one count over all of them.

The tracker is disabled by default (JobsDB.gw.pendingEvents.enabled) and
enabled in every integration test. The backend config unavailability test
scrapes the gauge and expects it to equal the events sent while the
transformer cannot run, and zero once they are delivered.

PIPE-3461

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rding them

An exported gauge keeps reporting its last value for the life of the process, so a reset that swapped in a new registry left the series of a key that drained during the recount at its old value. Reset now zeroes the gauges in place: nothing is exported until the recount completes, and the recount brings every exported key to its exact count, zero for the ones that drained. The registry no longer changes, so mu stops protecting it.

PIPE-3461

Co-Authored-By: Claude Opus 5.5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
@atzoum
atzoum force-pushed the feat-gw-pending-events branch from 397c031 to 71bb125 Compare October 13, 2026 09:00
Comment thread jobsdb/jobsdb_pending_tracker_loop.go Resolved
…he sealed boundary

A compaction between two transitions of a catch-up can leave the sealed boundary below the tracker's boundary. With liveFingerprint still nil, the next transition was never the live one, so the loop repeated empty transitions until a new dataset was sealed. A transition that reaches or passes the sealed boundary now counts the live dataset.

PIPE-3461

Co-Authored-By: Claude Opus 5.5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
@atzoum
atzoum enabled auto-merge (squash) October 13, 2026 16:07
@atzoum
atzoum merged commit fc539c4 into master Oct 13, 2026
72 checks passed
@atzoum
atzoum deleted the feat-gw-pending-events branch October 13, 2026 16:27
This was referenced Oct 19, 2026
mihir20 pushed a commit that referenced this pull request Oct 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.91.0-rc.1](v1.90.0...v1.91.0-rc.1)
(2026-10-19)


### Features

* **jobsdb:** pending events gauge for the gw jobsdb
([#7447](#7447))
([fc539c4](fc539c4))
* **processor:** report event_filter drops per reason and stop its
succeeded rows
([#7454](#7454))
([5caff53](5caff53))


### Bug Fixes

* **processor:** exclude dropped jobs from tracked users and activation
records
([#7485](#7485))
([526602c](526602c))
* **router:** report destination status for v1 proxy deliveries in
transformer_outgoing_request_count
([#7482](#7482))
([bba1c21](bba1c21))


### Miscellaneous

* bump sqlconnect-go to v1.34.0
([#7479](#7479))
([71e8cfa](71e8cfa))
* stop setting in_reported_by on report rows
([#7458](#7458))
([814d149](814d149))
* sync release v1.90.0 to main branch
([#7475](#7475))
([d05fcbb](d05fcbb))
* **tooling:** move rudder-server test MinIO to Silo
([#7469](#7469))
([935bf59](935bf59))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
itsmihir pushed a commit that referenced this pull request Oct 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.91.0-rc.2](v1.90.0...v1.91.0-rc.2)
(2026-10-20)


### Features

* **jobsdb:** pending events gauge for the gw jobsdb
([#7447](#7447))
([fc539c4](fc539c4))
* **processor:** report event_filter drops per reason and stop its
succeeded rows
([#7454](#7454))
([5caff53](5caff53))


### Bug Fixes

* **destination:** authenticate marketo bulk uploads with bearer token
([#7510](#7510))
([3eaffad](3eaffad))
* **processor:** exclude dropped jobs from tracked users and activation
records
([#7485](#7485))
([526602c](526602c))
* **router:** enable live events payload masking by default
([#7500](#7500))
([8b5c22d](8b5c22d))
* **router:** mask multi-request delivery payloads
([#7476](#7476))
([f65572e](f65572e))
* **router:** mask reporting sample event secrets
([#7497](#7497))
([833d694](833d694))
* **router:** report destination status for v1 proxy deliveries in
transformer_outgoing_request_count
([#7482](#7482))
([bba1c21](bba1c21))


### Miscellaneous

* bump sqlconnect-go to v1.34.0
([#7479](#7479))
([71e8cfa](71e8cfa))
* stop setting in_reported_by on report rows
([#7458](#7458))
([814d149](814d149))
* sync release v1.90.0 to main branch
([#7475](#7475))
([d05fcbb](d05fcbb))
* **tooling:** move rudder-server test MinIO to Silo
([#7469](#7469))
([935bf59](935bf59))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
itsmihir pushed a commit that referenced this pull request Oct 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.91.0](v1.90.0...v1.91.0)
(2026-10-20)


### Features

* **jobsdb:** pending events gauge for the gw jobsdb
([#7447](#7447))
([fc539c4](fc539c4))
* **processor:** report event_filter drops per reason and stop its
succeeded rows
([#7454](#7454))
([5caff53](5caff53))


### Bug Fixes

* **destination:** authenticate marketo bulk uploads with bearer token
([#7510](#7510))
([3eaffad](3eaffad))
* **processor:** exclude dropped jobs from tracked users and activation
records
([#7485](#7485))
([526602c](526602c))
* **router:** enable live events payload masking by default
([#7500](#7500))
([8b5c22d](8b5c22d))
* **router:** mask multi-request delivery payloads
([#7476](#7476))
([f65572e](f65572e))
* **router:** mask reporting sample event secrets
([#7497](#7497))
([833d694](833d694))
* **router:** report destination status for v1 proxy deliveries in
transformer_outgoing_request_count
([#7482](#7482))
([bba1c21](bba1c21))


### Miscellaneous

* bump sqlconnect-go to v1.34.0
([#7479](#7479))
([71e8cfa](71e8cfa))
* stop setting in_reported_by on report rows
([#7458](#7458))
([814d149](814d149))
* sync release v1.90.0 to main branch
([#7475](#7475))
([d05fcbb](d05fcbb))
* **tooling:** move rudder-server test MinIO to Silo
([#7469](#7469))
([935bf59](935bf59))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.

3 participants