Connect middleware to monitor an application process.