I'm working on a cloud app with three tiers

  • Web - Controller
  • DB - Repository
  • BusinessLogic - Handler

Normally it's cut and dry where to put monitoring logic but in this case, when a use issues a Delete Rest operation, I need to track it before we call the Repository to delete the record (since I need to know what the state was before delete to issue metrics on it). I'm not certain where the best place for metrics work to live.

I could put it in the controller, just before I issue the delete operation to the repository. But this means that now my previously web only tier now would have to retrieve the record in order to issue a metric.

Doing it in the repository layer also feels odd, as my repository layer today doesn't do anything other than handle CRUD operations.

Where would you suggest putting it? We don't have an internal pattern yet for this project so I can kind of see the case for all of them.

  • 1
    What kind of metrics do you need? And for what purpose? May 20 '21 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.