Giter Club home page Giter Club logo

grails-melody-plugin's Introduction

grails-melody-plugin's People

Contributors

bassmartin avatar ctoestreich avatar evernat avatar jukin-jerry avatar macrosak avatar sergiomichels avatar stiancor avatar timic avatar yunpengbai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grails-melody-plugin's Issues

securing monitoring url with spring security core not working with latest version of melody.

I know this is old question but i think it's not working.
I have just installed melody in my grails app and i am using latest version of melody.
But i am not able to guide my monitoring url. Because this issue was fixed it's should work without modifying web.xml.
I can see loadAfter and getWebXmlFilterOrder() in GrailsMelodyGrailsPlugin.groovy so it should work.
Could you please let me know if am i missing any step ?
I want to show monitor page only to "MONITORING_USER" in my grails app.

No value for key [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy] bound to thread

I tried to integrate the grails-melody-plugin-1.73.2 into a Grails-3.3.8 application but with some GORM interactions I got the following stacktrace:

java.lang.IllegalStateException: No value for key [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy@64e3d4ab] bound to thread [pool-2-thread-1]
	at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:210)
	at org.springframework.orm.hibernate5.HibernateTransactionManager.doCleanupAfterCompletion(HibernateTransactionManager.java:654)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1021)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:815)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:734)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:150)
	at grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91)
...
	at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
	at grails.melody.plugin.MelodyInterceptorEnhancer$_enhance_closure1$_closure2.doCall(MelodyInterceptorEnhancer.groovy:77)
	at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
...

It seems that Graeme Rocher investigated on that issue a while ago: grails/grails-core#10675 (comment)

This is an issue with the melody plugin. It is replacing the data source with another proxy which interferes with the references GORM uses to bind and unbind the session.

grails-melody-plugin must load after grails-quartz plugin to allow full reconfiguration of the scheduler thread

If the grails-melody-plugin loads before the grails-quartz plugin, any re-configurations of the quartz scheduler thread in the Grails application do not happen when melody initializes, which results in the default scheduler thread always loading with the default configuration out of the box. If the Grails application wants to have a different scheduler thread configuration, two are created, causing issues at application shutdown.

Simple solution is to include 'quartz' in the loadAfter property of the grails-melody plugin.

Will add pull request.

Add Grails 3 support and publish to Bintray

It would be helpful to have the JavaMelody Grails Plugin listed at:

I was able to get the plugin to download by adding the dependency to the build file:

build.gradle

compile "net.bull.javamelody:javamelody-core:1.56.0"

However, a 404 results when attempting to open the console:

Environment:

$ grails --version
| Grails Version: 3.0.3
| Groovy Version: 2.4.3
| JVM Version: 1.8.0_51
$ uname -a
Darwin Blade.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64

No sql query logs for grails 3.3.9 + melody plugin 1.74

After update to grails 3.3.9 from 3.2 version melody sql log is empty

Can it be related to #65 ?

We are using only one standard data source with PostgreSQL DB.

JDBC connections shows 0.
image

Usual tomcat JDBC pool used. During upgrade dependancy has been added
runtime "org.apache.tomcat:tomcat-jdbc"

Enhance release

Check the possibility of an automate release process that changes the version (from snapshot to final), tag and change again to snapshot.

Even if the Grails Melody Plugin is disabled via config option, Service Proxys are still attached

Moved from http://jira.grails.org/browse/GPMELODY-6 by Paul Weber :

I wanted to disable the plugin via disabled option in GrailsMelodyConfig.groovy. This disabled the /monitoring interface, but not the proxys for the Service Methods, and so i had to uninstall the plugin. Looking at the Plugin Source, GrailsMelodyGrailsPlugin.doWithDynamicMethods() on line 126, it looks like the proxies should not be attached when the plugin is disabled.

I used a debugger and found out that the values in the SPRING_COUNTER and DISABLED fields are wrong (seems like the defaults), even if they are read correctly from configuration in doWithWebDescriptor().

