-
Notifications
You must be signed in to change notification settings - Fork 5.5k
RuntimeStatsMetric Reporter for table scans in Iceberg Connector #24904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@j-sund Can you sign the CLA using the link in the comment above? You can just sign as a personal contributor. Also, before your next push try running
|
cfc3890
to
67e5b9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor things. This looks great!
presto-iceberg/src/main/java/com/facebook/presto/iceberg/RuntimeStatsMetricsReporter.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/RuntimeStatsMetricsReporter.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/RuntimeStatsMetricsReporter.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/RuntimeStatsMetricsReporter.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/RuntimeStatsMetricsReporter.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/RuntimeStatsMetricsReporter.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/RuntimeStatsMetricsReporter.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedSmokeTestBase.java
Show resolved
Hide resolved
presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedSmokeTestBase.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java
Show resolved
Hide resolved
72ef7e5
to
6124180
Compare
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java
Outdated
Show resolved
Hide resolved
6124180
to
5b96c26
Compare
… for remaining metrics
5b96c26
to
8b19e78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great feature! Some nits, and a minor problem in the test code.
/** | ||
* Helper method to construct the full metric name for a table scan. | ||
* | ||
* @param tableName the name of the table | ||
* @param metricName the name of the metric | ||
* @return the composed metric name in the format: table.scan.metric | ||
*/ | ||
private String tableScanString(final String tableName, final String metricName) | ||
{ | ||
return tableName + ".scan." + metricName; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: move this private method to the bottom, and it can be declared static.
@@ -96,16 +97,19 @@ public ConnectorSplitSource getSplits( | |||
return new ChangelogSplitSource(session, typeManager, icebergTable, scan); | |||
} | |||
else if (table.getIcebergTableName().getTableType() == EQUALITY_DELETES) { | |||
RuntimeStats runtimeStats = session.getRuntimeStats(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't comment above, so commenting here. Should we also register metrics reporter for CHANGELOG table scan?
@@ -168,14 +168,15 @@ public static TableStatistics getTableStatistics( | |||
Table icebergTable, | |||
List<IcebergColumnHandle> columns) | |||
{ | |||
return new TableStatisticsMaker(icebergTable, session, typeManager).makeTableStatistics(statisticsFileCache, tableHandle, currentPredicate, constraint, columns); | |||
return new TableStatisticsMaker(icebergTable, session, typeManager).makeTableStatistics(statisticsFileCache, tableHandle, currentPredicate, constraint, columns, session); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: newly added parameter session
is useless.
} | ||
|
||
private TableStatistics makeTableStatistics(StatisticsFileCache statisticsFileCache, | ||
IcebergTableHandle tableHandle, | ||
Optional<TupleDomain<IcebergColumnHandle>> currentPredicate, | ||
Constraint constraint, | ||
List<IcebergColumnHandle> selectedColumns) | ||
List<IcebergColumnHandle> selectedColumns, | ||
ConnectorSession session) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: newly added parameter session
is useless.
|
||
assertTrue(runtimestats | ||
.getMetrics() | ||
.get("iceberg.tpch.orders.scan.totalPlanningDuration") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't hardcode iceberg.tpch.orders
as the table name here and below, as it may very across different catalog test subclasses. This seems to be the core reason of failures in TestIcebergSmokeHive
and TestIcebergSmokeRestNestedNameSpace
.
I have submit a PR #25140 to make sure that the table name loaded from all catalogs have consistent formatting
|
Description
Adds a RuntimeStatsMetricsReporter class that exposes iceberg metrics.
Motivation and Context
Exposing these metrics can improve query observability, which thus makes future improvements to the Iceberg integration a little easier. This also enables better performance monitoring.
Impact
Allows for better visibility into the Iceberg integration.
Test Plan
Ensure the metric is visible and being populated. Basic tests are included in IcebergDistributedSmokeTestBase.java class
Contributor checklist
Release Notes