Skip to content

Commit

Permalink
Merge pull request #3 from secfree/230509-enable-alluxio-metrics
Browse files Browse the repository at this point in the history
Sink alluxio metrics to JMX
  • Loading branch information
beinan committed May 18, 2023
2 parents e85d2c1 + 54ef6df commit 3653b34
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import alluxio.conf.AlluxioProperties;
import alluxio.conf.InstancedConfiguration;
import alluxio.conf.PropertyKey;
import alluxio.metrics.MetricsConfig;
import alluxio.metrics.MetricsSystem;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Provides;
Expand All @@ -27,6 +29,7 @@
import io.trino.filesystem.hdfs.CachingFileSystemFactory;

import java.io.IOException;
import java.util.Properties;

import static com.google.inject.Scopes.SINGLETON;
import static io.airlift.configuration.ConfigBinder.configBinder;
Expand All @@ -39,6 +42,10 @@ protected void setup(Binder binder)
{
configBinder(binder).bindConfig(CachingFileSystemConfig.class);
binder.bind(TrinoFileSystemFactory.class).to(CachingFileSystemFactory.class).in(SINGLETON);
Properties metricProps = new Properties();
metricProps.put("sink.jmx.class", "alluxio.metrics.sink.JmxSink");
metricProps.put("sink.jmx.domain", "org.alluxio");
MetricsSystem.startSinksFromConfig(new MetricsConfig(metricProps));
}

@Inject
Expand All @@ -52,6 +59,7 @@ public AlluxioConfiguration getAlluxioConfiguration(CachingFileSystemConfig conf
alluxioProperties.set(PropertyKey.USER_CLIENT_CACHE_DIRS, config.getBaseDirectory());
}
alluxioProperties.set(PropertyKey.USER_CLIENT_CACHE_SIZE, config.getMaxCacheSize().toString());
alluxioProperties.set(PropertyKey.USER_CLIENT_CACHE_SHADOW_ENABLED, "true");
return new InstancedConfiguration(alluxioProperties);
}

Expand Down

0 comments on commit 3653b34

Please sign in to comment.