当前位置: 首页>>代码示例>>Java>>正文


Java Clock类代码示例

本文整理汇总了Java中com.yammer.metrics.core.Clock的典型用法代码示例。如果您正苦于以下问题:Java Clock类的具体用法?Java Clock怎么用?Java Clock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Clock类属于com.yammer.metrics.core包,在下文中一共展示了Clock类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildInfluxDBReporter

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
private FilteredInfluxDBReporter buildInfluxDBReporter() {
    FilteredInfluxDBReporter influxDBReporter = null;
    influxDBReporter = new FilteredInfluxDBReporter(
                Metrics.defaultRegistry(),
                influxDBAddress,
                influxDBDatabase,
                influxDBRetentionPolicy,
                influxDBUsername,
                influxDBPassword,
                influxDBConsistency,
                influxDBTags,
                metricDimensions,
                Clock.defaultClock(),
                VirtualMachineMetrics.getInstance()
        );
    return influxDBReporter;
}
 
开发者ID:jasper-zhang,项目名称:kafka-influxdb,代码行数:18,代码来源:KafkaInfluxDBMetricsReporter.java

示例2: stopReporter

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
@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);
           }
	}
}
 
开发者ID:myfitnesspal,项目名称:kafka-statsd-reporter,代码行数:21,代码来源:KafkaStatsdMetricsReporter.java

示例3: buildGraphiteReporter

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
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;
}
 
开发者ID:damienclaveau,项目名称:kafka-graphite,代码行数:17,代码来源:KafkaGraphiteMetricsReporter.java

示例4: StatsdReporter

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
public StatsdReporter(MetricsRegistry metricsRegistry, String prefix, MetricPredicate predicate,
        UDPSocketProvider socketProvider, Clock clock, VirtualMachineMetrics vm, String name) throws IOException {
    super(metricsRegistry, name);

    this.socketProvider = socketProvider;
    this.vm = vm;

    this.clock = clock;

    if (prefix != null) {
        // Pre-append the "." so that we don't need to make anything
        // conditional later.
        this.prefix = prefix + ".";
    } else {
        this.prefix = "";
    }
    this.predicate = predicate;
    this.outputData = new ByteArrayOutputStream();
}
 
开发者ID:krux,项目名称:kafka-metrics-reporter,代码行数:20,代码来源:StatsdReporter.java

示例5: CustomReporter

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:10,代码来源:CustomReporter.java

示例6: UtilConsoleReporter

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
/**
 * Creates a new {@link UtilConsoleReporter} for a given metrics registry.
 */
public UtilConsoleReporter(final MetricsRegistry metricsRegistry,
        final PrintStream out, final MetricPredicate predicate,
        final Clock clock, final TimeZone timeZone) {
    this(metricsRegistry, out, predicate, clock, timeZone, Locale
            .getDefault());
}
 
开发者ID:kyle-liu,项目名称:netty4study,代码行数:10,代码来源:UtilConsoleReporter.java

示例7: init

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
@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.");
           }
       }
   }
 
开发者ID:myfitnesspal,项目名称:kafka-statsd-reporter,代码行数:34,代码来源:KafkaStatsdMetricsReporter.java

示例8: dumpVmMetrics

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
/**
 * Dumps JVM metrics for this process.
 * @param incidentId incident id
 */
public static void dumpVmMetrics(String incidentId)
{
  PrintWriter writer = null;
  try
  {
    String dumpFile = EventUtil.getDumpPathPrefix() + "/" +
                      INC_DUMP_FILE_NAME + incidentId + INC_DUMP_FILE_EXT;

    final OutputStream outStream =
        new GZIPOutputStream(new FileOutputStream(dumpFile));
    writer = new PrintWriter(outStream, true);

    final VirtualMachineMetrics vm = VirtualMachineMetrics.getInstance();
    writer.print("\n\n\n---------------------------  METRICS "
                 + "---------------------------\n\n");
    writer.flush();
    JsonFactory jf = new JsonFactory();
    jf.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
    ObjectMapper mapper = new ObjectMapper(jf);

    mapper.registerModule(new JodaModule());
    mapper.setDateFormat(new ISO8601DateFormat());
    mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
    MetricsServlet metrics = new MetricsServlet(Clock.defaultClock(),
                                                vm,
                                                Metrics.defaultRegistry(),
                                                jf,
                                                true);

    final JsonGenerator json = jf.createGenerator(outStream,
                                                  JsonEncoding.UTF8);
    json.useDefaultPrettyPrinter();
    json.writeStartObject();

    // JVM metrics
    writeVmMetrics(json, vm);

    // Components metrics
    metrics.writeRegularMetrics(json, // json generator
                                null, // class prefix
                                false); // include full samples

    json.writeEndObject();
    json.close();

    logger.debug("Creating full thread dump in dump file {}", dumpFile);

    // Thread dump next....
    writer.print("\n\n\n---------------------------  THREAD DUMP "
        + "---------------------------\n\n");
    writer.flush();

    vm.threadDump(outStream);

    logger.debug("Dump file {} is created.", dumpFile);
  }
  catch(Exception exc)
  {
    logger.error(
        "Unable to write dump file, exception: {}", exc.getMessage());
  }
  finally
  {
    if (writer != null)
    {
      writer.close();
    }
  }
}
 
开发者ID:snowflakedb,项目名称:snowflake-jdbc,代码行数:74,代码来源:IncidentUtil.java

示例9: AggregatedMetricsRegistry

import com.yammer.metrics.core.Clock; //导入依赖的package包/类
/**
 * Creates a new {@link AggregatedMetricsRegistry} with the given {@link Clock} instance.
 *
 * @param clock    a {@link Clock} instance
 */
public AggregatedMetricsRegistry(Clock clock) {
  super(clock);
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:9,代码来源:AggregatedMetricsRegistry.java


注:本文中的com.yammer.metrics.core.Clock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。