Package com.nt.udc.util.misc.metrics
Class MetricsService
java.lang.Object
com.nt.udc.util.misc.metrics.MetricsService
This class creates a Prometheus registry and http metrics service endpoint
that can be scraped for ECE application, Coherence, JVM, and system metrics.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTag name to use to distinguish between application components.static final StringDefault por the metrics HTTP server will listen on.static final StringProperty used to configure the HTTP Metrics port.static final StringProperty used to control if the metric server is enabled (true) or disabled.static final StringDefault property used to indicate if the HTTP Metric server is enabled.static final StringHTTP path that metrics will be served on. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates thePrometheusMeterRegistryand binds the following component metrics to it so they are also provided when the service is scraped.intGet the metrics http port the service is running on.booleanGet the enabled status of this metrics service.setApplicationRole(String applicationName) Add the Application tag to the registry.setCommonTags(List<io.micrometer.core.instrument.Tag> tagList) Adds a list of Common Tags to the registry.setCommonTags(Map<String, String> tagMap) voidsetNM(com.nt.udc.nodemgr.OSANodeMgr inNM) booleanStarts the ECE Prometheus metrics service endpoint which provides metrics from the ECE application and other components using a common Prometheus registry.
-
Field Details
-
METRICS_SERVICE_PATH
HTTP path that metrics will be served on.- See Also:
-
METRICS_HTTP_PORT_DEFAULT
Default por the metrics HTTP server will listen on.- See Also:
-
METRICS_HTTP_PORT_PROPERTY_NAME
Property used to configure the HTTP Metrics port.- See Also:
-
METRICS_SERVICE_ENABLED_DEFAULT
Default property used to indicate if the HTTP Metric server is enabled.- See Also:
-
METRICS_HTTP_SERVICE_ENABLED_PROPERTY_NAME
Property used to control if the metric server is enabled (true) or disabled.- See Also:
-
METRICS_APPLICATION_ROLE_TAG
Tag name to use to distinguish between application components.- See Also:
-
-
Constructor Details
-
MetricsService
public MetricsService()Public default constructor.
-
-
Method Details
-
setCommonTags
Adds a list of Common Tags to the registry. All metrics will include these tags.- Parameters:
tagList-Listof Tags to apply to all metrics.- Returns:
- the metric service
-
setApplicationRole
Add the Application tag to the registry. This will be added to all metrics.- Parameters:
applicationName- name of the application- Returns:
- the metric service
-
setCommonTags
-
setCommonTags
-
bindAllMetrics
Creates thePrometheusMeterRegistryand binds the following component metrics to it so they are also provided when the service is scraped. 1) Coherence Metrics 2) JVM GC Metrics 3) JVM Thread Metrics 4) Processor Metrics- Returns:
- This
MetricsServiceinstance.
-
startMetricsHttpService
public boolean startMetricsHttpService()Starts the ECE Prometheus metrics service endpoint which provides metrics from the ECE application and other components using a common Prometheus registry.- Returns:
- True if the service is started or already started. False if the configuration property ece.metrics.http.service.enabled is false or the service fails to start.
-
getMetricsHttpPort
public int getMetricsHttpPort()Get the metrics http port the service is running on.- Returns:
- The configured http port
-
isMetricsHttpServiceEnabled
public boolean isMetricsHttpServiceEnabled()Get the enabled status of this metrics service.- Returns:
- true if the service is enabled, false otherwise.
-
setNM
public void setNM(com.nt.udc.nodemgr.OSANodeMgr inNM) -
setLogger
-