Adding metrics logic to the application.