How would you monitor pipeline performance, troubleshoot failures, and optimize legacy code to improve processing speeds?