public interface MonitorService
| Modifier and Type | Method and Description |
|---|---|
<T extends Monitor> |
get(java.lang.Class<T> monitorClass,
java.lang.Object key)
Gets the monitor stored at the given key.
|
<T extends Monitor> |
registerMonitorTypeIfAbsent(java.lang.Class<T> monitorClass,
long expirationTimeoutNanos,
long heartbeatTimeoutNanos,
java.util.Set<MonitorErrorResponse> errorResponses,
@Nullable java.lang.Class<?> producedDataClass)
Registers a new monitor type with the monitor service.
|
void |
releaseResources()
Releases any resources opened by the monitor service, stops all monitors, and removes all monitors from the monitor
service.
|
<T extends Monitor> |
remove(java.lang.Class<T> monitorClass,
java.lang.Object key)
Removes the monitor stored at the given key.
|
<T extends Monitor> |
runIfAbsent(java.lang.Class<T> monitorClass,
java.lang.Object key,
StorageService storageService,
TelemetryFactory telemetryFactory,
java.lang.String originalUrl,
java.lang.String driverProtocol,
TargetDriverDialect driverDialect,
Dialect dbDialect,
java.util.Properties originalProps,
MonitorInitializer initializer)
Creates and starts the given monitor if it does not already exist and stores it under the given monitor type and
key.
|
<T extends Monitor> |
stopAndRemove(java.lang.Class<T> monitorClass,
java.lang.Object key)
Stops the given monitor and removes it from the monitor service.
|
void |
stopAndRemoveAll()
Stops all monitors and removes them from the monitor service.
|
<T extends Monitor> |
stopAndRemoveMonitors(java.lang.Class<T> monitorClass)
Stops all monitors for the given type and removes them from the monitor service.
|
<T extends Monitor> void registerMonitorTypeIfAbsent(java.lang.Class<T> monitorClass, long expirationTimeoutNanos, long heartbeatTimeoutNanos, java.util.Set<MonitorErrorResponse> errorResponses, @Nullable java.lang.Class<?> producedDataClass)
T - the type of the monitor.monitorClass - the class of the monitor, eg `CustomEndpointMonitorImpl.class`.expirationTimeoutNanos - how long a monitor should be stored without use before being considered expired, in
nanoseconds. Expired monitors may be removed and stopped.heartbeatTimeoutNanos - a duration in nanoseconds defining the maximum amount of time that a monitor should
take between updating its last-updated timestamp. If a monitor has not updated its
last-updated timestamp within this duration it will be considered stuck.errorResponses - a Set defining actions to take if the monitor is stuck or in an error state.producedDataClass - the class of data produced by the monitor.<T extends Monitor> T runIfAbsent(java.lang.Class<T> monitorClass, java.lang.Object key, StorageService storageService, TelemetryFactory telemetryFactory, java.lang.String originalUrl, java.lang.String driverProtocol, TargetDriverDialect driverDialect, Dialect dbDialect, java.util.Properties originalProps, MonitorInitializer initializer) throws java.sql.SQLException
T - the type of the monitor.monitorClass - the concrete class of the monitor, eg `CustomEndpointMonitorImpl.class`.key - the key for the monitor, eg
"custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".storageService - the storage service for the monitor to use.telemetryFactory - the telemetry factory for creating telemetry data.originalUrl - the URL of the original database connection.driverProtocol - the protocol for the underlying target driver.driverDialect - the target driver dialect.dbDialect - the database dialect.originalProps - the properties of the original database connection.initializer - an initializer function to use to create the monitor if it does not already exist.java.sql.SQLException - if an error occurs while trying to create the monitor.<T extends Monitor> T get(java.lang.Class<T> monitorClass, java.lang.Object key)
T - the type of the monitor.monitorClass - the expected class of the monitor.key - the key for the monitor.<T extends Monitor> T remove(java.lang.Class<T> monitorClass, java.lang.Object key)
T - the type of the monitor.monitorClass - the expected class of the monitor.key - the key for the monitor.<T extends Monitor> void stopAndRemove(java.lang.Class<T> monitorClass, java.lang.Object key)
T - the type of the monitor.monitorClass - the class of the monitor, eg `CustomEndpointMonitorImpl.class`.key - the key for the monitor, eg
"custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".<T extends Monitor> void stopAndRemoveMonitors(java.lang.Class<T> monitorClass)
T - the type of the monitor.monitorClass - the class of the monitor, eg `CustomEndpointMonitorImpl.class`.void stopAndRemoveAll()
void releaseResources()