The goal of JavaMelody is to monitor Java applications in production environments. It is a tool to measure and calculate statistics on real operation of an application depending on the usage of the application by users.
This post go through the configuration needed in a Grails application, we are going to use Grails 3.3.5 version, so let’s create a new fresh Grails project:
grails create-app grails-java-melody
NOTE: If you want to know what tools you need to have installed in yout computer in order to create a Grails basic project, please refer my previous post: Grails Hello World
Installation
To install the plugin, just add Grails dependency in your build.gradle
file:
dependencies {
compile 'org.grails.plugins:grails-melody-plugin:1.72.0'
}
Then you will be able to monitor the application at http://localhost:8080/monitoring.
Result
More configuration
If you need to disable JavaMelody monitoring add this lines to your grails-app/conf/application.yml
:
javamelody:
disabled: true
Also all parameters described in the JavaMelody User’s guide can be configured in your grails-app/conf/application.yml
file. You can also add rules in your grails-app/conf/application.groovy
for the spring security plugin, if installed:
grails.plugin.springsecurity.controllerAnnotations.staticRules = [ [pattern: '/monitoring', access: ['ROLE_ADMIN']] ]
To browse the project go here, to download the project:
git clone https://github.com/josdem/grails-java-melody.git
To run the project:
grails run-app