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

dynamic measures, custom plug-ins, and how to graph individual values

james_mackin
Inactive

I'm updating the Db Query plug-in (from the fastpacks/plug-ins area) to accept a list of arbitrary database column names, instead of a single metric called 'Column Value'. My understanding is that to do this involves creating dynamic measures. However, after building out the changes and generating the new dynamic measures, the dynatrace dashboarding capabilities don't do what I would have expected. Support suggested we utilize the forums.The image below is what the dynamic measure matrix is displaying. In this dynamic measure case, we know what the columns will actually be for the specified queries.

Here are my questions. How do you create charts to display the collected values over a period of time (i.e. samples, max_packages_per_minute)? And for the dynamic measure matrix, I thought that the values where supposed to be represented as columns. I have 4 different queries, each with the same columns, and we'd expected that we'd have gotten a grid of values.

The code that builds out the dynamic measures is below:

if ((measures = env.getMonitorMeasures(METRIC_GROUP, MSR_VALUE)) != null) {
double cValues[] = cValue();
String measureNames[] = getMeasureNames();
if (cValues != null) {
for (MonitorMeasure measure : measures) {
measure.setValue(cValues[0]);
int i = 0;
for (String measureName : measureNames) {
if (measureName != null && measureName.trim().length() > 0) {
log.finer("Setting dynamic measure " + measureNames[i] + " with value "+ cValues[i]);
dynamicMeasure = env.createDynamicMeasure(measure, "Name", measureNames[i]);
dynamicMeasure.setValue(cValues[i]);
}
i++;
}
}
}
}
14 REPLIES 14

andreas_grabner
Dynatrace Leader
Dynatrace Leader

Hi James. I forwarded your question to an internal resource who created several monitoring plugins in the past. He will have a look at this and will respond later this week. Andi

eugene_turetsk2
Inactive

Hi Jim,

For each of the four queries, please use unique name in the second parameter of the com.dynatrace.diagnostics.pdk.MonitorEnvironment.createDynamicMeasure method, e.g. instead of "Name" use "Query1" for the measures of the first query, "Query2" for the measures of the second query, etc. You should be able to have grid then. Please let Andi or me know if you still have problem.

Eugene. 

james_mackin
Inactive

 

Thanks, Eugene. I added in that new field to the plugin, and that makes the dynamic measure matrix dashlet work as expected.

The last two questions, which are still outstanding, include:

1) how do I graph the dynamic values, so we can see how these column values change over time?

2) How can I create a measure that is specific to the monitor instance and dynamic value (i.e. column name) and then put thresholds on that value. Our ultimate goal is to associate incidents against those new measures.

Number one should be simple, since each dynamic measure group (second argument on the createDynamicMeasure method) is considered a "split" for the "father" measure when you create a chart, you can select that split and then select the dynamic measures you want.

 

eugene_turetsk2
Inactive


Hi Jim,

This is doable. I'll update wiki page with steps to follow later today or early tomorrow.

Eugene.

james_mackin
Inactive

Ah, I missed the splitting drop-down; I only noticed the usual 'split' cast of characters. Thanks, David!

Would you mind sharing your modified db plugin?  I was just about to update the existing one to add this functionality.

eugene_turetsk2
Inactive

Great! David, thank you for providing steps for Jim.

james_mackin
Inactive

 

Yes, let me do some more testing and I'll pass the JAR file back off to you.

james_mackin
Inactive

I'm still a bit confused on how to set thresholds on one of these child measures. In our specific use case, he Db Query is create a dynamic measure called Db Query->Column Value->Approvals->Max Packages. Approvals is the query, Max Packages is the column name we're monitoring.

I'd like to create a measure on this value and ultimately alert when the value breaks our thresholds.

Many I'm missing something, but the UI seems to stop at the 'Column Value' dimension, so I can't figure out how to do the above Any pointers to doc I may have missed? Thanks in advance,Jim

Hi Jim,

I'm not sure if you can setup incidents based on the dynamic measures. I'll double check it. However, when incident is triggered you will know which dynamic measure triggered it, i.e. the ${VIOLATED_MEASURE_SPLITTINGS} will have a dynamic measure name and ${VIOLATED_MEASURE_VALUE} will have its value. If this doesn't work for you, the Monitor Metric Group plugins should work. We can take use of Monitor Metric Group plugins offline if you'd like to use them.

Eugene.

james_mackin
Inactive

Let me take a look at that.

One, hopefully last question that I can't find in the PDK javadoc. How do I get the profile name associated with the monitor? I'd like to log it along with the other data, so if there are issues there is the option of scraping the log and generating alerts from that to the group that owns the profile.

eugene_turetsk2
Inactive

Hi Jim,

We've received confirmation from the Lab that a dynamic measure cannot be used to configure an incident rule, only measure subscriptions stored in the system profile can be used for incident rule configurations.

In terms of the profile name: the com.dynatrace.diagnostics.pdk.ActionEnvironment.getSystemProfileName() method returns profile name.

Eugene.

 

james_mackin
Inactive

 

Thanks, Eugene. REally appreciated. We'll take the first value then and return it as a first-class measure, so there's at least one value in that list of column values that you can cheaply alert on.