nastra commented on code in PR #7339:
URL: https://github.com/apache/iceberg/pull/7339#discussion_r1175082100
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -347,35 +346,26 @@ public Table loadTable(SessionContext context,
TableIdentifier identifier) {
tableFileIO(context, response.config()),
tableMetadata);
- TableIdentifier tableIdentifier = loadedIdent;
BaseTable table =
new BaseTable(
ops,
fullTableName(loadedIdent),
- report -> reportMetrics(tableIdentifier, report,
session::headers));
+ metricsReporter(paths.metrics(loadedIdent), session::headers));
if (metadataType != null) {
return MetadataTableUtils.createMetadataTableInstance(table,
metadataType);
}
return table;
}
- private void reportMetrics(
- TableIdentifier tableIdentifier,
- MetricsReport report,
- Supplier<Map<String, String>> headers) {
- try {
- reporter.report(report);
- 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);
+ private MetricsReporter metricsReporter(
Review Comment:
rather than wrapping the combined reporter in a lambda for the purpose of
reporting, we just return the combined reporter here.
--
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]