public class OAuthMetrics
extends java.lang.Object
SensorKey and a Sensor, and one-to-one mapping between a Sensor and an MBean name.
MBeans are registered as requested by JmxReporter attached to the Metrics object.
The JmxReporter either has to be explicitly configured using a config option strimzi.oauth.metric.reporters,
or if that config option si not set, a new instance is configured by default.
Since OAuth instantiates its own Metrics object it also has to instantiate reporters to attach them to this Metrics object.
To prevent double instantiation of MetricReporter objects that require to be singleton, all MetricReporter objects
to be integrated with OAuthMetrics have to be separately instantiated.
Example 1:
strimzi.oauth.metric.reporters=org.apache.kafka.common.metrics.JmxReporter,org.some.package.SomeMetricReporter
The above will instantiate and integrate with OAuth metrics the JmxReporter instance, and a SomeMetricReporter instance.
Example 2:
strimzi.oauth.metric.reporters=
The above will not instantiate and integrate any metric reporters with OAuth metrics, not even JmxReporter.
Note: On the Kafka broker it is best to use STRIMZI_OAUTH_METRIC_REPORTERS env variable or strimzi.oauth.metric.reporters system property,
rather than a `server.properties` global configuration option.
| Modifier and Type | Method and Description |
|---|---|
void |
addTime(SensorKey key,
long timeMs)
Record a request time in millis.
|
public void addTime(SensorKey key, long timeMs)
key - SensorKey identifying the sensortimeMs - Time spent processing the request in millisCopyright © 2024. All rights reserved.