Class SchemaManagementDependencyMetrics

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

public class SchemaManagementDependencyMetrics extends Object implements AutoCloseable
Per-dependency drill-down metrics: CallsPerSec (Meter), LatencyMs (Histogram), ErrorsPerSec (Meter). SchemaManagementDependencyMetrics.Stage and SchemaManagementDependencyMetrics.Outcome tag values are the lowercased enum name; SchemaManagementDependencyMetrics.Target and SchemaManagementDependencyMetrics.ErrorClass tag values are explicit human-readable strings.

An instance registers only the pairs for the SchemaManagementDependencyMetrics.Targets it is constructed to own, so the SchemaManagementDependency surface can be split across the components that record into it.

Valid (target, stage) combinations:

  • resource_manager: resolve
  • token_platform: token
  • schema_registry: validate, associate, delete_assoc, update_assoc, fetch

Error classification: ErrorsPerSec carries a single error_class tag — client_error (dependency responded with a 4xx — request rejected), server_error (dependency responded with a 5xx), or unavailable (no usable response — timeout / transport failure). The exact upstream error code is not a metric tag; it is emitted on the structured log line at the call site. SR codes are mapped by HTTP-status family via SchemaManagementDependencyMetrics.ErrorClass.fromSrCode(int).

Cardinality: every meter is registered eagerly at construction for the owned (target, stage) pairs — calls (× SchemaManagementDependencyMetrics.Outcome), latency, and errors (× SchemaManagementDependencyMetrics.ErrorClass). Because error_class is a fixed 3-value set, the JMX surface is bounded by construction: no caps, no lazy registration, no overflow meter.

Granularity: CallsPerSec is per-call (one mark per SR/RM/TP call, regardless of batch size). ErrorsPerSec for SR stages records one mark per failing topic (or per topic in the batch when the whole call fails); RM and TP record one mark per failing call. So ErrorsPerSec / CallsPerSec is not a meaningful ratio — the per-call failure rate is FAILURE-tagged CallsPerSec / CallsPerSec.

Thread Safety: recordCall(SchemaManagementDependencyMetrics.Target, SchemaManagementDependencyMetrics.Stage, SchemaManagementDependencyMetrics.Outcome), recordLatency(SchemaManagementDependencyMetrics.Target, SchemaManagementDependencyMetrics.Stage, long), and recordError(SchemaManagementDependencyMetrics.Target, SchemaManagementDependencyMetrics.Stage, SchemaManagementDependencyMetrics.ErrorClass) are safe to call concurrently — all meters are registered at construction and the maps are read-only thereafter. close() must be called only after the last in-flight request has completed; the owning component closes this only after its recording paths (executor / RM client) have stopped.