Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

package org.apache.iceberg.rest;

import com.codahale.metrics.Counter;
import com.google.common.base.Preconditions;
import org.apache.hadoop.hive.metastore.metrics.Metrics;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -80,8 +78,6 @@
* Adaptor class to translate REST requests into {@link Catalog} API calls.
*/
public class HMSCatalogAdapter implements RESTClient {
/** The metric names prefix. */
static final String HMS_METRIC_PREFIX = "hmscatalog.";
private static final Splitter SLASH = Splitter.on('/');

private static final Map<Class<? extends Exception>, Integer> EXCEPTION_ERROR_CODES =
Expand Down Expand Up @@ -214,14 +210,6 @@ public Class<? extends RESTRequest> requestClass() {
}
}

/**
* @param route a route/api-call name
* @return the metric counter name for the api-call
*/
static String hmsCatalogMetricCount(String route) {
return HMS_METRIC_PREFIX + route.toLowerCase() + ".count";
}

private ConfigResponse config() {
final List<Endpoint> endpoints = Arrays.stream(Route.values())
.map(r -> Endpoint.create(r.method.name(), r.resourcePath)).toList();
Expand Down Expand Up @@ -421,12 +409,6 @@ private static void commitTransaction(Catalog catalog, CommitTransactionRequest
@SuppressWarnings({"MethodLength", "unchecked"})
private <T extends RESTResponse> T handleRequest(
Route route, Map<String, String> vars, Object body) {
// update HMS catalog route counter metric
final String metricName = hmsCatalogMetricCount(route.name());
Counter counter = Metrics.getOrCreateCounter(metricName);
if (counter != null) {
counter.inc();
}
switch (route) {
case CONFIG:
return (T) config();
Expand Down