okumin commented on code in PR #6461: URL: https://github.com/apache/hive/pull/6461#discussion_r3180537912
########## standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/metrics/IcebergMetricsReporter.java: ########## @@ -0,0 +1,39 @@ +/* + * 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. + */ + +package org.apache.iceberg.rest.metrics; + +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.metrics.MetricsReport; + +import java.time.Instant; + +/** + * An event reporter for Iceberg metrics. + */ +public interface IcebergMetricsReporter { + /** + * Report an event. + * + * @param catalog the catalog name + * @param identifier the table identifier + * @param report the event + * @param receivedAt the timestamp when the Iceberg REST Catalog received the event + */ + void report(String catalog, TableIdentifier identifier, MetricsReport report, Instant receivedAt); Review Comment: FYI: Polaris and Gravitino's SPI - https://github.com/apache/polaris/blob/apache-polaris-1.4.1/runtime/service/src/main/java/org/apache/polaris/service/reporting/PolarisMetricsReporter.java - https://github.com/apache/gravitino/blob/v1.2.0/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/metrics/IcebergMetricsStore.java#L38-L47 ########## standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/HMSCatalogServlet.java: ########## @@ -147,8 +147,15 @@ static ServletRequestContext from(HttpServletRequest request) throws IOException Route route = routeContext.first(); Object requestBody = null; if (route.requestClass() != null) { - requestBody = - RESTObjectMapper.mapper().readValue(request.getReader(), route.requestClass()); + try { + requestBody = RESTObjectMapper.mapper().readValue(request.getReader(), route.requestClass()); + } catch (Exception e) { + return new ServletRequestContext(ErrorResponse.builder() + .responseCode(400) + .withType(e.getClass().getSimpleName()) + .withMessage(e.getMessage()) + .build()); Review Comment: I happened to find an invalid body throws a 500 error ########## standalone-metastore/metastore-rest-catalog/src/test/java/org/apache/iceberg/rest/extension/RESTCatalogServer.java: ########## @@ -60,6 +61,9 @@ public void start(Configuration conf) throws Exception { String uniqueTestKey = String.format("RESTCatalogServer_%s", UUID.randomUUID()); warehouseDir = Path.of(MetaStoreTestUtils.getTestWarehouseDir(uniqueTestKey)); + Files.createDirectories(warehouseDir); + System.setProperty("derby.stream.error.file", + warehouseDir.resolve("derby.log").toAbsolutePath().toString()); Review Comment: This log was generated in `standalone-metastore/metastore-rest-catalog/derby.log` originally, which is not git-ignored. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
