Set Up Code Inventory
Code Inventory is designed for application developers to simplify the work of code deprecation/removal. By tracking which methods run within a timeframe, teams can identify methods did not run and target that code for removal. Unlike dead code from static analysis techniques, Code Inventory tracks usage over time and helps pinpoint code regardless of accessibility or frameworks.
Common uses of Code Inventory are:
Reducing an application’s attack surface.
Preventing accidental re-activation of dead code.
Code Inventory must be enabled within applications. It is recommended for first-party (custom) applications rather than third-party COTS applications.
To enable Code Inventory, add
notifyFirstCall=true to your comma-separated
AZ_CRS_ARGUMENTS environment variable.
Code Inventory tracks usage by recording the first execution of each method. Performance impact is negligible because the JVM has already identified this first execution and subsequent calls to the method are not tracked.
Code Inventory tracks first method invocation – it does not reproduce the entire inventory of available code found within source files and bytecode. Developers should compare a Code Inventory report against their codebase to identify classes and methods that are in source but not the Code Inventory: these methods were not executed within the timeframe.
The results of Code Inventory are available through the API, see "API for Code Inventory" for more info.