Skip to content

Commit 012521c

Browse files
committed
Bind filesystem cache metrics per catalog
1 parent e1574bc commit 012521c

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

lib/trino-filesystem-cache-alluxio/pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
<artifactId>trino-filesystem</artifactId>
6464
</dependency>
6565

66+
<dependency>
67+
<groupId>io.trino</groupId>
68+
<artifactId>trino-spi</artifactId>
69+
</dependency>
70+
6671
<dependency>
6772
<groupId>jakarta.annotation</groupId>
6873
<artifactId>jakarta.annotation-api</artifactId>
@@ -112,12 +117,6 @@
112117
<scope>runtime</scope>
113118
</dependency>
114119

115-
<dependency>
116-
<groupId>io.trino</groupId>
117-
<artifactId>trino-spi</artifactId>
118-
<scope>runtime</scope>
119-
</dependency>
120-
121120
<dependency>
122121
<groupId>io.airlift</groupId>
123122
<artifactId>junit-extensions</artifactId>

lib/trino-filesystem-cache-alluxio/src/main/java/io/trino/filesystem/alluxio/AlluxioFileSystemCacheModule.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
import alluxio.metrics.MetricsConfig;
1717
import alluxio.metrics.MetricsSystem;
1818
import com.google.inject.Binder;
19+
import com.google.inject.Provider;
1920
import io.airlift.configuration.AbstractConfigurationAwareModule;
2021
import io.trino.filesystem.cache.CachingHostAddressProvider;
2122
import io.trino.filesystem.cache.ConsistentHashingHostAddressProvider;
2223
import io.trino.filesystem.cache.ConsistentHashingHostAddressProviderConfig;
2324
import io.trino.filesystem.cache.TrinoFileSystemCache;
25+
import io.trino.spi.catalog.CatalogName;
2426

2527
import java.util.Properties;
2628

@@ -45,7 +47,9 @@ protected void setup(Binder binder)
4547
configBinder(binder).bindConfig(AlluxioFileSystemCacheConfig.class);
4648
configBinder(binder).bindConfig(ConsistentHashingHostAddressProviderConfig.class);
4749
binder.bind(AlluxioCacheStats.class).in(SINGLETON);
48-
newExporter(binder).export(AlluxioCacheStats.class).as(generator -> generator.generatedNameOf(AlluxioCacheStats.class));
50+
Provider<CatalogName> catalogName = binder.getProvider(CatalogName.class);
51+
newExporter(binder).export(AlluxioCacheStats.class)
52+
.as(generator -> generator.generatedNameOf(AlluxioCacheStats.class, catalogName.get().toString()));
4953

5054
if (isCoordinator) {
5155
newOptionalBinder(binder, CachingHostAddressProvider.class).setBinding().to(ConsistentHashingHostAddressProvider.class).in(SINGLETON);

testing/trino-product-tests/src/main/java/io/trino/tests/product/utils/CachingTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static CacheStats getCacheStats(String catalog)
2727
QueryResult queryResult = onTrino().executeQuery("SELECT " +
2828
" sum(\"cachereads.alltime.count\") as cachereads, " +
2929
" sum(\"externalreads.alltime.count\") as externalreads " +
30-
"FROM jmx.current.\"io.trino.filesystem.alluxio:name=" + catalog + ",type=alluxiocachestats\";");
30+
"FROM jmx.current.\"io.trino.filesystem.alluxio:catalog=" + catalog + ",name=" + catalog + ",type=alluxiocachestats\";");
3131

3232
double cacheReads = (Double) getOnlyElement(queryResult.rows())
3333
.get(queryResult.tryFindColumnIndex("cachereads").get() - 1);

0 commit comments

Comments
 (0)