Class Utils

java.lang.Object
io.confluent.telemetry.provider.Utils

public class Utils extends Object
  • Field Details

  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • notEmptyString

      public static boolean notEmptyString(Map<String,?> m, String key)
      Validate that the map contains the key and the key is a non-empty string
      Returns:
      true if key is valid.
    • getResourceLabels

      public static Map<String,String> getResourceLabels(Map<String,String> metricsCtxMetadata)
      Extract the resource labels from the metrics context metadata and remove metrics context prefix.
      Returns:
      a map of cleaned up labels.
    • getNonResourceLabels

      public static Map<String,String> getNonResourceLabels(Map<String,String> metricsCtxMetadata)
    • buildResourceFromLabels

      public static ResourceBuilderFacade buildResourceFromLabels(org.apache.kafka.common.metrics.MetricsContext metricsContext)
      Build a Resource from tags in the MetricsContext metadata.
      Returns:
    • buildResourceFromLabelsWithId

      public static ResourceBuilderFacade buildResourceFromLabelsWithId(org.apache.kafka.common.metrics.MetricsContext metricsContext, String id)
    • buildResourceFromAllLabelsWithId

      public static ResourceBuilderFacade buildResourceFromAllLabelsWithId(org.apache.kafka.common.metrics.MetricsContext metricsContext, String id)
    • validateRequiredLabels

      public static boolean validateRequiredLabels(Map<String,String> metadata)
      Validate that the MetricsContext metadata has tags for - _namespace - type - version - cluster id
      Returns:
      true if valid tags exist, false otherwise.
    • validateRequiredResourceLabels

      public static boolean validateRequiredResourceLabels(Map<String,String> metadata)
    • configPredicate

      public static Predicate<String> configPredicate(String regexString)
    • configEvent

      public static io.confluent.telemetry.api.events.Event configEvent(Map<String,?> cfg, Predicate<String> configPredicate, io.opentelemetry.proto.resource.v1.Resource res, Provider provider, String eventType)