You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2022/12/19 16:34:10 UTC
[iceberg] branch master updated: Core: Add flag to control sending metric reports via REST (#6436)
This is an automated email from the ASF dual-hosted git repository.
blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new 67b5ca239e Core: Add flag to control sending metric reports via REST (#6436)
67b5ca239e is described below
commit 67b5ca239ead5549122a5b10e8a372cd1c8dca81
Author: Eduard Tudenhöfner <et...@gmail.com>
AuthorDate: Mon Dec 19 17:34:05 2022 +0100
Core: Add flag to control sending metric reports via REST (#6436)
---
.../org/apache/iceberg/rest/RESTSessionCatalog.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
index d52dd372c9..8dd9aee953 100644
--- a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
+++ b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
@@ -88,6 +88,7 @@ import org.slf4j.LoggerFactory;
public class RESTSessionCatalog extends BaseSessionCatalog
implements Configurable<Configuration>, Closeable {
private static final Logger LOG = LoggerFactory.getLogger(RESTSessionCatalog.class);
+ private static final String REST_METRICS_REPORTING_ENABLED = "rest-metrics-reporting-enabled";
private static final long MAX_REFRESH_WINDOW_MILLIS = 300_000; // 5 minutes
private static final long MIN_REFRESH_WAIT_MILLIS = 10;
private static final List<String> TOKEN_PREFERENCE_ORDER =
@@ -107,6 +108,7 @@ public class RESTSessionCatalog extends BaseSessionCatalog
private Object conf = null;
private FileIO io = null;
private MetricsReporter reporter = null;
+ private boolean reportingViaRestEnabled;
// a lazy thread pool for token refresh
private volatile ScheduledExecutorService refreshExecutor = null;
@@ -183,6 +185,8 @@ public class RESTSessionCatalog extends BaseSessionCatalog
? CatalogUtil.loadMetricsReporter(metricsReporterImpl)
: LoggingMetricsReporter.instance();
+ this.reportingViaRestEnabled =
+ PropertyUtil.propertyAsBoolean(mergedProps, REST_METRICS_REPORTING_ENABLED, true);
super.initialize(name, mergedProps);
}
@@ -322,12 +326,14 @@ public class RESTSessionCatalog extends BaseSessionCatalog
Supplier<Map<String, String>> headers) {
try {
reporter.report(report);
- client.post(
- paths.metrics(tableIdentifier),
- ReportMetricsRequest.of(report),
- null,
- headers,
- ErrorHandlers.defaultErrorHandler());
+ if (reportingViaRestEnabled) {
+ client.post(
+ paths.metrics(tableIdentifier),
+ ReportMetricsRequest.of(report),
+ null,
+ headers,
+ ErrorHandlers.defaultErrorHandler());
+ }
} catch (Exception e) {
LOG.warn("Failed to report metrics to REST endpoint for table {}", tableIdentifier, e);
}