Class SchemaManagementRequestTypeMetrics

java.lang.Object
io.confluent.kafka.odyssey.SchemaManagementRequestTypeMetrics
All Implemented Interfaces:
AutoCloseable

public class SchemaManagementRequestTypeMetrics extends Object implements AutoCloseable
Per-request-type SLO metrics for Schema Management. Each Meter/Histogram is registered with a {request_type=*} tag and kept in an EnumMap<RequestType, ...> for lookup; tag value is the lowercased enum name. Counting unit is per-request: a batch of N topics produces one RequestsPerSec mark and (if any topic carries a Schema Management-attributable failure) one FailedRequestsPerSec mark — see recordFailedRequest(SchemaManagementRequestTypeMetrics.RequestType).

Thread Safety: this class is thread-safe. Meters and Histograms from the Yammer library are safe to call from multiple threads; the per-request-type EnumMaps are populated once in the constructor and read concurrently afterwards. close() must be called after the last in-flight request completes.

  • Constructor Details

    • SchemaManagementRequestTypeMetrics

      public SchemaManagementRequestTypeMetrics()
  • Method Details

    • recordRequest

      public void recordRequest(SchemaManagementRequestTypeMetrics.RequestType requestType)
    • recordFailedRequest

      public void recordFailedRequest(SchemaManagementRequestTypeMetrics.RequestType requestType)
      Marks a request failed iff the merged response carries ≥1 topic with a Schema Management-attributable error — validation, association, LSRC lookup, token acquisition, or pipeline-level handling. Kafka-native rejections (TOPIC_AUTHORIZATION_FAILED, INVALID_REQUEST, etc.) do not count and are recorded elsewhere by the standard Kafka request metrics.
    • recordEndToEndLatency

      public void recordEndToEndLatency(SchemaManagementRequestTypeMetrics.RequestType requestType, long latencyMs)
    • recordOrphanedTopicCreated

      public void recordOrphanedTopicCreated()
      Fires when Kafka created the topic but the subsequent SR association call failed.
    • recordOrphanedAssociationDeleted

      public void recordOrphanedAssociationDeleted()
      Fires when SR association removal succeeded but the subsequent Kafka delete failed.
    • recordOrphanedAssociationDeleted

      public void recordOrphanedAssociationDeleted(long count)
    • recordPartialAlterConfigsApply

      public void recordPartialAlterConfigsApply(long count)
      Fires when IncrementalAlterConfigs committed a resource's non-association config changes to the controller but the subsequent Schema Registry association update failed — a partial apply the failed per-resource response does not reveal (there is no rollback). count is the number of such resources in the request; association-only failures commit nothing on the Kafka side and are not counted here.
    • recordTopicsPerRequest

      public void recordTopicsPerRequest(SchemaManagementRequestTypeMetrics.RequestType requestType, int topicCount)
    • recordTopicClassified

      public void recordTopicClassified(SchemaManagementRequestTypeMetrics.RequestType requestType, boolean withAssociations)
      Marks one topic encountered by requestType. withAssociations=true means the topic carried Schema Management association configs (create) or has associations in SR (delete/describe).
    • recordTopicClassified

      public void recordTopicClassified(SchemaManagementRequestTypeMetrics.RequestType requestType, boolean withAssociations, long count)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable