Class ConnectionInformationSensors
java.lang.Object
io.confluent.kafka.multitenant.metrics.ConnectionInformationSensors
A per-connection sensor manager to manage the lifecycles of the connection_info metrics. This class is safe to used
by different network threads during the processing of multiple connections.
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionInformationSensors(org.apache.kafka.common.metrics.Metrics metrics, io.confluent.kafka.multitenant.MultiTenantPrincipal principal, org.apache.kafka.common.network.ClientInformation clientInformation, String clientId, int maxConnectionInfoMetricsPerTenant) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.kafka.common.metrics.SensorGets or Creates aSensorand record the new authenticated connection to emit the connection information as the tags of aKafkaMetric.org.apache.kafka.common.metrics.SensorReduces the number of authenticated connection sharing the same connection information by one if the corresponding metric exists.
-
Constructor Details
-
ConnectionInformationSensors
public ConnectionInformationSensors(org.apache.kafka.common.metrics.Metrics metrics, io.confluent.kafka.multitenant.MultiTenantPrincipal principal, org.apache.kafka.common.network.ClientInformation clientInformation, String clientId, int maxConnectionInfoMetricsPerTenant)
-
-
Method Details
-
recordAuthenticatedConnection
public org.apache.kafka.common.metrics.Sensor recordAuthenticatedConnection()Gets or Creates aSensorand record the new authenticated connection to emit the connection information as the tags of aKafkaMetric. The value of the metric stat is the number of authenticated connection sharing the same connection info, such as client software name/version and client id. The number of unique connection info metric per tenant is subject to a pre-defined cap as} to prevent memory exhaustion in the case of clients creating connections with different client ids continuously.invalid @link
{@link this#maxConnectionInfoMetricsPerTenant- Returns:
- the
Sensorto emit connection information or null if the cap is reached
-
recordAuthenticatedDisconnection
public org.apache.kafka.common.metrics.Sensor recordAuthenticatedDisconnection()Reduces the number of authenticated connection sharing the same connection information by one if the corresponding metric exists. If the number of authenticated connections reaches zero, remove the connection infoSensorand its associated metrics to stop emitting them.- Returns:
- the
Sensorto emit the connection information or null if the sensor is removed/doesn't exist
-