In one embodiment, an agent executed by a device detects an invocation that is made using Java reflection of a method associated with a microservice. The agent instruments the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice. The agent optimizes the invocation of the method associated with the microservice. The agent provides the one or more metrics regarding the microservice to a user interface.