Plugin breaks Grails 3.2.11

If you create a fresh Grails 3.2.11 project and add the dependency

runtime 'org.grails.plugins:grails-melody-plugin:1.67.0'

You'll get errors with Taglibs.

I created a simple view with a g:link and am getting this error.

`2017-06-28 11:46:53.983 ERROR --- [nio-8972-exec-1] .a.c.c.C.[.[.[.[grailsDispatcherServlet] : Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [views/index/index.gsp:12] Error executing tag <g:link>: No signature of method: java.lang.String.encodeAsHTML() is applicable for argument types: () values: []
Possible solutions: encodeAsHex(), encodeAsSHA1(), encodeAsMD5(), encodeAsSHA256()] with root cause

groovy.lang.MissingMethodException: No signature of method: java.lang.String.encodeAsHTML() is applicable for argument types: () values: []
Possible solutions: encodeAsHex(), encodeAsSHA1(), encodeAsMD5(), encodeAsSHA256()`

Mac OS X 10.12.5
Java 1.8.131
Grails 3.2.11

mvn grails:maven-war doesn't work without explicit net.bull.javamelody:javamelody-core dependency

Moved from https://code.google.com/p/javamelody/issues/detail?id=284

I'm trying to use grails-melody:1.13 Grails plugin with maven. I have defined plugin in pom.xml.
mvn -Dgrails.env=dev grails:maven-war throws an exception:
GrailsDataSourceBeanPostProcessor.groovy: 3: unable to resolve class net.bull.javamelody.JdbcWrapper

I can fix it by adding net.bull.javamelody:javamelody-core explicitly:

net.bull.javamelody
javamelody-core
1.36.0

Why should I add it to pom.xml?

HTTP 302 is not logged

Grails: 3.2.11
Plugin: 1.67.0

When using spring security core, unauthorized access results in HTTP 302 redirecting to a login form page. I can't see this HTTP 302 anywhere in the java melody monitoring page being logged, only the login page.

Is it possible to turn it on somehow?

Showing SQL connections in "Statistics sql"

Hi everyone.

I've been trying the plugin with a simple Grails 3 app but I cannot see SQL statistics by default when I access to "monitoring" page.

I've tried some suggested workarounds like this and that, but it doesn't work. For the last suggestiond I've tried this piece of code, in build.gradle:

bootRun {
    jvmArgs('-Djavamelody.datasources=java:comp/env/jdbc/dataSource')
    addResources = true
}

But it doesn't work. Maybe I've made some mistake, because showing JavaMelody log I can see this:

Sun Mar 11 20:03:37 CET 2018     DEBUG     JavaMelody listener init started
Sun Mar 11 20:03:37 CET 2018     DEBUG     rebinding datasources failed, skipping

Probably, all of this is related to the issue "JDBC DataSource is not wrapped, SQL requests are not monitored". If so, please, let me know what I'm doing wrong because, by default, it does not show SQL statistics.

Thank you very much.

Kind regards,
Miguel.

Sometimes Content-Type header missing

With plugin version 1.62 sometimes Content-Type header missing for views without layout
Usually, a response has:

Content-Type:text/html;charset=UTF-8
But for some tires of same page loading -- it's missing

I have tried to add to view following code -- no result

<%@ page contentType="text/html;charset=UTF-8" %>

After removing plugin everything works well

Grails version 3.1.14

Create Functional / Integration Test for DataSource Wrapping

This feature is heavily dependent in Grails version and how GORM creates DataSources and wrappers. We should have a functional test with some simple entities (and save some instances) proving that this plugin were able to apply the wrapper correctly.

JavaMelody does not work with SecurityFilters.groovy

Move from https://code.google.com/p/javamelody/issues/detail?id=334
(opened by kdorff)

Reproduce:

  1. Grails 2.2.3, Java 1.6.0_51 (mac), JavaMelody 1.46 (latest, I believe)
