Package io.factorhouse.kpow.key
Class ClusterIdKeyStrategy
- java.lang.Object
-
- io.factorhouse.kpow.key.ClusterIdKeyStrategy
-
- All Implemented Interfaces:
KeyStrategy
public class ClusterIdKeyStrategy extends Object implements KeyStrategy
AKeyStrategyimplementation that uses the Kafka cluster ID as the primary identifier for keying metrics data in Kpow's internal Kafka topic.This key strategy uses the cluster ID, obtained via an
Admin.describeCluster()call.This AdminClient is created once during registry initialization and then closed.
This is the default and recommended keying strategy for Kpow, as it provides a robust way to uniquely associate metrics data with a specific Kafka cluster.
-
-
Constructor Summary
Constructors Constructor Description ClusterIdKeyStrategy(Properties props)Creates an instance ofClusterIdKeyStrategyusing properties for AdminClient configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaxongetTaxon(String clientId, String applicationId)Resolves the unique key for metric records based on the provided clientID and applicationID of the registered Kafka Streams application.
-
-
-
Constructor Detail
-
ClusterIdKeyStrategy
public ClusterIdKeyStrategy(Properties props) throws InterruptedException, ExecutionException
Creates an instance ofClusterIdKeyStrategyusing properties for AdminClient configuration.- Parameters:
props- Kafka connection properties used for the AdminClient.- Throws:
InterruptedException- if the current thread is interrupted while waiting.ExecutionException- if an error occurred during cluster description due to a connection issue with the Kafka brokers.
-
-
Method Detail
-
getTaxon
public Taxon getTaxon(String clientId, String applicationId)
Description copied from interface:KeyStrategyResolves the unique key for metric records based on the provided clientID and applicationID of the registered Kafka Streams application.The resolved key, represented as a
Taxon, serves as the primary identifier for grouping and organizing metrics data in Kpow's snapshots topic. This enables Kpow to align the metrics with the correct Kafka Streams application in the UI.- Specified by:
getTaxonin interfaceKeyStrategy- Parameters:
clientId- The client ID of the registered streams application.applicationId- The application ID of the registered Kafka streams application.- Returns:
- The unique Taxon object representing the key.
-
-