1. A method comprising, on a computer system comprising computer hardware: inserting into a target program, at an instrumentation point of the target program, an event generator comprising an instrumentation identifier; registering the instrumentation identifier in instrumentation records, wherein the instrumentation records link the instrumentation identifier to a dynamically variable event handler; responsive to an event generated by the event generator, receiving a callback comprising the instrumentation identifier; using the instrumentation identifier, identifying in the instrumentation records the dynamically variable event handler; invoking the dynamically variable event handler; and collecting data related to execution of the target program using the invoked dynamically variable event handler.