Chapter 6. Integration of dynamic JFR recordings with the agent harvester for archiving
Chapter 6. Integration of dynamic JFR recordings with the agent harvester for archiving When you enable the Cryostat agent to start dynamic JFR recordings based on MBean custom triggers, you can also integrate these JFR recordings with the agent harvester system. This integration means that any JFR recording data resulting from MBean custom triggers is periodically captured in JFR snapshots and pushed to the Cryostat server for archiving, based on the harvester's configured schedule. MBean custom triggers with agent harvester periods The agent harvester is another configurable feature, which enables the Cryostat agent to start JFR recordings automatically at agent startup based on a given event template. The agent harvester includes a configurable property that you can use to define a schedule for capturing and uploading recording snapshots to the Cryostat server. By defining MBean custom triggers and an agent harvester period without a harvester template, you can achieve a setup where the agent does both of the following: Agent dynamically starts JFR recordings based on MBean custom triggers. Aent uses configured harvester periods to periodically capture snapshots of the recording data and upload this data to the Cryostat server. In this situation, the agent continues to capture recording data until you manually stop the dynamic JFR recording or the host JVM shuts down. Configuration of an agent harvester period When you configure your target application to load the Cryostat agent, you can also configure an agent harvester period to enable regular uploads of JFR recording data. You can specify the value of the harvester period in milliseconds. By default, the Cryostat agent is not enabled to perform any scheduled harvest uploading of JFR recording data. You can configure an agent harvester period in either of the following ways: Using a JVM system property flag The following example shows how to configure a harvester period by using a JVM system property flag: Using an environment variable The following example shows how to configure a harvester period by using an environment variable: The preceding examples show a harvester period value of 1000. Based on this example, the agent uploads JFR recording data for archiving every 1000 milliseconds (that is, at regular 1-second intervals). Note Cryostat supports each of the following different ways to start JFR recordings: You can start recordings manually from the Cryostat web console. The Cryostat agent can start recordings dynamically based on MBean custom triggers. The Cryostat agent can start recordings automatically at agent startup based on a given harvester template. The Cryostat server can send on-demand requests over JMX or an agent HTTP connection to start recordings based on automated rules. In this situation, agent harvester settings control the capture and upload of all JFR recording data regardless of which way JFR recordings are started in the system.
-Dcryostat.agent.harvester.period-ms=1000 - name: CRYOSTAT_AGENT_HARVESTER_PERIOD_MS value: 1000