Agent startup
- Minimum initialization mode
- Only contain parts that are related to creating the initial connection to the CMR
- Agent tries to connect to CMR registration service.
- Adress of the CMR is defined by JVM parameters
- Agent provides its name (also given by JVM parameters)
- If connection is not possible, agent stays in minimum initialization mode (1) and keeps trying to connect to the CMR
Agent initialization
- (Agent can connect to the CMR)
- CMR find environment for the agent
- Environment is found by mapping table consisting of agent IP and name.
- If no environment is found, CMR and Agent log the problem and agent stop trying. Only restarting the agent will start over the process.
- CMR sends initial information to the agent called AgentConfiguration
- Based on the environment
- Agent-ID
- Configurations like sensors, strategies
- Full initialization mode
- Process all classes that were loaded while the agent was not fully initialized
Connection to CMR breaks
- Agent is in disconnected mode
- Agent collects all classes that are loaded and safe the name of them
- When connection is attained again process all classes
Process loaded classes
- (either called through normal class loading or though reloading triggered by the CMR)
- Calculate hashcode for the class
- Figure out if this class needs to be sent to the server
Process "bytecode resend" request
- Agent updates cache to mark this class to be instrumented/send
- Load bytecode from JVM (open)
- Send bytecode to the CMR
Process "Redefine" request
- Redefine class based on the given class
- If the bytecode is marked as original, mark this class in the cache as "not needed for instrumentation"
- If the bytecode is marked as non original, verify that cache has this class as "needed for instrumentation"
Update environment (instrumentation configuration)
- Enduser on the UI updates the configuration (environment)
- Update the AgentConfiguration for all agents using this environment
- Run the changed environment against the class cache again. Class cache returns changed entities:
- "Bytecode resend" request: Class that was not instrumented before:
- Tell the agent to send the bytecode for this class again. (The class will undergo normal parsing & instrumentation process and the result will be returned to the agent.)
- "Redefine" request: Class that was instrumented before:
- Load original bytecode from cache in the CMR
- Run the instrumenter on this bytecode and send the bytecode to the agent. Mark if it is original bytecode.
- "Bytecode resend" request: Class that was not instrumented before: