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?
Solved! Go to Solution.
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.