Package ai.signalroom.kafka.isotope
Class IsotopeMetrics
java.lang.Object
ai.signalroom.kafka.isotope.IsotopeMetrics
Static facade that routes isotope metric emissions to a registered
IsotopeMetricsSink. This is the seam that keeps kafka-isotope-core
free of any metrics dependency: IsotopeProducerInterceptor and
IsotopeContext call these static methods unconditionally, and they
delegate to whatever sink is installed.
Default and registration
The default sink isNoOpMetricsSink — isEnabled() is
false and every record* call is inert, so propagation works
with zero metrics overhead. The optional kafka-isotope-metrics module's
PrometheusIsotopeMetrics calls register(IsotopeMetricsSink)
when its exporter binds, after which emissions flow to Micrometer/Prometheus.
The historic contract is preserved: emission is a no-op until a sink that
reports isEnabled() is registered, so
the interceptor may call recordHop(java.lang.String, java.lang.String, java.lang.String, java.lang.String, long, int) unguarded on every send.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue once a recording sink is installed; gates emission inrecordHop(java.lang.String, java.lang.String, java.lang.String, java.lang.String, long, int).static voidrecordConsume(String pipeline, String originService, String consumerService, String thisTopic, long latencyMs) static voidrecordConsumeAge(String pipeline, String originService, String consumerService, String thisTopic, long ageMs) static voidrecordHop(String pipeline, String originService, String thisService, String thisTopic, long latencyMs, int hopCount) static voidregister(IsotopeMetricsSink newSink) Installs the active sink.static voidreset()Restores the no-op sink.static IsotopeMetricsSinksink()The currently installed sink (nevernull).
-
Method Details
-
register
Installs the active sink. Passingnullrestores the no-op sink. Called bykafka-isotope-metricswhen its exporter starts. -
reset
public static void reset()Restores the no-op sink. Primarily for tests and exporter shutdown. -
sink
The currently installed sink (nevernull). -
isEnabled
public static boolean isEnabled()True once a recording sink is installed; gates emission inrecordHop(java.lang.String, java.lang.String, java.lang.String, java.lang.String, long, int). -
recordHop
public static void recordHop(String pipeline, String originService, String thisService, String thisTopic, long latencyMs, int hopCount) - See Also:
-
recordConsume
public static void recordConsume(String pipeline, String originService, String consumerService, String thisTopic, long latencyMs) - See Also:
-
recordConsumeAge
public static void recordConsumeAge(String pipeline, String originService, String consumerService, String thisTopic, long ageMs) - See Also:
-