Package io.strimzi.kafka.oauth.metrics
Class SensorKey
java.lang.Object
io.strimzi.kafka.oauth.metrics.SensorKey
The SensorKey represents and uniquely identifies the Kafka Metrics API Sensor,
which represents a set of metrics that are updated at the same time.
These metrics are:
The following attributes are required: "context", "kind", "host", "path".
As a convention, only use alphanumeric characters and an underscore (_) in the name and the attribute keys. Note, that names and attributes become part of the JMX ObjectName when metrics are plugged into the JMX MBeanServer. Attribute values containing some other characters (like ':', or '/') will become quoted when converted to JMX ObjectNames.
Kafka Sensors are created on demand and cached by the value of the
Some examples of SensorKeys and how they map to JMX ObjectNames:
These metrics are:
- count
- totalTimeMs
- minTimeMs
- maxTimeMs
- avgTimeMs
name and the attributes.
The following attributes are required: "context", "kind", "host", "path".
As a convention, only use alphanumeric characters and an underscore (_) in the name and the attribute keys. Note, that names and attributes become part of the JMX ObjectName when metrics are plugged into the JMX MBeanServer. Attribute values containing some other characters (like ':', or '/') will become quoted when converted to JMX ObjectNames.
Kafka Sensors are created on demand and cached by the value of the
id, which is a string representation of this SensorKey.
Each Sensor is exported as a single managed bean with a unique JMX ObjectName.
Some examples of SensorKeys and how they map to JMX ObjectNames:
- Name: http_requests
- Attributes: context=PUBLIC, kind=jwks, host=localhost:443, path=/certs, outcome=success, status=200
- JMX ObjectName: strimzi.oauth:type=http_requests,context=PUBLIC,kind=jwks,host="localhost:443",path="/certs",outcome=success,status=200
- Name: validation_requests
- Attributes: context=e8af84dd, kind=introspect, host=localhost:443, path=/introspect, mechanism=PLAIN, outcome=error, error_type=other
- JMX ObjectName: strimzi.oauth:type=validation_requests,context=e8af84dd,kind=introspect,host="localhost:443",path="/introspect",mechanism=PLAIN,outcome=error,error_type=other
-
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the attributes of this SensorKey as a MapgetId()Get a String representation of this SensorKey that uniquely identifies it.getName()Get the name of this SensorKeyinthashCode()static SensorKeyCreate a new instance of SensorKey from name and attributesstatic SensorKeyCreate a new instance of SensorKey from name and a map of attributestoString()
-
Method Details
-
of
Create a new instance of SensorKey from name and a map of attributes- Parameters:
name- The metric nameattributes- The map of attributes- Returns:
- The new instance of SensorKey
-
of
Create a new instance of SensorKey from name and attributes- Parameters:
name- The metric nameattributes- The varargs list of attributes as name1, value1 ... nameN, valueN- Returns:
- The new instance of SensorKey
-
getId
Get a String representation of this SensorKey that uniquely identifies it. This is simply a concatenation of the name and the string value of the attributes map.- Returns:
- A sensor id
-
getName
Get the name of this SensorKey- Returns:
- The name as a String
-
getAttributes
Get the attributes of this SensorKey as a Map- Returns:
- The attributes as a Map
-
equals
-
hashCode
public int hashCode() -
toString
-