com.yammer.metrics.core.Clock Java Examples

The following examples show how to use com.yammer.metrics.core.Clock. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KafkaStatsdMetricsReporter.java    From kafka-statsd-reporter with MIT License 6 votes vote down vote up
@Override
public synchronized void stopReporter() {
	if (initialized && running) {
		reporter.shutdown();
		running = false;
		LOG.info("Stopped Kafka Statsd metrics reporter");
           try {
           	reporter = new StatsdReporter(
           			Metrics.defaultRegistry(),
           			statsdGroupPrefix,
           			predicate,
           			statsdHost,
           			statsdPort,
           			Clock.defaultClock()
           			);
           } catch (IOException e) {
           	LOG.error("Unable to initialize StatsdReporter", e);
           }
	}
}
 
Example #2
Source File: KafkaGraphiteMetricsReporter.java    From kafka-graphite with Apache License 2.0 6 votes vote down vote up
private FilteredGraphiteReporter buildGraphiteReporter() {
    FilteredGraphiteReporter graphiteReporter = null;
    try {
        graphiteReporter = new FilteredGraphiteReporter(
                Metrics.defaultRegistry(),
                metricPrefix,
                metricPredicate,
                metricDimensions,
                new FilteredGraphiteReporter.DefaultSocketProvider(graphiteHost, graphitePort),
                Clock.defaultClock()
        );
    } catch (IOException e) {
        LOG.error("Unable to initialize GraphiteReporter", e);
    }
    return graphiteReporter;
}
 
Example #3
Source File: CustomReporter.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link CustomReporter} for a given metrics registry.
 */
public CustomReporter(final MetricsRegistry metricsRegistry,
        final PrintStream out, final MetricPredicate predicate,
        final Clock clock, final TimeZone timeZone) {
    this(metricsRegistry, out, predicate, clock, timeZone, Locale
            .getDefault());
}
 
Example #4
Source File: CustomReporter.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link CustomReporter} for a given metrics registry.
 */
public CustomReporter(final MetricsRegistry metricsRegistry,
        final PrintStream out, final MetricPredicate predicate,
        final Clock clock, final TimeZone timeZone, final Locale locale) {
    super(metricsRegistry, "console-reporter");
    this.out = out;
    this.predicate = predicate;
    this.clock = clock;
    this.timeZone = timeZone;
    this.locale = locale;
}
 
Example #5
Source File: CustomReporter.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link CustomReporter} for a given metrics registry.
 */
public CustomReporter(final MetricsRegistry metricsRegistry,
        final PrintStream out, final MetricPredicate predicate,
        final Clock clock, final TimeZone timeZone) {
    this(metricsRegistry, out, predicate, clock, timeZone, Locale
            .getDefault());
}
 
Example #6
Source File: CustomReporter.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link CustomReporter} for a given metrics registry.
 */
public CustomReporter(final MetricsRegistry metricsRegistry,
        final PrintStream out, final MetricPredicate predicate,
        final Clock clock, final TimeZone timeZone, final Locale locale) {
    super(metricsRegistry, "console-reporter");
    this.out = out;
    this.predicate = predicate;
    this.clock = clock;
    this.timeZone = timeZone;
    this.locale = locale;
}
 
Example #7
Source File: KafkaStatsdMetricsReporter.java    From kafka-statsd-reporter with MIT License 5 votes vote down vote up
@Override
public synchronized void init(VerifiableProperties props) {
	if (!initialized) {
		KafkaMetricsConfig metricsConfig = new KafkaMetricsConfig(props);
		statsdHost = props.getString("kafka.statsd.metrics.host", STATSD_DEFAULT_HOST).trim();
		statsdPort = props.getInt("kafka.statsd.metrics.port", STATSD_DEFAULT_PORT);
		statsdGroupPrefix = props.getString("kafka.statsd.metrics.group", STATSD_DEFAULT_PREFIX).trim();
           String regex = props.getString("kafka.statsd.metrics.exclude.regex", null);

           LOG.debug("Initialize StatsdReporter ["+statsdHost+","+statsdPort+","+statsdGroupPrefix+"]");

           if (regex != null) {
           	predicate = new RegexMetricPredicate(regex);
           }
           try {
           	reporter = new StatsdReporter(
           			Metrics.defaultRegistry(),
           			statsdGroupPrefix,
           			predicate,
           			statsdHost,
           			statsdPort,
           			Clock.defaultClock()
           			);
           } catch (IOException e) {
           	LOG.error("Unable to initialize StatsdReporter", e);
           }
           if (props.getBoolean("kafka.statsd.metrics.reporter.enabled", false)) {
           	initialized = true;
           	startReporter(metricsConfig.pollingIntervalSecs());
               LOG.debug("StatsdReporter started.");
           }
       }
   }
 
Example #8
Source File: CustomReporter.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new {@link CustomReporter} for a given metrics registry.
 */
public CustomReporter(final MetricsRegistry metricsRegistry,
        final PrintStream out, final MetricPredicate predicate) {
    this(metricsRegistry, out, predicate, Clock.defaultClock(), TimeZone
            .getDefault());
}
 
Example #9
Source File: CustomReporter.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new {@link CustomReporter} for a given metrics registry.
 */
public CustomReporter(final MetricsRegistry metricsRegistry,
        final PrintStream out, final MetricPredicate predicate) {
    this(metricsRegistry, out, predicate, Clock.defaultClock(), TimeZone
            .getDefault());
}
 
Example #10
Source File: AggregatedMetricsRegistry.java    From incubator-pinot with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new {@link AggregatedMetricsRegistry} with the given {@link Clock} instance.
 *
 * @param clock    a {@link Clock} instance
 */
public AggregatedMetricsRegistry(Clock clock) {
  super(clock);
}