convenience function for instrumenting http handlers