cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to determine if a measure is subscribed to when developing a plugin.

JamesKitson
Dynatrace Leader
Dynatrace Leader

Hi all,

I would like to define some conditional statements with a plugin to skip over any code that is not necessary if a measure is not subscribed to (mainly to avoid sending requests to a system that does not have a relevant feature which would generate errors on their side).

I know there is some way to check whether or not a measure is subscribed to but am not certain as to what that is, any assistance/examples are appreciated.

James

1 REPLY 1

JamesKitson
Dynatrace Leader
Dynatrace Leader

I worked out a pretty simple solution to this:

if (!env.getMonitorMeasures(<metric_group>, <measure_name>).isEmpty())

{retrieveAndPopulateMeasure(env);}

This basically checks that the given measure is in the collection of subscribed measures as configured and if it is not in there it doesn't execute the code to get the measure.

James