3 ms·
Wow, I forgot all about AOP, even though I was, briefly, very excited about it. On a project where "logging" was budgeted as a short, separate task that could
by jtolmar 5y ago
Wow, I forgot all about AOP, even though I was, briefly, very excited about it.
On a project where "logging" was budgeted as a short, separate task that could be delegated to a junior engineer at the end, I used Spring's AOP to inject performance and usage logs across entire chunks of the program. It worked great and took way less time than scheduled.
I was convinced there'd be other uses for AOP, and kept an eye out for other opportunities for months. Given that I completely forgot this was a thing until now, I think you can guess how often that happened.
- ajuc 5y agoI've used AOP a few times, it's never caused problems. Other than logging and profiling I've used it in ejb3 app calling old plsql business logic - we had problems with some plsql code handling exceptions and transactions in non-standard way (basically - comiting or rolling back in pl/sql code) which messed up our ejb3 container-managed transactions. We had a template for pl/sql code that should be followed - every function should start with a savepoint, never commit, and only rollback to that savepoint in case of error. But there was a lot of plsql code and some of it didn't followed that rule. So I added aspect in java that wrapped around any plsql call, created a savepoint before it, and checked after the call if it's still there - if not it would a special exception. That allowed us to quickly find all the places that weren't handling transactions properly in PL/SQL and fix them. We also used AOP for integration testing with our java business logic and plsql - instead of preparing and using up data during tests we simply wrapped transactions around testing methods and rolled back everything afterwards. I don't think AOP is bad, even if it's truly COME FROM with a different branding.
- SideburnsOfDoom 5y ago> used Spring's AOP to inject performance and usage logs across entire chunks of the program. It worked great and took way less time than scheduled. There was the guy who used AOP to inject logging and perf, and set it to "instrument every method". _Every method_. It was Ok in test, but when the production load rose to the daily peak, the volume of logging data was in itself sufficient to saturate a network and requests got dropped. Including health checks, which caused machines to be taken out of the load balancer, increasing load on the survivors. Autoscaling didn't help, new machines came up with the same issue. The failure cascade brought down the entire service. True story.
- jtolmar 5y agoLuckily for my case, some senior engineer was convinced that it was a good idea to make an "abstraction layer" consisting of pass-throughs for every API and external service, and group all the stuff in that layer in a single package. So I did instrument every method, but only in that BS package.