Interface Provider

All Superinterfaces:
org.apache.kafka.common.Configurable
All Known Implementing Classes:
ControlCenterProvider, KafkaClientProvider, KafkaConnectProvider, KafkaRestProvider, KafkaServerProvider, KafkaStreamsProvider, KsqlProvider, SchemaRegistryProvider

public interface Provider extends org.apache.kafka.common.Configurable
Implement this interface to collect metrics for your component. You will need to register your implementation in ProviderRegistry.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Predicate<String>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default Predicate<String>
    Include list for config
    void
    contextChange(org.apache.kafka.common.metrics.MetricsContext metricsContext)
    Sets the metrics labels for the service or library exposing metrics.
    Domain of the active provider.
    The collector for Kafka Metrics library is enabled by default.
    The metrics include regular expression list used as a default value for this provider.
    io.opentelemetry.proto.resource.v1.Resource
    The resource for this provider.
    boolean
    validate(org.apache.kafka.common.metrics.MetricsContext metricsContext, Map<String,?> config)
    Validate that all the data required for generating correct metrics is present.

    Methods inherited from interface org.apache.kafka.common.Configurable

    configure
  • Field Details

  • Method Details

    • validate

      boolean validate(org.apache.kafka.common.metrics.MetricsContext metricsContext, Map<String,?> config)
      Validate that all the data required for generating correct metrics is present. The provider will be disabled if validation fails.
      Parameters:
      metricsContext - MetricsContext
      Returns:
      false if all the data required for generating correct metrics is missing, true otherwise.
    • domain

      String domain()
      Domain of the active provider. This is used by other parts of the reporter.
      Returns:
      Domain in string format.
    • resource

      io.opentelemetry.proto.resource.v1.Resource resource()
      The resource for this provider.
      Returns:
      A fully formed Resource will all the tags.
    • contextChange

      void contextChange(org.apache.kafka.common.metrics.MetricsContext metricsContext)
      Sets the metrics labels for the service or library exposing metrics. This will be called before MetricsReporter.init(List) and may be called anytime after that.
      Parameters:
      metricsContext - MetricsContext
    • metricsIncludeRegexDefault

      List<String> metricsIncludeRegexDefault()
      The metrics include regular expression list used as a default value for this provider. This list will be joined as following '.*.*|.*.*' to form a union.
      Returns:
      a list of regular expressions to match metric names
    • extraCollectors

      default List<MetricsCollector> extraCollectors(Context ctx)
      The collector for Kafka Metrics library is enabled by default. If you need any more, add them here.
      Parameters:
      ctx - Context
      Returns:
      List of extra collectors
    • configInclude

      default Predicate<String> configInclude()
      Include list for config
      Returns:
      Regex for filtering config keys.