Class MetricsExtractorRestClient
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.metricsProvider.metricsAas.MetricsExtractorRestClient
-
public class MetricsExtractorRestClient extends java.lang.ObjectClass that implements a REST client to retrieve the Meters from the Metrics Provider.
This class contains the method implementations to send different requests to the Metrics Provider. Apart from having a method that sends a GET request to retrieve all the metrics exposed by the Metrics Provider, it also has a series of methods that allows as to update or create a custom meter from the Metrics provider as well as methods to delete it. This methods should always be used to retrieve the values instead of using another REST client.
The methods that follow the IIP-Ecosphere AAS signature do not check the validity of their arguments. Part of this is checked by the IIP-Ecosphere framework and the other part by the Metrics Provider REST Service.- Author:
- Miguel Gomez
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringACTION_MAJORprivate static java.lang.StringACTION_MINORprivate static java.lang.StringAREA_HEAPprivate static java.lang.StringAREA_NONHEAPprivate static java.lang.StringCAUSEprivate static java.lang.StringCAUSE_FAILUREprivate static java.lang.StringCONFIG_DISK_BASE_UNITprivate static java.lang.StringCONFIG_MEMORY_BASE_UNITprivate static java.lang.StringCOUNTERS_ENDPOINTprivate static java.lang.StringGAUGES_ENDPOINTprivate static java.lang.StringID_CODE_CACHEprivate static java.lang.StringID_COMPRESSED_CLASS_SPACEprivate static java.lang.StringID_DIRECTprivate static java.lang.StringID_EDEN_SPACEprivate static java.lang.StringID_MAPPEDprivate static java.lang.StringID_METASPACEprivate static java.lang.StringID_OLD_GENprivate static java.lang.StringID_SURVIVOR_SPACEprivate static java.lang.StringLEVEL_DEBUGprivate static java.lang.StringLEVEL_ERRORprivate static java.lang.StringLEVEL_INFOprivate static java.lang.StringLEVEL_TRACEprivate static java.lang.StringLEVEL_WARNprivate static java.lang.StringPROTOCOLprivate static java.lang.StringSIMPLE_ENDPOINTprivate static java.lang.StringSTATE_BLOCKEDprivate static java.lang.StringSTATE_NEWprivate static java.lang.StringSTATE_RUNNABLEprivate static java.lang.StringSTATE_TERMINATEDprivate static java.lang.StringSTATE_TIMED_WAITINGprivate static java.lang.StringSTATE_WAITINGprivate static java.lang.StringTAGGED_ENDPOINTprivate static java.lang.StringTIMERS_ENDPOINTprivate javax.ws.rs.client.WebTargetwebTarget
-
Constructor Summary
Constructors Constructor Description MetricsExtractorRestClient(java.lang.String hostAddr, int portNo)Initializes a new Metrics Extractor REST Client.
Once the instance is created, the Client will have a Web Resource that will be the connection point to the server hosting the Metrics Provider REST Service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectdeleteCustomCounter(java.lang.Object[] args)Deletes a Custom Counter using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints.java.lang.ObjectdeleteCustomGauge(java.lang.Object[] args)Deletes a Custom Gauge using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints.java.lang.ObjectdeleteCustomTimer(java.lang.Object[] args)Deletes a Custom Timer using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints.private java.lang.StringgetBufferMetric(java.lang.String name)Retrieves a buffer metric from the REST service.
The buffer metrics exposed by Micrometer use the same tags, so this method is created to avoid code repetition.java.lang.StringgetCounterList()Retrieves the list of custom counters registered in the Metrics Provider.java.lang.StringgetCustomCounter(java.lang.String name)Retrieves a custom counter.
All the metrics received are of typeMeterType#COUNTER.java.lang.StringgetCustomGauge(java.lang.String name)Retrieves a custom gauge.
All the metrics received are of typeMeterType#GAUGE.java.lang.StringgetCustomTimer(java.lang.String name)Retrieves a custom timer.
All the metrics received are of typeMeterType#TIMER.java.lang.StringgetGaugeList()Retrieves the list of custom gauges registered in the Metrics Provider.java.lang.StringgetJvmBufferCount()Retrieves the number of buffers from the JVM.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmBufferMemoryUsed()Retrieves the amount of buffer memory used by the JVM.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmBufferTotalCapacity()Retrieves the total capacity of the buffers from the JVM.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmClassesLoaded()Retrieves the number of classes loaded in the resource being monitored.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmClassesUnloaded()Retrieves the number of classes that has been unloaded from the JVM since execution started.
The metric received is of typeMeterType#COUNTER.java.lang.StringgetJvmGcLiveDataSize()Retrieves the live data size of the garbage collector from the process being monitored.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmGcMaxDataSize()Retrieves the max data size of the garbage collector from the process being monitored.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmGcMemoryAllocated()Retrieves the allocated memory of the garbage collector from the process being monitored.
The metric received is of typeMeterType#COUNTER.java.lang.StringgetJvmGcMemoryPromoted()Retrieves the amount the memory of the garbage collector from the process being monitored has been promoted.
The metric received is of typeMeterType#COUNTER.java.lang.StringgetJvmGcPause()Retrieves the timers for the Garbage Collector pause sorted by cause and action.
The metric received is of typeMeterType#TIMER.java.lang.StringgetJvmMemoryCommited()Retrieves the amount of committed memory from the JVM.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmMemoryMax()Retrieves the max memory from the JVM.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmMemoryUsed()Retrieves the amount of used memory from the JVM.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmThreadsDaemon()Retrieves the number of Daemon threads running in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmThreadsLive()Retrieves the number of live threads running in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmThreadsPeak()Retrieves the peak number of threads running in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetJvmThreadsStates()Retrieves the number of threads running in the resource sorted by state.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetLogbackEvents()Retrieves the count of logback events from the resource sorted by level.
The metric received is of typeMeterType#COUNTER.private java.lang.StringgetMemoryMetric(java.lang.String name)Retrieves a memory metric from the REST service.
The memory metrics exposed by Micrometer use the same tags, so this method is created to avoid code repetition.java.lang.StringgetProcessCpuUsage()Retrieves percentage of the CPU that the process is using.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetProcessStartTime()Retrieves the start time of the process being monitored.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetProcessUptime()Retrieves the total time the process being monitored has been running.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSimpleMeterList()Retrieves the list of non-tagged meters registered in the Metrics Provider.java.lang.StringgetSystemCpuCount()Retrieves the number of CPUs running in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemCpuUsage()Retrieves percentage of usage of the CPU running in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemDiskFree()Retrieves the free disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemDiskTotal()Retrieves the total disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemDiskUsable()Retrieves the usable disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemMemoryFree()Retrieves the amount of free physical memory in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemMemoryTotal()Retrieves the total amount of physical memory in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemMemoryUsage()Retrieves the percentage of usage of physical memory in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemMemoryUsed()Retrieves the amount of used physical memory in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetSystemsDiskUsed()Retrieves the used disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.java.lang.StringgetTaggedMeterList()Retrieves the list of tagged meters registered in the Metrics Provider.java.lang.StringgetTimerList()Retrieves the list of custom timers registered in the Metrics Provider.private voidsendDeleteRequest(java.lang.String endpoint, java.lang.String resource)Sends HTTP DELETE request to the REST service.
If the response is OK, the value will have been deleted from the corresponding custom metric map and deregistered from the Meter Registry.private java.lang.StringsendGetRequest(java.lang.String endpoint, java.lang.String resource, java.lang.String... tags)Sends an HTTP GET request to the REST Service.
The response body will be a String that can be parsed into a JsonObject if the response is OK.private voidsendPutRequest(java.lang.String endpoint, java.lang.String body)Sends an HTTP PUT request to the REST service.
If the response is OK, the value will have been added to the corresponding custom metric map.java.lang.ObjectsetDiskBaseUnit(java.lang.Object[] args)Updates the capacity base unit used for the system disk capacity metrics.
This method is "forced" to follow the AAS signature, so there are some constraints.java.lang.ObjectsetMemoryBaseUnit(java.lang.Object[] args)Updates the memory base unit used for the system physical memory metrics.
This method is "forced" to follow the AAS signature, so there are some constraints.java.lang.ObjectupdateCustomCounter(java.lang.Object[] args)Updates a Custom Counter using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints.java.lang.ObjectupdateCustomGauge(java.lang.Object[] args)Updates a Custom Gauge using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints.java.lang.ObjectupdateCustomTimer(java.lang.Object[] args)Updates a Custom Timer using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints.
-
-
-
Field Detail
-
PROTOCOL
private static final java.lang.String PROTOCOL
- See Also:
- Constant Field Values
-
SIMPLE_ENDPOINT
private static final java.lang.String SIMPLE_ENDPOINT
- See Also:
- Constant Field Values
-
TAGGED_ENDPOINT
private static final java.lang.String TAGGED_ENDPOINT
- See Also:
- Constant Field Values
-
COUNTERS_ENDPOINT
private static final java.lang.String COUNTERS_ENDPOINT
- See Also:
- Constant Field Values
-
GAUGES_ENDPOINT
private static final java.lang.String GAUGES_ENDPOINT
- See Also:
- Constant Field Values
-
TIMERS_ENDPOINT
private static final java.lang.String TIMERS_ENDPOINT
- See Also:
- Constant Field Values
-
CONFIG_MEMORY_BASE_UNIT
private static final java.lang.String CONFIG_MEMORY_BASE_UNIT
- See Also:
- Constant Field Values
-
CONFIG_DISK_BASE_UNIT
private static final java.lang.String CONFIG_DISK_BASE_UNIT
- See Also:
- Constant Field Values
-
AREA_HEAP
private static final java.lang.String AREA_HEAP
- See Also:
- Constant Field Values
-
ID_SURVIVOR_SPACE
private static final java.lang.String ID_SURVIVOR_SPACE
- See Also:
- Constant Field Values
-
ID_OLD_GEN
private static final java.lang.String ID_OLD_GEN
- See Also:
- Constant Field Values
-
ID_EDEN_SPACE
private static final java.lang.String ID_EDEN_SPACE
- See Also:
- Constant Field Values
-
AREA_NONHEAP
private static final java.lang.String AREA_NONHEAP
- See Also:
- Constant Field Values
-
ID_METASPACE
private static final java.lang.String ID_METASPACE
- See Also:
- Constant Field Values
-
ID_CODE_CACHE
private static final java.lang.String ID_CODE_CACHE
- See Also:
- Constant Field Values
-
ID_COMPRESSED_CLASS_SPACE
private static final java.lang.String ID_COMPRESSED_CLASS_SPACE
- See Also:
- Constant Field Values
-
STATE_RUNNABLE
private static final java.lang.String STATE_RUNNABLE
- See Also:
- Constant Field Values
-
STATE_BLOCKED
private static final java.lang.String STATE_BLOCKED
- See Also:
- Constant Field Values
-
STATE_WAITING
private static final java.lang.String STATE_WAITING
- See Also:
- Constant Field Values
-
STATE_TIMED_WAITING
private static final java.lang.String STATE_TIMED_WAITING
- See Also:
- Constant Field Values
-
STATE_NEW
private static final java.lang.String STATE_NEW
- See Also:
- Constant Field Values
-
STATE_TERMINATED
private static final java.lang.String STATE_TERMINATED
- See Also:
- Constant Field Values
-
ID_DIRECT
private static final java.lang.String ID_DIRECT
- See Also:
- Constant Field Values
-
ID_MAPPED
private static final java.lang.String ID_MAPPED
- See Also:
- Constant Field Values
-
LEVEL_WARN
private static final java.lang.String LEVEL_WARN
- See Also:
- Constant Field Values
-
LEVEL_DEBUG
private static final java.lang.String LEVEL_DEBUG
- See Also:
- Constant Field Values
-
LEVEL_ERROR
private static final java.lang.String LEVEL_ERROR
- See Also:
- Constant Field Values
-
LEVEL_TRACE
private static final java.lang.String LEVEL_TRACE
- See Also:
- Constant Field Values
-
LEVEL_INFO
private static final java.lang.String LEVEL_INFO
- See Also:
- Constant Field Values
-
CAUSE
private static final java.lang.String CAUSE
- See Also:
- Constant Field Values
-
CAUSE_FAILURE
private static final java.lang.String CAUSE_FAILURE
- See Also:
- Constant Field Values
-
ACTION_MAJOR
private static final java.lang.String ACTION_MAJOR
- See Also:
- Constant Field Values
-
ACTION_MINOR
private static final java.lang.String ACTION_MINOR
- See Also:
- Constant Field Values
-
webTarget
private javax.ws.rs.client.WebTarget webTarget
-
-
Constructor Detail
-
MetricsExtractorRestClient
public MetricsExtractorRestClient(java.lang.String hostAddr, int portNo)Initializes a new Metrics Extractor REST Client.
Once the instance is created, the Client will have a Web Resource that will be the connection point to the server hosting the Metrics Provider REST Service.- Parameters:
hostAddr- inet address of the host that has the REST serviceportNo- port number were the REST service is hosted on the server- Throws:
java.lang.IllegalArgumentException- if the host address is empty or if the port number is negative
-
-
Method Detail
-
sendGetRequest
private java.lang.String sendGetRequest(java.lang.String endpoint, java.lang.String resource, java.lang.String... tags)Sends an HTTP GET request to the REST Service.
The response body will be a String that can be parsed into a JsonObject if the response is OK.- Parameters:
endpoint- endpoint where the resource isresource- resource we want to retrievetags- tags that the resource has (if any)- Returns:
- response body of the GET request
-
sendPutRequest
private void sendPutRequest(java.lang.String endpoint, java.lang.String body)Sends an HTTP PUT request to the REST service.
If the response is OK, the value will have been added to the corresponding custom metric map.- Parameters:
endpoint- endpoint where the request is sentbody- request body- Throws:
java.lang.IllegalArgumentException- if the request body causes an error in the server
-
sendDeleteRequest
private void sendDeleteRequest(java.lang.String endpoint, java.lang.String resource)Sends HTTP DELETE request to the REST service.
If the response is OK, the value will have been deleted from the corresponding custom metric map and deregistered from the Meter Registry.- Parameters:
endpoint- endpoint where the request is sentresource- resource we want to delete- Throws:
java.lang.IllegalStateException- if the deletion is not possible at the requested moment, returning an error code from the server
-
getJvmBufferCount
public java.lang.String getJvmBufferCount()
Retrieves the number of buffers from the JVM.
The metric received is of typeMeterType#GAUGE. The Gauges will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Gauges of the number of buffers from the JVM sorted by id
-
getJvmBufferMemoryUsed
public java.lang.String getJvmBufferMemoryUsed()
Retrieves the amount of buffer memory used by the JVM.
The metric received is of typeMeterType#GAUGE. The Gauges will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Gauges of the buffer memory used by the JVM sorted by id
-
getJvmBufferTotalCapacity
public java.lang.String getJvmBufferTotalCapacity()
Retrieves the total capacity of the buffers from the JVM.
The metric received is of typeMeterType#GAUGE. The Gauges will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Gauges of the total buffer capacity of the JVM sorted by id
-
getJvmClassesLoaded
public java.lang.String getJvmClassesLoaded()
Retrieves the number of classes loaded in the resource being monitored.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of loaded classes
-
getJvmClassesUnloaded
public java.lang.String getJvmClassesUnloaded()
Retrieves the number of classes that has been unloaded from the JVM since execution started.
The metric received is of typeMeterType#COUNTER.- Returns:
- a JsonObject representing the Counter of unloaded classes
-
getJvmGcLiveDataSize
public java.lang.String getJvmGcLiveDataSize()
Retrieves the live data size of the garbage collector from the process being monitored.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of GC live data size
-
getJvmGcMaxDataSize
public java.lang.String getJvmGcMaxDataSize()
Retrieves the max data size of the garbage collector from the process being monitored.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of GC max data size
-
getJvmGcMemoryAllocated
public java.lang.String getJvmGcMemoryAllocated()
Retrieves the allocated memory of the garbage collector from the process being monitored.
The metric received is of typeMeterType#COUNTER.- Returns:
- a JsonObject representing the Counter of GC allocated memory
-
getJvmGcMemoryPromoted
public java.lang.String getJvmGcMemoryPromoted()
Retrieves the amount the memory of the garbage collector from the process being monitored has been promoted.
The metric received is of typeMeterType#COUNTER.- Returns:
- a JsonObject representing the Counter of GC promoted memory
-
getJvmGcPause
public java.lang.String getJvmGcPause()
Retrieves the timers for the Garbage Collector pause sorted by cause and action.
The metric received is of typeMeterType#TIMER. The Timers will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Timers of the GC pause
-
getJvmMemoryCommited
public java.lang.String getJvmMemoryCommited()
Retrieves the amount of committed memory from the JVM.
The metric received is of typeMeterType#GAUGE. The Gauges will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Gauges of the amount of commited JVM memory sorted by area and id
-
getJvmMemoryMax
public java.lang.String getJvmMemoryMax()
Retrieves the max memory from the JVM.
The metric received is of typeMeterType#GAUGE. The Gauges will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Gauges of the max JVM memory sorted by area and id
-
getJvmMemoryUsed
public java.lang.String getJvmMemoryUsed()
Retrieves the amount of used memory from the JVM.
The metric received is of typeMeterType#GAUGE. The Gauges will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Gauges of the amount of used JVM memory sorted by area and id
-
getJvmThreadsDaemon
public java.lang.String getJvmThreadsDaemon()
Retrieves the number of Daemon threads running in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of Daemon threads
-
getJvmThreadsLive
public java.lang.String getJvmThreadsLive()
Retrieves the number of live threads running in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of live threads
-
getJvmThreadsPeak
public java.lang.String getJvmThreadsPeak()
Retrieves the peak number of threads running in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of peak threads
-
getJvmThreadsStates
public java.lang.String getJvmThreadsStates()
Retrieves the number of threads running in the resource sorted by state.
The metric received is of typeMeterType#GAUGE. The Gauges will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Gauges of the number of threads sorted by state
-
getLogbackEvents
public java.lang.String getLogbackEvents()
Retrieves the count of logback events from the resource sorted by level.
The metric received is of typeMeterType#COUNTER. The Counters will be arranged in a JsonArray of JsonObjects. Said objects have a first attribute indicating the used tags and the second attribute will have the JsonObject that was retrieved from the REST service.- Returns:
- a JsonArray representing the set of Counters of the count of logback events sorted by level
-
getProcessCpuUsage
public java.lang.String getProcessCpuUsage()
Retrieves percentage of the CPU that the process is using.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of process CPU usage
-
getProcessStartTime
public java.lang.String getProcessStartTime()
Retrieves the start time of the process being monitored.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of process start time
-
getProcessUptime
public java.lang.String getProcessUptime()
Retrieves the total time the process being monitored has been running.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of process uptime
-
getSystemCpuCount
public java.lang.String getSystemCpuCount()
Retrieves the number of CPUs running in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of CPU count
-
getSystemCpuUsage
public java.lang.String getSystemCpuUsage()
Retrieves percentage of usage of the CPU running in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of system CPU usage
-
getSystemDiskFree
public java.lang.String getSystemDiskFree()
Retrieves the free disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of free disk space
-
getSystemDiskTotal
public java.lang.String getSystemDiskTotal()
Retrieves the total disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of total disk space
-
getSystemDiskUsable
public java.lang.String getSystemDiskUsable()
Retrieves the usable disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of usable disk space
-
getSystemsDiskUsed
public java.lang.String getSystemsDiskUsed()
Retrieves the used disk capacity in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of used disk space
-
getSystemMemoryFree
public java.lang.String getSystemMemoryFree()
Retrieves the amount of free physical memory in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of free physical memory
-
getSystemMemoryTotal
public java.lang.String getSystemMemoryTotal()
Retrieves the total amount of physical memory in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of total physical memory
-
getSystemMemoryUsage
public java.lang.String getSystemMemoryUsage()
Retrieves the percentage of usage of physical memory in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of usage of physical memory
-
getSystemMemoryUsed
public java.lang.String getSystemMemoryUsed()
Retrieves the amount of used physical memory in the resource.
The metric received is of typeMeterType#GAUGE.- Returns:
- a JsonObject representing the Gauge of used physical memory
-
getCustomGauge
public java.lang.String getCustomGauge(java.lang.String name)
Retrieves a custom gauge.
All the metrics received are of typeMeterType#GAUGE.- Parameters:
name- URN of the custom gauge- Returns:
- a JsonObject representing the requested Custom Gauge
-
updateCustomGauge
public java.lang.Object updateCustomGauge(java.lang.Object[] args)
Updates a Custom Gauge using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringthat will represent the body of the HTTP PUT request. Said body corresponds to the JsonObject provided byGaugeRepresentation.getUpdater()- Parameters:
args- object array containing the body of the PUT request- Returns:
- NULL, nothing is returned
- Throws:
java.lang.IllegalArgumentException- if the number of arguments is not correct or if the argument is null
-
deleteCustomGauge
public java.lang.Object deleteCustomGauge(java.lang.Object[] args)
Deletes a Custom Gauge using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringthat will represent the resource URN of the HTTP DELETE request. Said resource URN corresponds to the name that was given to the custom Gauge.- Parameters:
args- object array containing the resource URN for the DELETE request- Returns:
- NULL, nothing is returned
-
getCustomCounter
public java.lang.String getCustomCounter(java.lang.String name)
Retrieves a custom counter.
All the metrics received are of typeMeterType#COUNTER.- Parameters:
name- URN of the custom counter- Returns:
- a JsonObject representing the requested Custom Counter
-
updateCustomCounter
public java.lang.Object updateCustomCounter(java.lang.Object[] args)
Updates a Custom Counter using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringthat will represent the body of the HTTP PUT request. Said body corresponds to the JsonObject provided byCounterRepresentation.getUpdater()- Parameters:
args- object array containing the body of the PUT request- Returns:
- NULL, nothing is returned
-
deleteCustomCounter
public java.lang.Object deleteCustomCounter(java.lang.Object[] args)
Deletes a Custom Counter using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringthat will represent the resource URN of the HTTP DELETE request. Said resource URN corresponds to the name that was given to the custom Counter.- Parameters:
args- object array containing the resource URN for the DELETE request- Returns:
- NULL, nothing is returned
-
getCustomTimer
public java.lang.String getCustomTimer(java.lang.String name)
Retrieves a custom timer.
All the metrics received are of typeMeterType#TIMER.- Parameters:
name- URN of the custom gauge- Returns:
- a JsonObject representing the requested Custom Timer
-
updateCustomTimer
public java.lang.Object updateCustomTimer(java.lang.Object[] args)
Updates a Custom Timer using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringthat will represent the body of the HTTP PUT request. Said body corresponds to the JsonObject provided byTimerRepresentation.getUpdater()- Parameters:
args- object array containing the body of the PUT request- Returns:
- NULL, nothing is returned
-
deleteCustomTimer
public java.lang.Object deleteCustomTimer(java.lang.Object[] args)
Deletes a Custom Timer using the REST service.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringthat will represent the resource URN of the HTTP DELETE request. Said resource URN corresponds to the name that was given to the custom Timer.- Parameters:
args- object array containing the resource URN for the DELETE request- Returns:
- NULL, nothing is returned
-
getMemoryMetric
private java.lang.String getMemoryMetric(java.lang.String name)
Retrieves a memory metric from the REST service.
The memory metrics exposed by Micrometer use the same tags, so this method is created to avoid code repetition.- Parameters:
name- name of the memory metric- Returns:
- the JsonArray with the requested metrics
-
getBufferMetric
private java.lang.String getBufferMetric(java.lang.String name)
Retrieves a buffer metric from the REST service.
The buffer metrics exposed by Micrometer use the same tags, so this method is created to avoid code repetition.- Parameters:
name- name of the buffer metric- Returns:
- the JsonArray with the requested metrics
-
setMemoryBaseUnit
public java.lang.Object setMemoryBaseUnit(java.lang.Object[] args)
Updates the memory base unit used for the system physical memory metrics.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringwhich is a JSON object that contains the new unit. For example, to set the base unit to kilobytes, we send a JsonObject like this one:{ "unit":"kilobytes" }- Parameters:
args- object array containing the body of the PUT request- Returns:
- NULL, nothing is returned
-
setDiskBaseUnit
public java.lang.Object setDiskBaseUnit(java.lang.Object[] args)
Updates the capacity base unit used for the system disk capacity metrics.
This method is "forced" to follow the AAS signature, so there are some constraints. This method expects a single argument of typeStringwhich is a JSON object that contains the new unit. For example, to set the base unit to kilobytes, we send a JsonObject like this one:{ "unit":"kilobytes" }- Parameters:
args- object array containing the body of the PUT request- Returns:
- NULL, nothing is returned
-
getGaugeList
public java.lang.String getGaugeList()
Retrieves the list of custom gauges registered in the Metrics Provider.- Returns:
- a JsonArray representing a list with the names of all the custom gauges
-
getCounterList
public java.lang.String getCounterList()
Retrieves the list of custom counters registered in the Metrics Provider.- Returns:
- a JsonArray representing a list with the names of all the custom counters
-
getTimerList
public java.lang.String getTimerList()
Retrieves the list of custom timers registered in the Metrics Provider.- Returns:
- a JsonArray representing a list with the names of all the custom timers
-
getTaggedMeterList
public java.lang.String getTaggedMeterList()
Retrieves the list of tagged meters registered in the Metrics Provider.- Returns:
- a JsonArray representing a list with the names of relevant tagged meters in the meter registry
-
getSimpleMeterList
public java.lang.String getSimpleMeterList()
Retrieves the list of non-tagged meters registered in the Metrics Provider.- Returns:
- a JsonArray representing a list with the names of relevant non-tagged meters in the meter registry
-
-