public interface StreamsMetrics
Modifier and Type | Method and Description |
---|---|
org.apache.kafka.common.metrics.Sensor |
addLatencyAndThroughputSensor(String scopeName,
String entityName,
String operationName,
org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel,
String... tags)
Deprecated.
since 2.5. Use
addLatencyRateTotalSensor()
instead. |
org.apache.kafka.common.metrics.Sensor |
addLatencyRateTotalSensor(String scopeName,
String entityName,
String operationName,
org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel,
String... tags)
Add a latency, rate and total sensor for a specific operation, which will include the following metrics:
average latency
max latency
invocation rate (num.operations / seconds)
total invocation count
Whenever a user records this sensor via
Sensor.record(double) etc, it will be counted as one invocation
of the operation, and hence the rate / count metrics will be updated accordingly; and the recorded latency value
will be used to update the average / max latency as well. |
org.apache.kafka.common.metrics.Sensor |
addRateTotalSensor(String scopeName,
String entityName,
String operationName,
org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel,
String... tags)
Add a rate and a total sensor for a specific operation, which will include the following metrics:
invocation rate (num.operations / time unit)
total invocation count
Whenever a user records this sensor via
Sensor.record(double) etc,
it will be counted as one invocation of the operation, and hence the rate / count metrics will be updated accordingly. |
org.apache.kafka.common.metrics.Sensor |
addSensor(String name,
org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel)
Generic method to create a sensor.
|
org.apache.kafka.common.metrics.Sensor |
addSensor(String name,
org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel,
org.apache.kafka.common.metrics.Sensor... parents)
Generic method to create a sensor with parent sensors.
|
org.apache.kafka.common.metrics.Sensor |
addThroughputSensor(String scopeName,
String entityName,
String operationName,
org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel,
String... tags)
Deprecated.
since 2.5. Use
addRateTotalSensor() instead. |
Map<MetricName,? extends Metric> |
metrics()
Get read-only handle on global metrics registry.
|
void |
recordLatency(org.apache.kafka.common.metrics.Sensor sensor,
long startNs,
long endNs)
Deprecated.
since 2.5. Use
Sensor#record() instead. |
void |
recordThroughput(org.apache.kafka.common.metrics.Sensor sensor,
long value)
Deprecated.
since 2.5. Use
Sensor#record() instead. |
void |
removeSensor(org.apache.kafka.common.metrics.Sensor sensor)
Remove a sensor.
|
Map<MetricName,? extends Metric> metrics()
org.apache.kafka.common.metrics.Sensor addLatencyRateTotalSensor(String scopeName, String entityName, String operationName, org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel, String... tags)
Sensor.record(double)
etc, it will be counted as one invocation
of the operation, and hence the rate / count metrics will be updated accordingly; and the recorded latency value
will be used to update the average / max latency as well.
Note that you can add more metrics to this sensor after you created it, which can then be updated upon
Sensor.record(double)
calls.
The added sensor and its metrics can be removed with removeSensor()
.scopeName
- name of the scope, which will be used as part of the metric type, e.g.: "stream-[scope]-metrics".entityName
- name of the entity, which will be used as part of the metric tags, e.g.: "[scope]-id" = "[entity]".operationName
- name of the operation, which will be used as the name of the metric, e.g.: "[operation]-latency-avg".recordingLevel
- the recording level (e.g., INFO or DEBUG) for this sensor.tags
- additional tags of the sensor#addRateTotalSensor(String, String, String, RecordingLevel, String...)
,
removeSensor(Sensor)
,
#addSensor(String, RecordingLevel, Sensor...)
org.apache.kafka.common.metrics.Sensor addRateTotalSensor(String scopeName, String entityName, String operationName, org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel, String... tags)
Sensor.record(double)
etc,
it will be counted as one invocation of the operation, and hence the rate / count metrics will be updated accordingly.
Note that you can add more metrics to this sensor after you created it, which can then be updated upon
Sensor.record(double)
calls.
The added sensor and its metrics can be removed with removeSensor()
.scopeName
- name of the scope, which will be used as part of the metrics type, e.g.: "stream-[scope]-metrics".entityName
- name of the entity, which will be used as part of the metric tags, e.g.: "[scope]-id" = "[entity]".operationName
- name of the operation, which will be used as the name of the metric, e.g.: "[operation]-total".recordingLevel
- the recording level (e.g., INFO or DEBUG) for this sensor.tags
- additional tags of the sensor#addLatencyRateTotalSensor(String, String, String, RecordingLevel, String...)
,
removeSensor(Sensor)
,
#addSensor(String, RecordingLevel, Sensor...)
@Deprecated org.apache.kafka.common.metrics.Sensor addLatencyAndThroughputSensor(String scopeName, String entityName, String operationName, org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel, String... tags)
addLatencyRateTotalSensor()
instead.scopeName
- name of the scope, could be the type of the state store, etc.entityName
- name of the entity, could be the name of the state store instance, etc.operationName
- name of the operation, could be get / put / delete / etc.recordingLevel
- the recording level (e.g., INFO or DEBUG) for this sensor.tags
- additional tags of the sensor@Deprecated void recordLatency(org.apache.kafka.common.metrics.Sensor sensor, long startNs, long endNs)
Sensor#record()
instead.addLatencyAndThroughputSensor(String, String, String, Sensor.RecordingLevel, String...)
method, then the
throughput metrics will also be recorded from this event.sensor
- sensor whose latency we are recording.startNs
- start of measurement time in nanoseconds.endNs
- end of measurement time in nanoseconds.@Deprecated org.apache.kafka.common.metrics.Sensor addThroughputSensor(String scopeName, String entityName, String operationName, org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel, String... tags)
addRateTotalSensor()
instead.addLatencyAndThroughputSensor(String, String, String, Sensor.RecordingLevel, String...)
.scopeName
- name of the scope, could be the type of the state store, etc.entityName
- name of the entity, could be the name of the state store instance, etc.operationName
- name of the operation, could be get / put / delete / etc.recordingLevel
- the recording level (e.g., INFO or DEBUG) for this sensor.tags
- additional tags of the sensor@Deprecated void recordThroughput(org.apache.kafka.common.metrics.Sensor sensor, long value)
Sensor#record()
instead.sensor
- add Sensor whose throughput we are recordingvalue
- throughput valueorg.apache.kafka.common.metrics.Sensor addSensor(String name, org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel)
addRateTotalSensor()
or addLatencyRateTotalSensor()
to ensure metric name well-formedness and conformity with the rest of the Kafka Streams code base.
However, if the above two methods are not sufficient, this method can also be used.name
- name of the sensor.recordingLevel
- the recording level (e.g., INFO or DEBUG) for this sensor#addRateTotalSensor(String, String, String, RecordingLevel, String...)
,
#addLatencyRateTotalSensor(String, String, String, RecordingLevel, String...)
,
removeSensor(Sensor)
org.apache.kafka.common.metrics.Sensor addSensor(String name, org.apache.kafka.common.metrics.Sensor.RecordingLevel recordingLevel, org.apache.kafka.common.metrics.Sensor... parents)
addRateTotalSensor()
or addLatencyRateTotalSensor()
to ensure metric name well-formedness and conformity with the rest of the Kafka Streams code base.
However, if the above two methods are not sufficient, this method can also be used.name
- name of the sensorrecordingLevel
- the recording level (e.g., INFO or DEBUG) for this sensor#addRateTotalSensor(String, String, String, RecordingLevel, String...)
,
#addLatencyRateTotalSensor(String, String, String, RecordingLevel, String...)
,
removeSensor(Sensor)
void removeSensor(org.apache.kafka.common.metrics.Sensor sensor)
sensor
- sensor to be removed