$ grails create-app monitor-test
$ cd monitor-test
$ vi grails-app/conf/BuildConfig.groovy  # Inside plugins{  ... } add
        build ":tomcat:$grailsVersion"     (probably already there)
        compile ":grails-melody:1.46"
$ vi grails-app/conf/SecurityFilters.groovy
    class SecurityFilters {
        def filters = {
            helloController(controller:'hello', action:'*') {
                before = {
                    println "${controllerName} ${actionName}"
                }
            }
            monitoringController(controller:'monitoring', action:'*') {
                before = {
                    println "${controllerName} ${actionName}"
                }
            }
        }
    }
$ grails create-controller hello
$ echo "hello" > grails-app/views/hello/index.gsp
  1. In your browser go to http://localhost:8080/monitor-test/hello/index
  2. The console will output "hello index" as expected (from the filter).
  3. In your browser go to http://localhost:8080/monitor-test/monitoring
  4. The javamelody graphs and stats will be shown, but the filter code is never executed.
  5. You can edit the filter so the first filter handles controller '*' and remove the second filter (for monitoring) but it still never actives when you hit the monitoring page.

This means I cannot really use JavaMelody in my app, sadly, until I figure out how to make it filterable.

Additionally,

Spring boot actuator management port not working as expected

Grails version : 3.3.0

build.gradle

compile('org.grails.plugins:grails-melody-plugin:1.70.0') {
        exclude group: 'net.bull.javamelody', module: 'javamelody-core'
    }
compile 'net.bull.javamelody:javamelody-core:1.83.0'
provided "org.springframework.boot:spring-boot-starter-actuator"

application.groovy

 server.port=8080
 management.port=8088
 management.security.enabled=false
 management.ssl.enabled=false
 javamelody.log=true

application.yml

endpoints:
    enabled: true
    jmx:
        enabled: true
        unique-names: true
javamelody:
    sql-transform-pattern: \d+
    jmx-expose-enabled: true
    management-endpoint-monitoring-enabled: true
    monitoring-path: "/actuator/monitoring"
management:
    endpoints:
        web:
            exposure:
                include: "*"
    context-path: "/actuator"

try with and without context-path and monitoring path, the /monitoring endpoint works as expected but is always served on 8080 port...
The actuator is actually working as expected too.
Any help ?

Getting grails melody work with grails 3

Hello,
I tried to install with adding the exist lines to build.gradle.
compile "net.bull.javamelody:javamelody-core:1.59.0"
compile "org.grails.plugins:grails-melody:1.59.0"
I'm getting error on resolving dependencies for the grails-melody plugin. Any idea? I'm using grails 3.0.10.
Thanks

Exception when starting application

Hello, I have built fairy simple grails project with 1 domain, and 1 controller, added plugins
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"

    runtime ":hibernate4:4.3.6.1"

    // plugins for the compile step
    compile ":scaffolding:2.1.2"
    compile ":grails-melody:1.55.0"

}
and increased log level on javamelody in Config.groovy by adding
warn 'net.bull.javamelody'

When starting application, I get such exception everytime.

2015-02-27 17:14:34,593 [localhost-startStop-1] WARN bull.javamelody - exception while reading counters data from files in C:\Users\bajormar\AppData\Local\Temp\javamelody\mariusTest_WL2019470
Message: net.bull.javamelody.CounterRequest
Line | Method
->> 116 | readFromFile in net.bull.javamelody.CounterStorage


| 889 | readFromFile in net.bull.javamelody.Counter
| 110 | . . . in net.bull.javamelody.Collector
| 102 | in net.bull.javamelody.FilterContext
| 110 | init . . . . in net.bull.javamelody.MonitoringFilter
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . in java.lang.Thread
Caused by ClassNotFoundException: net.bull.javamelody.CounterRequest
->> 366 | run in java.net.URLClassLoader$1


