Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a real-time Prometheus gauge to complement existing PDP data-retention counters by estimating overdue proving periods per provider from subgraph deadlines.
Changes:
- Introduces
pdp_provider_overdue_periodsgauge and emits it on every data-retention poll. - Extends PDP subgraph providers query to include overdue
proofSetsfiltered byblockNumber. - Updates validation/types and adds/extends unit tests for the new query fields and gauge behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/checks/events-and-metrics.md | Documents the new pdp_provider_overdue_periods metric. |
| docs/checks/data-retention.md | Describes overdue estimation logic and how the new gauge differs from counters. |
| apps/backend/src/pdp-subgraph/types.ts | Adds blockNumber option and proofSets typing/validation. |
| apps/backend/src/pdp-subgraph/types.spec.ts | Extends validation tests for proofSets. |
| apps/backend/src/pdp-subgraph/queries.ts | Adds blockNumber variable and proofSets selection/filtering. |
| apps/backend/src/pdp-subgraph/pdp-subgraph.service.ts | Threads blockNumber through provider fetch requests and retries. |
| apps/backend/src/pdp-subgraph/pdp-subgraph.service.spec.ts | Updates service tests for the new query variable and response shape. |
| apps/backend/src/metrics-prometheus/metrics-prometheus.module.ts | Registers the new gauge metric provider. |
| apps/backend/src/data-retention/data-retention.service.ts | Computes overdue estimate and emits gauge; adds safe BigInt gauge setter. |
| apps/backend/src/data-retention/data-retention.service.spec.ts | Adds tests for gauge emission, cleanup removal, and large-value handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SgtPooki
reviewed
Mar 27, 2026
Collaborator
SgtPooki
left a comment
There was a problem hiding this comment.
very quick look before vacation, but mostly lgtm.. @juliangruber can you take a peek as well?
juliangruber
requested changes
Mar 31, 2026
juliangruber
approved these changes
Apr 1, 2026
| // naturally resets to 0 when NextProvingPeriod fires and the subgraph catches up. | ||
| this.safeSetGauge(this.overduePeriodsGauge, providerLabels, estimatedOverduePeriods); | ||
| // Note: Safe to cast: 1 period = 240 blocks. Even summing millions of datasets | ||
| // across decades stays well under the JS safe integer limit. |
Member
There was a problem hiding this comment.
would be nice to keep the warning if (for whatever reason, maybe, proving periods change, fast finality, etc) for some reason the value should overflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new Prometheus gauge metric
pdp_provider_overdue_periodsthat tracks estimated unrecorded overdue proving periods per provider in real-time. This gauge complements the existing cumulative counters by providing immediate visibility into providers that are behind on submitting proofs, even before the subgraph confirms the faults.Changes
New Metric
pdp_provider_overdue_periods(Gauge): Estimates overdue proving periods by calculating(currentBlock - (nextDeadline + 1) / maxProvingPeriodfor each proof set where the deadline has passedSubgraph Query Enhancement
GET_PROVIDERS_WITH_DATASETSquery to fetchproofSetswith overdue deadlinesblockNumberparameter to filter proof sets wherenextDeadline < currentBlocknextDeadline, andmaxProvingPeriodper proof setcloses #374