Package io.strimzi.kafka.oauth.metrics
Class MetricsUtil
java.lang.Object
io.strimzi.kafka.oauth.metrics.MetricsUtil
Static utility methods used for metrics
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddHttpErrorAttrs(Map<String, String> attrs, Throwable ex) Add http error attributes to the passed map of attributesaddHttpSuccessAttrs(Map<String, String> attrs) Add http success attributes to the passed map of attributesgetSensorKeyAttrs(String contextId, String mechanism, URI uri, String kind) Get the attributes for the sensor key using passed info.getSensorKeyAttrs(String contextId, URI uri, String kind) Get the attributes for the sensor key using passed infostatic StringExtract the hostname:port from the passed url For 'http' protocol use port 80 as the default.static StringResolve the raw path of the passed url
-
Constructor Details
-
MetricsUtil
public MetricsUtil()
-
-
Method Details
-
getSensorKeyAttrs
public static Map<String,String> getSensorKeyAttrs(String contextId, String mechanism, URI uri, String kind) Get the attributes for the sensor key using passed info.- Parameters:
contextId- a contextIdmechanism- a SASL authentication mechanism useduri- a URI associated with the sensorkind- a 'kind' for the sensor- Returns:
- The map of attributes for the SensorKey
-
getSensorKeyAttrs
Get the attributes for the sensor key using passed info- Parameters:
contextId- a contextIduri- a URI associated with the sensorkind- a 'kind' for the sensor- Returns:
- The map of attributes for the SensorKey
-
addHttpSuccessAttrs
Add http success attributes to the passed map of attributes- Parameters:
attrs- A target attributes map- Returns:
- The passed attributes map
-
addHttpErrorAttrs
Add http error attributes to the passed map of attributes- Parameters:
attrs- A target attributes mapex- The exception that occurred- Returns:
- The passed attributes map
-
pathAttr
Resolve the raw path of the passed url- Parameters:
uri- a URI object- Returns:
- The path component of the URI
-
hostAttr
Extract the hostname:port from the passed url For 'http' protocol use port 80 as the default. For 'https' protocol use port 443 as the default.- Parameters:
uri- the URI object- Returns:
- The hostname:port
-