| 355 | run in ''
| 354 | findClass . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 358 | loadClass . in ''
| 274 | forName in java.lang.Class
| 625 | resolveClass in java.io.ObjectInputStream
| 1612 | readNonProxyDesc in ''
| 1517 | readClassDesc in ''
| 1771 | readOrdinaryObject in ''
| 1350 | readObject0 in ''
| 370 | readObject in ''
| 1574 | readObject . in java.util.concurrent.ConcurrentHashMap
| 1017 | invokeReadObject in java.io.ObjectStreamClass
| 1893 | readSerialData in java.io.ObjectInputStream
| 1798 | readOrdinaryObject in ''
| 1350 | readObject0 in ''
| 1990 | defaultReadFields in ''
| 1915 | readSerialData in ''
| 1798 | readOrdinaryObject in ''
| 1350 | readObject0 in ''
| 370 | readObject in ''
| 110 | readFromFile in net.bull.javamelody.CounterStorage
| 889 | readFromFile in net.bull.javamelody.Counter
| 110 | . . . in net.bull.javamelody.Collector
| 102 | in net.bull.javamelody.FilterContext
| 110 | init . . . . in net.bull.javamelody.MonitoringFilter
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . in java.lang.Thread

StackOverFlow in super recursive calls in service artifacts

Moved from https://code.google.com/p/javamelody/issues/detail?id=161

What steps will reproduce the problem?

  1. Create an abstract class with a method
  2. Create a service artifact as a child of previous class
  3. Create a method in child with same name and call super.method() in it

abstract class AbstractService {
def myMethod() {}
}

class MyService extends AbstractService {
def myMethod() {
super.myMethod()
}
}

Tha abstract class is in src/groovy and not in grails-app/services

What is the expected output? What do you see instead?
Call to super method without exception

What version of the product are you using? On what application server, JDK,
operating system?
jdk 1.6, grails 1.3.7, grails-melody 1.9, spring sts 2.8.1, win xp

Additional information
I test the behaviour is correct simply uninstalling the plugin

1.70 throws exception in Grails 3.1.12 application

NOTE: The same issue occurs for 1.69.0

Grails 3.1.12 deployed to Tomcat 8.0.

Switching between compile and runtime dependency doesn't affect the outcome.

I'm updating the plugin version from 1.67.0 to 1.70.0 after doing the same with my central collect server. However, I get the following error:

java.lang.NoClassDefFoundError: org/springframework/boot/web/servlet/ServletContextInitializer 
    at java.lang.Class.getDeclaredMethods0(Native Method) 
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) 
    at java.lang.Class.getDeclaredMethods(Class.java:1975) 
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:612) 
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524) 
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510) 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1073)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:778) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760) 
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) 
    at grails.boot.GrailsApp.run(GrailsApp.groovy:55) 
    at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:150) 
    at org.grails.boot.context.web.GrailsAppServletInitializer.createRootApplicationContext(GrailsAppServletInitializer.groovy:57) 
    at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85) 
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976) 
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1853) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
    at java.lang.Thread.run(Thread.java:748) 
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.servlet.ServletContextInitializer 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1339) 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) 
     ... 39 common frames omitted

Multiple datasource (default and quartz) logs quartz sql only

Grails: 3.3.8
Grails Melody Plugin: 1.72.0

Having two data sources defined in application.yml I see only quartz (not the default one) sql queries in monitoring console. Interestingly enough on localhost it shows also alter table for default data source (not in production).

I've checked GrailsMelodyPluginGrailsPlugin and it seems that default data source is picked.

When I upgrade this plugin to 1.74.0, sql logs disappear at all.

Am I missing something here?

Enhancing @Transactional service gives groovy.lang.MissingMethodException

Grails 3.3.8 / JDK1.8.0_192 / Win OS / grails-melody-plugin 1.74.0

When adding new Service class:

package grails.melody.plugin
import grails.gorm.transactions.Transactional

