cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Bhuvnesh.Kumar
Moderator
Moderator

Metric Transformers in the Extensions Commons Library

The Java Extension SDK provides an automated utility that allows extensions developers to transform a metric name and value as it would be represented in the Metric Browser. These transformers include the Alias, the Multiplier, the Delta, and the Convert.

 

In this article...

 

How should the transformers be specified?

metrics.xml
<stat url="/nitro/v1/stat/lbvserver" rootElement="lbvserver" alias="Load Balancing Server Metrics">
        <metric attr="cursrvrconnections" alias="Server Connections"/>
        <metric attr="memoryInMBytes" alias="Memory in KB" multiplier="1000"/>
        <metric attr="throughput" delta="true" />
        <metric attr="state">
            <convert str="DOWN" value="0"/>
            <convert str="UP" value="1"/>
            <convert str="UNKNOWN" value="2"/>
        </metric>
    </stat>

 

config.yml
metrics:
     - name: “cursrvrconnections”
       alias: “Cursor RV Connections”
       delta: true
       multiplier: 1000
       convert: 
         “DOWN”: 0
         “UP”: 1
         “UNKNOWN”: 2

NOTE | Multiple transformers can be applied to the same metric as follows:

<metric attr="cursrvrconnections" alias="Server Connections" multiplier="10" delta="true"/>

 

Please note the following:

  • It is not mandatory to specify any of these transformers.
  • By default, a metric does not have an alias and will be named as-is from the artifact being monitored.
  • The default value for the multiplier is always 1.
  • The default value for the delta is always false.
  • A metric that yields text values will simply be skipped if a convert transformer isn’t specified.
  • On calling transformAndPrintMetrics(List<Metric> metrics) in com.appdynamics.extensions.MetricWriteHelper, the SDK automatically applies any configured transformers before publishing these metrics.

 

List of transformers

Alias

The Alias transformer can be used to replace a metric’s name. Often, metrics are represented by ambiguous names in the artifacts being monitored, as evident in the example above. In this case, cursrvrconnections will be represented as Server Connections in the Metric Browser.

Multiplier

The Multiplier transformer can be used to multiply the original metric value by a configured factor. From the example above, consider that an artifact returns memory in MB and a requirement is to monitor this metric in KB. A multiplier of 1000 can be applied to this metric to satisfy this requirement.

Delta

Consider an ever-increasing metric value and a requirement is to monitor the number of units by which this metric increases every minute. A Delta transformer can be applied in this case. This transformer compares the value of a metric at minute X with its value at minute X-1 and publishes the difference as a metric value.

NOTE | Every time the extension is run, the first value will not be reported if the delta is true.

Convert

The Convert transformer can be applied to metrics that return a text value from an artifact’s API. These text values can be represented as numeric values. From the example above, DOWN will be represented with a value of 0, UP with 1 and UNKNOWN with 2 for the state metric.

 

Additional resources

Version history
Last update:
‎06-06-2023 11:33 AM
Updated by:
Join Us On December 10
Learn how Splunk and AppDynamics are redefining observability


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here