Class ClientIdKeyStrategy

  • All Implemented Interfaces:
    KeyStrategy

    public class ClientIdKeyStrategy
    extends Object
    implements KeyStrategy
    A KeyStrategy implementation that derives the key for metrics data using the client ID and application ID of the active Kafka Streams instance.

    This strategy simplifies the configuration process by relying solely on the client ID and application ID, eliminating the need for a Kafka AdminClient. It is particularly suitable for constrained environments where creating an AdminClient may not be feasible or appropriate due to security concerns.

    Important: In a multi-cluster Kpow deployment, where the same application ID and client ID are used across multiple environments (e.g., staging, development, production), this strategy cannot determine which cluster the Kafka Streams instance is associated with. This limitation may impact the accuracy of metrics alignment in the Kpow UI for such setups.

    This strategy is most effective in single-cluster deployments, lightweight environments, or scenarios where client IDs and application IDs are guaranteed to be unique across clusters.

    • Constructor Detail

      • ClientIdKeyStrategy

        public ClientIdKeyStrategy()
        Constructs a new instance of the ClientIdKeyStrategy.
    • 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.