@Transactional
class DomainFindService {
    def findByName(Class domain, String name) {
        log.debug 'findByName - name [{}]', name
        Object instance = domain.findByName(name)
        log.debug 'findByName - [{}]', instance
        return instance
    }
}

and extending test from app-integration-tests like this

package grails.melody.plugin

import grails.testing.mixin.integration.Integration
import grails.transaction.Rollback

import org.springframework.transaction.annotation.Transactional

import spock.lang.Specification

@Integration
class GrailsTransactionSpec extends Specification {

    DomainFindService domainFindService

    @Transactional
    @Rollback
    def 'saving an domain instance should not throw IllegalStateException'() {
        when:
            new SampleDomain(name: 'ABC').save(flush:true)

        then:
            notThrown IllegalStateException
            SampleDomain.count() == 1

        when:
            Object instance = domainFindService.findByName(SampleDomain, 'ABC')

        then:
            notThrown IllegalStateException
            instance != null
    }

}

gives:

    groovy.lang.MissingMethodException: No signature of method: grails.melody.plugin.DomainFindService.$tt__findByName() is applicable for argument types: (java.lang.Class, java.lang.String, org.springframework.transaction.support.DefaultTransactionStatus) values: [class grails.melody.plugin.SampleDomain, ABC, org.springframework.transaction.support.DefaultTransactionStatus@46cab43e]
        at grails.melody.plugin.MelodyInterceptorEnhancer.enhance_closure1$_closure2(MelodyInterceptorEnhancer.groovy:71)

Looks like first argument's type Class makes all the troubles.
When switched to Object works OK and metaMethod is found in MelodyInterceptorEnhancer:

def metaMethod = delegate.metaClass.getMetaMethod(name, args)

Does it look like a bug to you or is it documented somewhere
(NOT to use certain method signatures to be properly enhanced by Melody)?

Chris

Exceptions in grails melody plugin with some particular service parameter definitions

Moved from https://code.google.com/p/javamelody/issues/detail?id=165

What steps will reproduce the problem?
See http://groups.google.com/group/javamelody/browse_thread/thread/130738bdfc5a50e8 and the end of http://jira.grails.org/browse/GPMELODY-1

What is the expected output? What do you see instead?
The services should be executed like when grails melody plugin is not installed. Instead, there are exceptions in the grails melody plugin as said above.

Additional information.
Fortunately, the links above give workarounds

AGPL License in dependencies

The plugin has 3 dependencies. One of the them (compile ("com.lowagie:itext:2.1.7") ) is under AGPL license. That means, that the plugin itself has to be under AGPL license too.
There are two options for solution:

  1. remove itext dependency
  2. make the license for plugin AGPL (will make this great plugin unusable for closed source developerst)

GrailsMelodyConfig override external configuration ?

Hello, I have the following problem.

In my GrailsMelodyConfig.groovy file, I have this line

javamelody.disabled = true

I had some print in the GrailsMelodyUtils to have

    println "TEST CONFIG MELODY"
    println "config.javamelody.disabled"
    println config.javamelody.disabled
    try {
        config.merge(new ConfigSlurper(Environment.current.name()).parse(classLoader.loadClass('GrailsMelodyConfig')))
        println "config.javamelody.disabled"
        println config.javamelody.disabled
    } catch (Exception e) {
        // ignored, use defaults
    }

and I have in console :

TEST CONFIG MELODY
config.javamelody.disabled
[:]
config.javamelody.disabled
true

Ok good.
Now, I put the line
javamelody.disabled = false
in my external config file and I have

TEST CONFIG MELODY
config.javamelody.disabled
false
config.javamelody.disabled
true

So, in fact, GrailsMelodyUtils override my external config file...

Is it normal ?

Thx.

A guide to setup grails melody

I have discovered a recent guide to setup grails melody.
Guide : http://guides.grails.org/grails-javamelody/guide/index.html
Source: https://github.com/grails-guides/grails-javamelody

