com.transferwise.envoy.xds.api.DiscoveryServiceManagerMetrics Maven / Gradle / Ivy
package com.transferwise.envoy.xds.api;
import java.util.function.Supplier;
/**
* Records metrics about state update latencies for Envoy clients.
*
* One instance will be instantiated per discovery stream.
* Thread safety: unsafe! The caller must make sure synchronization happens.
* The synchronization implemented by caller may only extend to the specific instance
* but not globally over all instances. So the implementation must arrange any internal
* synchronization to a shared metric storage, if needed.
*
*/
public interface DiscoveryServiceManagerMetrics {
DiscoveryServiceManagerMetrics NOOP_METRICS = new NoopMetrics();
Supplier METRICS_DISABLED = () -> NOOP_METRICS;
default void close() {
}
/**
* This is called when we begin pushing messages generated by a state update towards a client.
* onPushBegin() and onPushComplete() must be called in pairs, and must not be called after close().
*/
default void onPushBegin() {
}
/**
* This is called once client has acked all of the messages sent to it for a state update.
* onPushBegin() and onPushComplete() must be called in pairs, and must not be called after close().
*/
default void onPushComplete() {
}
/**
* This is called when a discovery service is expecting an ack.
*/
default void onAwaitingAck() {
}
/**
* This is called when envoy acks an outstanding message.
*/
default void onMessageAcked() {
}
class NoopMetrics implements DiscoveryServiceManagerMetrics {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy