B
- The type of local backend associated with this monitor.public class LocalBackendMonitor<B extends LocalBackend<?>> extends MonitorProvider
Sub-classes may override addAdditionalMetrics()
in order to add implementation specific
monitoring metrics.
registry
Constructor and Description |
---|
LocalBackendMonitor(B backend)
Creates a new instance of this backend monitor provider that will work with the provided backend.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAdditionalMetrics()
Adds additional metrics specific to the local backend implementation
in this monitor provider's
MeterRegistry . |
protected void |
addMonitorObjectClassNames(Attribute ocAttr)
Adds to the provided attribute the objectclass names that should be included in the monitor entry created from
this monitor provider.
|
void |
bindTo(MeterRegistry parent)
.
|
protected Dn |
computeMonitorInstanceDn()
Returns the monitor instance DN for this monitor provider.
|
void |
deregisterBaseDnMonitors()
Deregisters monitoring entries associated to the base DNs handled by the monitored backend
in the directory server.
|
protected String |
getBackendType()
Returns the local backend implementation type.
|
protected B |
getLocalBackend()
Returns the local backend associated with this backend.
|
void |
registerBaseDnMonitors()
Registers monitoring entries associated to the base DNs handled by the monitored backend in the directory server.
|
void |
updateBaseDnMonitors()
Updates the list of monitoring entries associated to the base DNs handled by the monitored backend
in the directory server.
|
configurationDnToMonitorDn, deregisterAll, getMonitorEntry, getMonitorInstanceDn, toString
public LocalBackendMonitor(B backend)
backend
- The backend with which this monitor is associated.protected final Dn computeMonitorInstanceDn()
MonitorProvider
computeMonitorInstanceDn
in class MonitorProvider
protected void addMonitorObjectClassNames(Attribute ocAttr)
MonitorProvider
addMonitorObjectClassNames
in class MonitorProvider
ocAttr
- the objectClass attribute where to add the object class namespublic final void bindTo(MeterRegistry parent)
MonitorProvider
Implementations MUST set the MonitorProvider.registry
field by creating a new MeterRegistryHolder
, and
specifying the appropriate prefix for the dimensional model and also the hierarchical model if they are
different. This can be done using a parameter on the constructor, or the
MeterRegistryHolder.hierarchicalNamePrefix(String)
method. Tags common to all metrics for this monitor
provider can also be set using the MeterRegistryHolder.tag(String, String)
method.
Attribute names are then registered by calling factory methods on the MonitorProvider.registry
field.
(Please remove the comments when using this code as a template)
public void bindTo(final MeterRegistry parent) {
// create the MeterRegistryHolder wrapping OpenDJ's MeterRegistry
registry = new MeterRegistryHolder("dimensional-name-prefix", parent)
.tag("label", "dimension")
.hierarchicalNamePrefix("hierarchical-name-prefix.dimension");
// register the metrics against the wrapper
registry.numberGauge("gauge", numberSupplier); // use lambdas or method references here
timer = registry.timer("requests-submitted");
// set a different name for the metric in cn=monitor, dimensional model and hierarchical model
Gauge.doubleGauge(dimensionalName, supplier)
.hierarchicalName(hierarchicalName)
.tag(MeterRegistryHolder.TAG_ATTRIBUTE_NAME, "cn-monitor-name") // drop the "ds-mon-" prefix here
.register(registry);
// this gauge will only output to cn=monitor based monitoring endpoints
registry.monitoringGauge("only-visible-in-cn-monitor", supplier);
}
bindTo
in interface MeterBinder
bindTo
in class MonitorProvider
protected String getBackendType()
MeterRegistry
representing the local backend type.protected void addAdditionalMetrics()
MeterRegistry
.
The default implementation is to do nothing.
protected final B getLocalBackend()
public final void registerBaseDnMonitors()
public final void deregisterBaseDnMonitors()
public final void updateBaseDnMonitors()
Copyright 2010-2022 ForgeRock AS.