Class MetricsExtractorRestClient


  • public class MetricsExtractorRestClient
    extends java.lang.Object
    Class 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
    • 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.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.
      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.
      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.
      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.
      java.lang.String getCounterList()
      Retrieves the list of custom counters registered in the Metrics Provider.
      java.lang.String getCustomCounter​(java.lang.String name)
      Retrieves a custom counter.
      All the metrics received are of type MeterType#COUNTER.
      java.lang.String getCustomGauge​(java.lang.String name)
      Retrieves a custom gauge.
      All the metrics received are of type MeterType#GAUGE.
      java.lang.String getCustomTimer​(java.lang.String name)
      Retrieves a custom timer.
      All the metrics received are of type MeterType#TIMER.
      java.lang.String getGaugeList()
      Retrieves the list of custom gauges registered in the Metrics Provider.
      java.lang.String getJvmBufferCount()
      Retrieves the number of buffers from the JVM.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmBufferMemoryUsed()
      Retrieves the amount of buffer memory used by the JVM.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmBufferTotalCapacity()
      Retrieves the total capacity of the buffers from the JVM.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmClassesLoaded()
      Retrieves the number of classes loaded in the resource being monitored.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmClassesUnloaded()
      Retrieves the number of classes that has been unloaded from the JVM since execution started.
      The metric received is of type MeterType#COUNTER.
      java.lang.String getJvmGcLiveDataSize()
      Retrieves the live data size of the garbage collector from the process being monitored.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmGcMaxDataSize()
      Retrieves the max data size of the garbage collector from the process being monitored.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmGcMemoryAllocated()
      Retrieves the allocated memory of the garbage collector from the process being monitored.
      The metric received is of type MeterType#COUNTER.
      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 type MeterType#COUNTER.
      java.lang.String getJvmGcPause()
      Retrieves the timers for the Garbage Collector pause sorted by cause and action.
      The metric received is of type MeterType#TIMER.
      java.lang.String getJvmMemoryCommited()
      Retrieves the amount of committed memory from the JVM.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmMemoryMax()
      Retrieves the max memory from the JVM.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmMemoryUsed()
      Retrieves the amount of used memory from the JVM.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmThreadsDaemon()
      Retrieves the number of Daemon threads running in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmThreadsLive()
      Retrieves the number of live threads running in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmThreadsPeak()
      Retrieves the peak number of threads running in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getJvmThreadsStates()
      Retrieves the number of threads running in the resource sorted by state.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getLogbackEvents()
      Retrieves the count of logback events from the resource sorted by level.
      The metric received is of type MeterType#COUNTER.
      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.
      java.lang.String getProcessCpuUsage()
      Retrieves percentage of the CPU that the process is using.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getProcessStartTime()
      Retrieves the start time of the process being monitored.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getProcessUptime()
      Retrieves the total time the process being monitored has been running.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSimpleMeterList()
      Retrieves the list of non-tagged meters registered in the Metrics Provider.
      java.lang.String getSystemCpuCount()
      Retrieves the number of CPUs running in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemCpuUsage()
      Retrieves percentage of usage of the CPU running in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemDiskFree()
      Retrieves the free disk capacity in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemDiskTotal()
      Retrieves the total disk capacity in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemDiskUsable()
      Retrieves the usable disk capacity in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemMemoryFree()
      Retrieves the amount of free physical memory in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemMemoryTotal()
      Retrieves the total amount of physical memory in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemMemoryUsage()
      Retrieves the percentage of usage of physical memory in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemMemoryUsed()
      Retrieves the amount of used physical memory in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getSystemsDiskUsed()
      Retrieves the used disk capacity in the resource.
      The metric received is of type MeterType#GAUGE.
      java.lang.String getTaggedMeterList()
      Retrieves the list of tagged meters registered in the Metrics Provider.
      java.lang.String getTimerList()
      Retrieves the list of custom timers registered in the Metrics Provider.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 service
        portNo - 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 is
        resource - resource we want to retrieve
        tags - 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 sent
        body - 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 sent
        resource - 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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type MeterType#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 type String that will represent the body of the HTTP PUT request. Said body corresponds to the JsonObject provided by GaugeRepresentation.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 type String that 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 type MeterType#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 type String that will represent the body of the HTTP PUT request. Said body corresponds to the JsonObject provided by CounterRepresentation.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 type String that 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 type MeterType#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 type String that will represent the body of the HTTP PUT request. Said body corresponds to the JsonObject provided by TimerRepresentation.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 type String that 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 type String which 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 type String which 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