Class ClusterIdKeyStrategy

  • All Implemented Interfaces:
    KeyStrategy

    public class ClusterIdKeyStrategy
    extends Object
    implements KeyStrategy
    A KeyStrategy implementation 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 Detail

      • ClusterIdKeyStrategy

        public ClusterIdKeyStrategy​(Properties props)
                             throws InterruptedException,
                                    ExecutionException
        Creates an instance of ClusterIdKeyStrategy using 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: KeyStrategy
        Resolves 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:
        getTaxon in interface KeyStrategy
        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.