obelix74 commented on code in PR #4115:
URL: https://github.com/apache/polaris/pull/4115#discussion_r3423253194
##########
runtime/service/src/main/java/org/apache/polaris/service/config/ServiceProducers.java:
##########
@@ -457,9 +457,16 @@ public RequestIdSupplier requestIdSupplier() {
@Produces
@ApplicationScoped
- public PolarisMetricsReporter metricsReporter(
- MetricsReportingConfiguration config, @Any
Instance<PolarisMetricsReporter> reporters) {
- return reporters.select(Identifier.Literal.of(config.type())).get();
+ public IcebergMetricsReporter metricsReporter(
+ MetricsReportingConfiguration config, @Any
Instance<IcebergMetricsReporter> reporters) {
+ var selected = reporters.select(Identifier.Literal.of(config.type()));
+ if (selected.isUnsatisfied()) {
+ LOGGER.warn(
+ "No IcebergMetricsReporter found for type '{}'; Iceberg metrics will
be dropped",
+ config.type());
+ return (catalogName, catalogId, table, tableId, metricsReport,
receivedTimestamp) -> {};
Review Comment:
Done — moved `NoOpMetricsReporter` to the SPI module
(`extensions/metrics-reports/spi`) with `@Identifier("no-op")`. The SPI module
now also has Jandex and the CDI/SmallRye annotation deps so Quarkus discovers
the bean automatically.
Changed the code default in `MetricsReportingConfiguration` from `"default"`
to `"no-op"`, so the lookup always resolves to the SPI bean when nothing else
is configured. Production deployments still use `type=default` (→
`LoggingMetricsReporter`) via `application.properties`.
Added `polaris.iceberg-metrics.reporting.type=no-op` to
`application-test.properties` and `application-it.properties` so unit and
integration tests in `runtime/service` (which don't have the impl on the
classpath) consistently use the SPI no-op. `ServiceProducers.metricsReporter()`
is back to a simple `.get()`.
##########
extensions/metrics-reports/impl/build.gradle.kts:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+ id("polaris-server")
+ id("org.kordamp.gradle.jandex")
+}
+
+dependencies {
+ implementation(project(":polaris-core"))
+ implementation(project(":polaris-api-metrics-reports-service"))
+ implementation(project(":polaris-extensions-metrics-reports-spi"))
+
+ implementation(platform(libs.iceberg.bom))
+ implementation("org.apache.iceberg:iceberg-api")
+
+ implementation(libs.jakarta.enterprise.cdi.api)
+ implementation(libs.jakarta.inject.api)
+ implementation(libs.jakarta.ws.rs.api)
+ implementation(libs.smallrye.common.annotation)
+ implementation(libs.slf4j.api)
+ compileOnly(libs.jakarta.annotation.api)
+
+ implementation(platform(libs.jackson.bom))
+ implementation("com.fasterxml.jackson.core:jackson-annotations")
+
+ testImplementation(platform(libs.junit.bom))
+ testImplementation("org.junit.jupiter:junit-jupiter")
+ testImplementation(libs.assertj.core)
+ testImplementation(libs.mockito.core)
+ testImplementation(libs.jakarta.ws.rs.api)
Review Comment:
Removed.
##########
extensions/metrics-reports/spi/src/main/java/org/apache/polaris/core/metrics/IcebergMetricsReporter.java:
##########
@@ -16,38 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.polaris.service.reporting;
+package org.apache.polaris.core.metrics;
Review Comment:
The `org.apache.polaris.core.metrics` package was kept intentionally to
avoid touching 7 import sites across the codebase. Happy to rename it in a
follow-up PR once this lands — it's purely mechanical and easier to review in
isolation.
--
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]