use of com.codahale.metrics.graphite.Graphite in project neo4j by neo4j.
the class GraphiteOutput method init.
@Override
public void init() {
// Setup Graphite reporting
final Graphite graphite = new Graphite(hostnamePort.getHost(), hostnamePort.getPort());
graphiteReporter = GraphiteReporter.forRegistry(registry).prefixedWith(prefix).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(graphite);
}
use of com.codahale.metrics.graphite.Graphite in project riposte by Nike-Inc.
the class DefaultGraphiteReporterFactory method getReporter.
@Override
public synchronized Reporter getReporter(MetricRegistry registry) {
if (null == reporter) {
Graphite graphite = new Graphite(new InetSocketAddress(graphiteURL, graphitePort));
reporter = GraphiteReporter.forRegistry(registry).prefixedWith(prefix).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(graphite);
}
return reporter;
}
use of com.codahale.metrics.graphite.Graphite in project indy by Commonjava.
the class ReporterIntializer method initGraphiteReporterForJVMMetric.
private void initGraphiteReporterForJVMMetric(MetricRegistry metrics, IndyMetricsConfig config) {
final Graphite graphite = new Graphite(new InetSocketAddress(config.getGrphiterHostName(), config.getGrphiterPort()));
final GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics).prefixedWith(config.getGrphiterPrefix()).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter((name, metric) -> {
if (!name.contains(FILTER_SIMPLE) && name.contains(FILTER_JVM)) {
return true;
}
return false;
}).build(graphite);
reporter.start(config.getGrphiterJVMPriod(), TimeUnit.SECONDS);
}
use of com.codahale.metrics.graphite.Graphite in project lucene-solr by apache.
the class SolrGraphiteReporter method validate.
@Override
protected void validate() throws IllegalStateException {
if (!enabled) {
log.info("Reporter disabled for registry " + registryName);
return;
}
if (host == null) {
throw new IllegalStateException("Init argument 'host' must be set to a valid Graphite server name.");
}
if (port == -1) {
throw new IllegalStateException("Init argument 'port' must be set to a valid Graphite server port.");
}
if (reporter != null) {
throw new IllegalStateException("Already started once?");
}
if (period < 1) {
throw new IllegalStateException("Init argument 'period' is in time unit 'seconds' and must be at least 1.");
}
GraphiteSender graphite;
String id = host + ":" + port + ":" + pickled;
graphite = serviceRegistry.getOrCreate(id, () -> {
if (pickled) {
return new PickledGraphite(host, port);
} else {
return new Graphite(host, port);
}
});
if (instancePrefix == null) {
instancePrefix = registryName;
} else {
instancePrefix = instancePrefix + "." + registryName;
}
GraphiteReporter.Builder builder = GraphiteReporter.forRegistry(metricManager.registry(registryName)).prefixedWith(instancePrefix).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS);
MetricFilter filter;
if (!filters.isEmpty()) {
filter = new SolrMetricManager.PrefixFilter(filters);
} else {
filter = MetricFilter.ALL;
}
builder = builder.filter(filter);
reporter = builder.build(graphite);
reporter.start(period, TimeUnit.SECONDS);
}
Aggregations