We could add a link to this somewhere in this page, which comes from this file.

But it should be said that there are links in this guide to buy online training courses by a company with some Grails authors. Some people may or may not be happy to add links like that in an opensource plugin, so this is a a suggestion in case it is ok for us.
(Note that I don't work for that company or for a contract with them and I have never seen those people.)

Service calls are not recorded

I'm using JavaMelody in my Grails app that has also Vaadin. Service calls coming from Vaadin navigation are recorded as they should but I don't have any recording of Service calls done via Vaadin components (for example when calling a Service after clicking a button). Also, I do not have recording of calls done to my Controllers.

Any pointer to why I am in this situation?

Thanks.

private def closure causes MissingMethodException if applying grails-melody

After applying grails-melody, a calling private def closure will definitely cause such exception. The issue seems that
if(!found && delegate.metaClass.properties.find {it.name == name}){
def prop = delegate.metaClass.properties
def property = delegate."${name}"
if(property instanceof Closure){
found = true
metaMethod = [doMethodInvoke: {dlg, arguments-> property.call(arguments)}]
}
}
The target is at delegate."${name}", but it doesnot exist in delegate.metaClass.properties

grails-melody-plugin is not compatible with tomcat7 from version 1.55 onwards

It should be noted somewhere that the plugin from version 1.55 shouldn't be used with tomcat7!

If you have a controller action like that:

def download() {
        ....
            response.addHeader("Content-Type", "application/octet-stream")
            response.setContentType("application/octet-stream")
            response.setHeader("Content-disposition", "attachment;filename=export-" + filename)
            response.outputStream << file.newInputStream()
        ....
 }

You will get an exception like that:

May 28 12:59:55 ec2-qa-env errors.GrailsExceptionResolver ERROR ClassNotFoundException occurred when processing request: [GET] /export/download
javax.servlet.WriteListener. Stacktrace follows:
May 28 12:59:55 localhost java.lang.ClassNotFoundException: javax.servlet.WriteListener
May 28 12:59:55 localhost     at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
May 28 12:59:55 localhost     at java.lang.Class.getDeclaredMethods(Class.java:1860)
May 28 12:59:55 localhost     at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
May 28 12:59:55 localhost     at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
May 28 12:59:55 localhost     at com.comp.controller.cube.ExportController.download(ExportController.groovy:248)
May 28 12:59:55 localhost     at net.bull.javamelody.JspWrapper.invoke(JspWrapper.java:150)
May 28 12:59:55 localhost     at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:285)
May 28 12:59:55 localhost     at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
May 28 12:59:55 localhost     at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
May 28 12:59:55 localhost     at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
May 28 12:59:55 localhost     at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
May 28 12:59:55 localhost     at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
May 28 12:59:55 localhost     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
May 28 12:59:55 localhost     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
May 28 12:59:55 localhost     at java.lang.Thread.run(Thread.java:745)
May 28 12:59:55 ec2-qa-env errors.GrailsExceptionResolver ERROR IllegalStateException occurred when processing request: [GET] /export/download
getOutputStream() has already been called for this response. Stacktrace follows:
May 28 12:59:55 localhost org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: getOutputStream() has already been called for this response
May 28 12:59:55 localhost     at net.bull.javamelody.JspWrapper.invoke(JspWrapper.java:150)
May 28 12:59:55 localhost     at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:285)

javamelody requires javax.servlet:javax.servlet-api:3.1.0.
It was introduced with this bug fix : https://code.google.com/p/javamelody/issues/detail?id=436
Tomcat7 doesn't support this servlet spec!

Didnt trace the spring bean

Hi There

I put @net.bull.javamelody.MonitoredWithSpring into one of my helper class ( initialized by spring in resource.groovy ) and one controller class

But i didn't see any trace of them in Statistics spring.

Just wondering if i did the right way

Cheers
Wallace

Exception: Connection has already been closed

