public abstract class AbstractContextualMonitor<T,M extends Monitor<T>> extends java.lang.Object implements CompositeMonitor<T>
Modifier and Type | Field and Description |
---|---|
protected MonitorConfig |
baseConfig
Base configuration shared across all contexts.
|
protected TaggingContext |
context
Context to query when accessing a monitor.
|
protected java.util.concurrent.ConcurrentMap<MonitorConfig,M> |
monitors
Thread-safe map keeping track of the distinct monitors that have been created so far.
|
protected com.google.common.base.Function<MonitorConfig,M> |
newMonitor
Factory funtion used to create a new instance of a monitor.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractContextualMonitor(MonitorConfig baseConfig,
TaggingContext context,
com.google.common.base.Function<MonitorConfig,M> newMonitor)
Create a new instance of the monitor.
|
Modifier and Type | Method and Description |
---|---|
MonitorConfig |
getConfig()
Configuration used to identify a monitor and provide metadata used in aggregations.
|
protected M |
getMonitorForCurrentContext()
Returns a monitor instance for the current context.
|
java.util.List<Monitor<?>> |
getMonitors()
Returns a list of sub-monitors for this composite.
|
T |
getValue()
Returns the current value for the monitor for the default polling interval.
|
protected final MonitorConfig baseConfig
protected final TaggingContext context
protected final com.google.common.base.Function<MonitorConfig,M extends Monitor<T>> newMonitor
protected final java.util.concurrent.ConcurrentMap<MonitorConfig,M extends Monitor<T>> monitors
protected AbstractContextualMonitor(MonitorConfig baseConfig, TaggingContext context, com.google.common.base.Function<MonitorConfig,M> newMonitor)
baseConfig
- shared configurationcontext
- provider for context specific tagsnewMonitor
- function to create new monitorspublic T getValue()
protected M getMonitorForCurrentContext()
public MonitorConfig getConfig()
public java.util.List<Monitor<?>> getMonitors()
getMonitors
in interface CompositeMonitor<T>