use of com.codahale.metrics.jmx.JmxReporter in project ambry by linkedin.
the class DumpDataTool method main.
public static void main(String[] args) throws Exception {
VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
MetricRegistry registry = new MetricRegistry();
StoreToolsMetrics metrics = new StoreToolsMetrics(registry);
JmxReporter reporter = null;
try {
reporter = JmxReporter.forRegistry(registry).build();
reporter.start();
DumpDataTool dumpDataTool = new DumpDataTool(verifiableProperties, metrics);
dumpDataTool.doOperation();
} finally {
if (reporter != null) {
reporter.stop();
}
}
}
use of com.codahale.metrics.jmx.JmxReporter in project ambry by linkedin.
the class DumpLogTool method main.
public static void main(String[] args) throws Exception {
VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
MetricRegistry registry = new MetricRegistry();
StoreToolsMetrics metrics = new StoreToolsMetrics(registry);
JmxReporter reporter = null;
try {
reporter = JmxReporter.forRegistry(registry).build();
reporter.start();
DumpLogTool dumpLogTool = new DumpLogTool(verifiableProperties, metrics);
dumpLogTool.doOperation();
} finally {
if (reporter != null) {
reporter.stop();
}
}
}
use of com.codahale.metrics.jmx.JmxReporter in project graylog2-server by Graylog2.
the class CmdLineTool method run.
@Override
public void run() {
final Level logLevel = setupLogger();
if (isDumpDefaultConfig()) {
dumpDefaultConfigAndExit();
}
// This is holding all our metrics.
MetricRegistry metricRegistry = MetricRegistryFactory.create();
featureFlags = getFeatureFlags(metricRegistry);
installConfigRepositories();
installCommandConfig();
beforeStart();
beforeStart(parseAndGetTLSConfiguration(), parseAndGetPathConfiguration(configFile));
processConfiguration(jadConfig);
coreConfigInjector = setupCoreConfigInjector();
final Set<Plugin> plugins = loadPlugins(getPluginPath(configFile), chainingClassLoader);
installPluginConfig(plugins);
processConfiguration(jadConfig);
if (isDumpConfig()) {
dumpCurrentConfigAndExit();
}
if (!validateConfiguration()) {
LOG.error("Validating configuration file failed - exiting.");
System.exit(1);
}
final List<String> arguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
LOG.info("Running with JVM arguments: {}", Joiner.on(' ').join(arguments));
beforeInjectorCreation(plugins);
injector = setupInjector(new NamedConfigParametersModule(jadConfig.getConfigurationBeans()), new PluginBindings(plugins), binder -> binder.bind(MetricRegistry.class).toInstance(metricRegistry));
if (injector == null) {
LOG.error("Injector could not be created, exiting! (Please include the previous error messages in bug " + "reports.)");
System.exit(1);
}
addInstrumentedAppender(metricRegistry, logLevel);
// Report metrics via JMX.
final JmxReporter reporter = JmxReporter.forRegistry(metricRegistry).build();
reporter.start();
startCommand();
}
Aggregations