obelix74 opened a new pull request, #4756:
URL: https://github.com/apache/polaris/pull/4756
## Summary
> **Stacked on #4115** — depends on `implement_metrics_rest_api`. The
meaningful diff is the Scope 2 extension; once #4115 merges GitHub will show
only those changes.
This PR adds `polaris-extensions-metrics-reports-jdbc`, an optional CDI
extension module that provides durable JDBC storage for Iceberg scan/commit
metrics reports.
- Implements `MetricsPersistence` SPI in `JdbcMetricsPersistence`
(`@ApplicationScoped`) using the existing `DatasourceOperations` pool and the
`SCAN_METRICS_REPORT`/`COMMIT_METRICS_REPORT` tables (schema-v4)
- Adds `PersistingMetricsReporter` (`@RequestScoped`,
`@Identifier("persisting")`): converts Iceberg `ScanReport`/`CommitReport` to
SPI records and delegates to `MetricsPersistence`
- Wires the read path in `MetricsReportsService` via
`Instance<MetricsPersistence>`: when the extension is on the classpath, list
endpoints return real results with keyset pagination; absent → empty lists
(graceful degradation)
- Registers `MetricsReportToken$MetricsReportTokenType` via
`META-INF/services` in the extension module only, preventing
`ServiceConfigurationError` when running without the extension
## Key design decisions
- **Optional wiring via `Instance<MetricsPersistence>`** — no compile
dependency from the base module on the JDBC extension
- **Keyset pagination** — `MetricsReportToken` encodes `(timestamp_ms DESC,
report_id DESC)` for stable ordering without offset drift
- **Service file in extension module only** — avoids
`ServiceConfigurationError` when the extension is absent from the classpath
## Test plan
- [ ] `./gradlew
:extensions:metrics-reports:persistence:relational-jdbc:build` — new module
compiles and tests pass
- [ ] `./gradlew :extensions:metrics-reports:impl:test` —
`MetricsReportsServiceTest` passes
- [ ] `./gradlew :persistence:relational-jdbc:build` — base module unaffected
- [ ] Integration: send a scan/commit metrics report; verify it appears in
list responses with correct pagination token
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]