本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例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();
}
示例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());
}
示例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());
}
示例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.");
}
}
}
示例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();
}
}
}
示例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);
}