With update to the 1.70.0 version of Melody. We avoided the #48 but it seems that we have got the jdbc connections leakage.

From our log:

Caused by SQLException: Connection has already been closed.
->> 197 | invoke in net.bull.javamelody.JdbcWrapper$ConnectionInvocationHandler

We suppose, that we catch the bug here, because we are using pooled option in our Grails app datasource configuration.

Comparing the log output of 1.67 and 1.70 we noticed that the 1.70 wraps one additional bean dataSourceUnproxied. Excluding this bean from wrapping seems helped as a workaround.

Could you check the BBP approach in conjunction with db pool enabled?

GrailsMelodyConfig: System.properties missing

Not sure if it is a GrailsMelody or general Grails issue.

Use Case

I want to use -Dsystem_property arguments in GrailsMelodyConfig.

Example

javamelody.'storage-directory' = System.properties['storageDir']

I would now expect Grails/Java-Melody to use whatever I pass as -DstorageDir as its storage directory.

But System.properties['storageDir'] seems to be not present while GrailsMelodyConfig is initialized.

Steps to reproduce

Step 1. Create new grails 2.5.3 project

grails create-app where-are-my-system-properties

Step 2. Add grails-meldody dependency to BuildConfig

// […]
plugins {
// […]
  compile ":grails-melody:1.57.0"
}
// […]

Step 3. Refresh deps

grails refresh-dependencies

Step 4. Configure stuff in generated GrailsMelodyConfig.groovy

// if -DstorageDir is set and not empty, then use it, else try '/no-storage-dir-set' as fallback.
javamelody.'storage-directory' = "${System.properties['storageDir'] ?: '/no-storage-dir-set'}/javamelody"

Step 5. Build WAR

grails war

Step 6. Create setenv.sh in apache-tomcat 8.0.26

#! /bin/sh

export CATALINA_OPTS="$CATALINA_OPTS -DstorageDir=/media/tmpfs"

Step 7. Start Tomcat and deploy WAR created in Step 5 to ROOT context

Now open the monitoring page in browser.

  • http://www.localhost:8080/monitoring#systeminfo shows that storageDir-system-property was properly passed:

JVM arguments: -Djava.util.logging.config.file=/home/meyerfa/Tomcat/apache-tomcat-8.0.26/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-DstorageDir=/media/tmpfs
-Djava.endorsed.dirs=/home/flxtr/Tomcat/apache-tomcat-8.0.26/endorsed
-Dcatalina.base=/home/flxtr/Tomcat/apache-tomcat-8.0.26
-Dcatalina.home=/home/flxtr/Tomcat/apache-tomcat-8.0.26
-Djava.io.tmpdir=/home/flxtr/Tomcat/apache-tomcat-8.0.26/temp

  • But JavaMelody’s debugging logs show, that it obviously was not present during the GrailsMelodyConfig initialization, so the fallback were set:

JavaMelody 1.57.0 Debugging logs

