Package alluxio.cli.bundler.command
Class CollectMetricsCommand
- java.lang.Object
-
- alluxio.cli.bundler.command.AbstractCollectInfoCommand
-
- alluxio.cli.bundler.command.CollectMetricsCommand
-
- All Implemented Interfaces:
alluxio.cli.Command,java.io.Closeable,java.lang.AutoCloseable
public class CollectMetricsCommand extends AbstractCollectInfoCommand
Command to probe Alluxio metrics for a few times.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMMAND_NAMEstatic org.apache.commons.cli.OptionsOPTIONS-
Fields inherited from class alluxio.cli.bundler.command.AbstractCollectInfoCommand
mFsContext, mWorkingDirPath
-
-
Constructor Summary
Constructors Constructor Description CollectMetricsCommand(alluxio.client.file.FileSystemContext fsContext)Creates a new instance ofCollectMetricsCommand.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCommandName()java.lang.StringgetDescription()static java.lang.StringgetMetricsJson(java.lang.String url)Probes Alluxio metrics json sink.java.lang.StringgetUsage()static java.lang.StringmasterMetrics(alluxio.client.file.FileSystemContext fsContext)Get master metrics.intrun(org.apache.commons.cli.CommandLine cl)static java.util.List<java.lang.String>workerMetrics(alluxio.client.file.FileSystemContext fsContext)Get metrics from each worker.-
Methods inherited from class alluxio.cli.bundler.command.AbstractCollectInfoCommand
generateOutputFile, getWorkingDirectory, validateArgs
-
-
-
-
Field Detail
-
COMMAND_NAME
public static final java.lang.String COMMAND_NAME
- See Also:
- Constant Field Values
-
OPTIONS
public static final org.apache.commons.cli.Options OPTIONS
-
-
Constructor Detail
-
CollectMetricsCommand
public CollectMetricsCommand(alluxio.client.file.FileSystemContext fsContext)
Creates a new instance ofCollectMetricsCommand.- Parameters:
fsContext- theFileSystemContextto execute in
-
-
Method Detail
-
getCommandName
public java.lang.String getCommandName()
-
run
public int run(org.apache.commons.cli.CommandLine cl) throws alluxio.exception.AlluxioException, java.io.IOException- Throws:
alluxio.exception.AlluxioExceptionjava.io.IOException
-
getUsage
public java.lang.String getUsage()
-
getDescription
public java.lang.String getDescription()
-
masterMetrics
public static java.lang.String masterMetrics(alluxio.client.file.FileSystemContext fsContext)
Get master metrics.- Parameters:
fsContext- for connecting to master- Returns:
- the string of master metrics in JSON format
-
workerMetrics
public static java.util.List<java.lang.String> workerMetrics(alluxio.client.file.FileSystemContext fsContext) throws java.io.IOExceptionGet metrics from each worker.- Parameters:
fsContext- for connecting to master- Returns:
- a list of worker metrics in JSON format
- Throws:
java.io.IOException
-
getMetricsJson
public static java.lang.String getMetricsJson(java.lang.String url) throws java.io.IOExceptionProbes Alluxio metrics json sink. If the HTTP request fails, return the error content instead of throwing an exception.- Parameters:
url- URL that serves Alluxio metrics- Returns:
- HTTP response in JSON string
- Throws:
java.io.IOException
-
-