obelix74 commented on code in PR #3385:
URL: https://github.com/apache/polaris/pull/3385#discussion_r2820117244
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/RelationalJdbcProductionReadinessChecks.java:
##########
@@ -55,4 +58,49 @@ public ProductionReadinessCheck checkRelationalJdbc(
}
return ProductionReadinessCheck.OK;
}
+
+ /**
+ * Checks if metrics persistence is properly configured for the
relational-jdbc backend.
+ *
+ * <p>When the metrics persistence type is set to 'relational-jdbc', this
check verifies that:
+ *
+ * <ol>
+ * <li>The MetricsPersistence implementation is actually
JdbcMetricsPersistence
+ * <li>The metrics tables have been bootstrapped in the database
+ * </ol>
+ *
+ * <p>This ensures that the system is properly configured before attempting
to persist metrics.
+ */
+ @Produces
+ public ProductionReadinessCheck checkMetricsPersistenceBootstrapped(
+ @Any Instance<MetricsPersistence> metricsPersistenceImpls,
+ Instance<DataSource> dataSource,
+ RelationalJdbcConfiguration relationalJdbcConfiguration) {
+
+ // Check if relational-jdbc metrics persistence implementation is available
+ Instance<MetricsPersistence> jdbcMetricsInstance =
+
metricsPersistenceImpls.select(Identifier.Literal.of("relational-jdbc"));
Review Comment:
Simplified the check to inject the pre-resolved MetricsPersistence and check
instanceof JdbcMetricsPersistence, following the same pattern as
`checkRelationalJdbc()`. This avoids forcing CDI to resolve relational-jdbc
when a different metrics persistence type is configured.
--
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]