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

May I do multi-threading to collect data on the Dynatrace plug-ins?

nkobayashi1
Helper

Hi,

We have been developing Dynatrace plug-ins to collect Windows performance counters data and Linux sar data for our customer. e.g. Average value per minute of Page In/sec.

If I simply measure performance data for one minute in the query () call, the time to send the data with absolute () will be delayed, and the timestamp of the data will be shifted by one minute. Furthermore, the data measuring and sending will exceed the time of the next query() call every intervals, I am concerning which may interfere with the operation of OneAgent.

For that reason, I am trying background data measuring using multi-threading.

The idea is following:

When an OneAgent started, I start multiple sub-threads under its plug-in. They do background measuring per 10 seconds by performance counter on Windows, or sar -q and sar -B on Linux. On the other side, when the query() method is called, sleep 50 seconds and send latest 6 data (last 10 seconds data of the previous interval and 50 seconds data of the current interval) sub-threads data by absolute() call.

And also, assuming we can do it, we have additional questions:

Can I quit from query() call immediately on the main-thread, and call absolute() 50 seconds later to send collected data from sub-threads directly? It may help simplify our approach.

Does logging function of OneAgent plug-in support multi-threading?

Thanks,
Noah Kobayashi


3 REPLIES 3

maciej_grynda
Dynatrace Helper
Dynatrace Helper

I think you could achieve this using multithreading, but please remember that Dynatrace doesn't really support inervals shorter than one minute. If you report multiple values on a single timeseries in one minute time window only one will be stored.


Mike_L
Dynatrace Guru
Dynatrace Guru

Hi,

Most of our more extensive plugins such as f5, datapower, IBM MQ, Juniper and so on uses multi threading. You should keep the query method running (just sleep it) and then collect the data before the 1 minute threshold is reached. You can store the previous value within the plugin and use it as well during the next polling interval.

Mike


Mike

Mike_L
Dynatrace Guru
Dynatrace Guru

That being said, a plugin can only report a single value per minute, sending a metric every 10 seconds or so will not achieve anything for you.


Mike

Featured Posts