How to instrument an application