Thu Dec 17 09:42:58 CET 2015 DEBUG JavaMelody listener init started
Thu Dec 17 09:42:58 CET 2015 DEBUG datasources found in JNDI: []
Thu Dec 17 09:42:58 CET 2015 DEBUG JavaMelody listener init done in 23 ms
Thu Dec 17 09:43:06 CET 2015 DEBUG JavaMelody filter init started
Thu Dec 17 09:43:06 CET 2015 DEBUG OS: Linux unknown, amd64/64
Thu Dec 17 09:43:06 CET 2015 DEBUG Java: Java(TM) SE Runtime Environment, 1.8.0_45-b14
Thu Dec 17 09:43:06 CET 2015 DEBUG Server: Apache Tomcat/8.0.26
Thu Dec 17 09:43:06 CET 2015 DEBUG Webapp context:
Thu Dec 17 09:43:06 CET 2015 DEBUG JavaMelody version: 1.57.0
Thu Dec 17 09:43:06 CET 2015 DEBUG JavaMelody classes loaded from: file:/home/flxtr/Tomcat/apache-tomcat-8.0.26/webapps/ROOT/WEB-INF/lib/javamelody-core-1.57.0.jar
Thu Dec 17 09:43:06 CET 2015 DEBUG Host: [email protected]
Thu Dec 17 09:43:06 CET 2015 DEBUG parameter defined: storage-directory=/no-storage-dir-set/javamelody
Thu Dec 17 09:43:06 CET 2015 DEBUG parameter defined: displayed-counters=http,sql,error,log,spring,jsp
Thu Dec 17 09:43:06 CET 2015 DEBUG log listeners initialized
Thu Dec 17 09:43:06 CET 2015 DEBUG datasources found in JNDI: []
Thu Dec 17 09:43:06 CET 2015 DEBUG counters initialized
Thu Dec 17 09:43:06 CET 2015 DEBUG counters data read from files in /no-storage-dir-set/javamelody/_falxDell
Thu Dec 17 09:43:06 CET 2015 DEBUG collect task scheduled every 60s
Thu Dec 17 09:43:06 CET 2015 WARN exception while collecting data: java.io.IOException: JavaMelody directory can't be created: /no-storage-dir-set/javamelody/_falxDell
Thu Dec 17 09:43:06 CET 2015 DEBUG first collect of data done
Thu Dec 17 09:43:06 CET 2015 DEBUG JavaMelody filter init done in 51 ms
Thu Dec 17 09:43:07 CET 2015 WARN exception while collecting data: java.io.IOException: JavaMelody directory can't be created: /no-storage-dir-set/javamelody/_falxDell

Also reproducible with Jetty. With grails run-app in GGTS it works as expected.

Grails 3.x - Monitoring page accessible event with Spring Security Core configured

Hi guys

I'm using the latest Grails 2.x version of the plugin 1.59.0

I tried to secure the monitoring endpoint with Spring Security without success as follows:

grails.plugins.springsecurity.controllerAnnotations.staticRules = [
        '/monitoring/**': ['ROLE_DEVELOPER']
]

and also I tried

grails.plugin.springsecurity.interceptUrlMap = [
        '/monitoring/**': ['ROLE_DEVELOPER']
] 

Am I doing something wrong? Is this a known bug?

Thanks

"Connection is closed" issue when Tomcat recreates connection

After having network issues between my Grails app and the Postgres DB on AWS, JDBC connections needed to be recreated by Tomcat. It did so, but then my app would somewhat end up with connections that are closed when executing transactions afterward.

After a long investigation, the issue was not happening when removing the JavaMelody plugin from my app. So I dug a bit to find what was happening and saw that the SpringDataSourceBeanPostProcessor was proxying three DataSources (dataSourceUnproxied, dataSourceLazy and dataSource).

I tried configuring it to only proxy one of them. By proxying dataSourceUnproxied, JDBC queries are still monitored by JavaMelody and when connections are recreated by Tomcat everything seems to be working as expected.

I suggest we add "dataSourceLazy" and "dataSource" in the excluded list of proxyed datasource in GrailsMelodyPluginGrailsPlugin or at least write some documentation about configuration of the plugin with Tomcat (default Grails configuration).

I have a pull-request with this "fix". Tell me what you think about this issue / fix.

Thanks.

Caches are not listed in the monitoring page

I am using grails 3 with the following plugins
compile 'org.grails.plugins:grails-melody-plugin:1.76.1' compile ('org.grails.plugins:cache-ehcache:3.0.0.M1') compile "org.grails.plugins:cache:5.0.0.RC1"
In grails 2, there was a cache section. This section is missing with the grails 3 version of the plugin.
I know that support for monitoring ehcache 3 has recently been added to javamelody.
See this thread for more information:
javamelody/javamelody#574 (comment)

Is there a plan to also add support for it in this plugin?

Thanks,
Gabi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.