Discussion points KW5
Agenda for the needed discussions on the server-side instrumentation topic:
Work done
- ASM
- Intern Strings on the class parsing for saving the memory (costs more time)
- Instrumentation
- Reads all instrumentation points from the class type and enhanced exception sensor setting
- Uses method Id from the RSC to instrument method
- Logic divided in MethodInstrumenter and ConstructorInstrumenter
- Possibility to create string constants for the descriptors to even speed up more
- Need IHookDispatcher in the Commons for testing (we can have only on agent if we do testing on Agent and use string constants for the descriptors)
- Configuration creator - two main features:
- Environment to AgentConfiguration
- read environment and registers sensors
- register platform ID, maybe this is not right place, but we need agent Id to be saved in the agent configuration
- basically uses the old Agent's sensor type config classes and copies data from the Environment, no reusing of the object here on purpose
- Check for instrumentation points
- runs class and method filter on the assignments in the Environment
- for passed methods we create RSC, register method ident, connect all needed sensor Ids and copy needed settings for the Agent (like property path, settings, etc..)
- here also no interaction between Ci classes and RSC/sensor configs, they don't know about each other
- RSC
- only saves sensor ids nothing else and minimum of data need for the
- Environment to AgentConfiguration
- Agent service
- Combines all components together
- Instrumentation result sent back to the agent containing byte code and set of RSCs
- Agent
- IdManager
- On start tries to connect to the CMR and get the AgentConfiguration
- Saves the platform id and feeds the Configuration storage (which also now has much less)
- Byte-code analyzer
- Creates hash (256hex) and calls CMR for the Instrumentation result
- If something is returned adds RSCs to the IHookMapper and returns instrumented byte-code
- HookDispatcher
- Changes based on the new RSC way
- IHookMapper changed to not differentiate between mapping methods and constructors - all the same
- HookSupplier new stuff
- supplies hooks and sensor configs if needed
- IdManager
General problems/proposals
- Agent service
- How to deal with the Environments and Configurations, we want to skip configuration creation if the one is already created for the agent and did not change.
- Is there a way to pre-create Configuration for Environment
- Configuration creator
- MethodType can not be "merged" if method changes, we always need a new one, because otherwise we can not instrument correctly
- Save patterns in the CI classes already, easier and faster to access later in the filters (they don't have to be persisted, use @AfterDeserialize or smth)
- Is meaningful capturing missing
- Filters and assignments, we can maybe have a better solution here (closely related to CI):
- split assignment in kind of a set of filters (ex. method name filter, annotation filter, etc)
- each filter know if it's applied on class or method
- if it is wild-card or not
- each has priority for usage in searching against the class cache (for example no wild-card annotation filter has advantage over wild-card class name filter)
- Registration is bottle neck for the complete thing at the moment:
- 90% of time spent here, we need some ideas or smth
- Agent
- IdManager
- do we need registration thread now
- what do we do when we cannot connect to the CMR?
- ByteCode analyzer
- how to deal with the class pools, inserting and removing class paths, etc (everything we had until now)
- JavaAgent
- when IHookDispatcher is only in Commons I get class not def. exception when executing the hooks.. so now'it in both Commons and Agent
- IdManager
Work in future
- agent clean-up
- remove unused stuff
- fix tests
- management of the class cache
- persisting, loading, etc
- saving byte code to disk
- deal with configuration updates
- know when saved byte code is not anymore valid
- updating of the class byte-code during run-time
- asynchronous agent service
- don't wait for the byte code to get come back, rather continue using original byte code until it's returned then apply