Getting gaps in metric data for data from an EP Agent plugin


Article ID: 122851


Updated On:


CA Application Performance Management Agent (APM / Wily / Introscope) INTROSCOPE


We are running a python script as a stateful plugin to report data back to the EP agent every 15 seconds. As far as we can tell the plugin runs correctly but we find that in the data recorded in APM there are gaps (zero values) in the data

User-added image


This is not a APM issue. The plugin is running as a stateful plugin and the 15 second interval is controlled in the plugin code itself not by the EP agent via the delayinseconds setting as would be the case for stateless plugins. The problem is not the way that the script is run but in the way python outputs data. It maintains it’s data in a buffer and for performance reasons will only flush the buffer to stdout when it is full. Therefore if the buffer is not filled every 15 seconds the data may not be sent.


EPA agent – any platform any release


To ensure the data is sent for each cycle you need to flush the output buffers using sys.stdout.flush() as shown in the below artificial example
import sys
import re
import time
def main():
        while True:
                print "<metric type=\"IntAverage\" name=\"MYSCRIPTPY1|VirtualMachine|Process|ME:Cpu Usage %\" value=\"55\" />"
if __name__ == "__main__":


1558692204755000122851_sktwi1f5rjvs16gul.png get_app