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


Java ProcessorContext.metrics方法代码示例

本文整理汇总了Java中org.apache.kafka.streams.processor.ProcessorContext.metrics方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessorContext.metrics方法的具体用法?Java ProcessorContext.metrics怎么用?Java ProcessorContext.metrics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.kafka.streams.processor.ProcessorContext的用法示例。


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

示例1: init

import org.apache.kafka.streams.processor.ProcessorContext; //导入方法依赖的package包/类
@Override
public void init(ProcessorContext context, StateStore root) {
    final String name = name();
    this.context = context;
    this.root = root;
    this.metrics = (StreamsMetricsImpl) context.metrics();
    this.putTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "put", Sensor.RecordingLevel.DEBUG);
    this.putIfAbsentTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "put-if-absent", Sensor.RecordingLevel.DEBUG);
    this.getTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "get", Sensor.RecordingLevel.DEBUG);
    this.deleteTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "delete", Sensor.RecordingLevel.DEBUG);
    this.putAllTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "put-all", Sensor.RecordingLevel.DEBUG);
    this.allTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "all", Sensor.RecordingLevel.DEBUG);
    this.rangeTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "range", Sensor.RecordingLevel.DEBUG);
    this.flushTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "flush", Sensor.RecordingLevel.DEBUG);
    this.restoreTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "restore", Sensor.RecordingLevel.DEBUG);

    // register and possibly restore the state from the logs
    metrics.measureLatencyNs(time, initDelegate, this.restoreTime);
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:20,代码来源:MeteredKeyValueStore.java

示例2: init

import org.apache.kafka.streams.processor.ProcessorContext; //导入方法依赖的package包/类
@Override
public void init(ProcessorContext context, StateStore root) {
    final String name = name();
    this.metrics = context.metrics();
    this.putTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "put", Sensor.RecordingLevel.DEBUG);
    this.fetchTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "fetch", Sensor.RecordingLevel.DEBUG);
    this.flushTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "flush", Sensor.RecordingLevel.DEBUG);
    this.getTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "get", Sensor.RecordingLevel.DEBUG);
    this.removeTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "remove", Sensor.RecordingLevel.DEBUG);

    final Sensor restoreTime = this.metrics.addLatencyAndThroughputSensor(metricScope, name, "restore", Sensor.RecordingLevel.DEBUG);
    // register and possibly restore the state from the logs
    final long startNs = time.nanoseconds();
    try {
        inner.init(context, root);
    } finally {
        this.metrics.recordLatency(restoreTime, startNs, time.nanoseconds());
    }
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:20,代码来源:MeteredSegmentedBytesStore.java

示例3: init

import org.apache.kafka.streams.processor.ProcessorContext; //导入方法依赖的package包/类
public void init(ProcessorContext context) {
    this.context = context;
    try {
        nodeMetrics = new NodeMetrics(context.metrics(), name, "task." + context.taskId());
        nodeMetrics.metrics.measureLatencyNs(time, initDelegate, nodeMetrics.nodeCreationSensor);
    } catch (Exception e) {
        throw new StreamsException(String.format("failed to initialize processor %s", name), e);
    }
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:10,代码来源:ProcessorNode.java


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