tomdcc / grails-miniprofiler Goto Github PK
View Code? Open in Web Editor NEWMiniprofiler plugin for Grails
License: Other
Miniprofiler plugin for Grails
License: Other
Hi... Is it possible to add HTTP profiling? It will be very useful for SOLR/Elasticsearch profiling
Tha combination below is creates a lock in mysql:
class NewDomainClass {
def newService
def afterInsert = {
NewDomainClass.withNewSession {
new PrettyNewDomainClass(ndc: this).save(flush: true)
}
}
}
class PrettyNewDomainClass {
NewDomainClass ndc
}
class NewService {
static transactional = true
def add() {
new NewDomainClass().save()
}
}
newService.add() call from a controller for example generates
Lock wait timeout exceeded; try restarting transaction. Stacktrace follows:
Message: Lock wait timeout exceeded; try restarting transaction
Line | Method
->> 1078 | createSQLException in com.mysql.jdbc.SQLError
| 4120 | checkErrorPacket in com.mysql.jdbc.MysqlIO
| 4052 | checkErrorPacket . in ''
| 2503 | sendCommand in ''
| 2664 | sqlQueryDirect . . in ''
| 2815 | execSQL in com.mysql.jdbc.ConnectionImpl
| 2155 | executeInternal . in com.mysql.jdbc.PreparedStatement
| 2458 | executeUpdate in ''
| 2375 | executeUpdate . . in ''
| 2359 | executeUpdate in ''
| 1021 | executeUpdate . . in net.sf.log4jdbc.PreparedStatementSpy
Relevant plugins:
runtime ':profiler:0.5-SNAPSHOT'
runtime ':miniprofiler:0.2'
compile ":spring-security-core:1.2.7.3"
compile ":spring-security-ldap:1.0.6"
Entered the wrong password and instead of being redirected(?) to the login page with a flash message telling me that the username/password combination is invalid, I received this exception:
groovy.lang.MissingPropertyException: g
at ProfilerGrailsPlugin$_processController_closure4.doCall(ProfilerGrailsPlugin.groovy:171)
at LoginController$_closure6.doCall(LoginController.groovy:108)
at com.linkedin.grails.profiler.ProfilerFilter.doFilterInternal(ProfilerFilter.java:82)
at com.energizedwork.miniprofiler.MiniProfilerFilter.doFilterInternal(MiniProfilerFilter.java:37)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
More info:
Error 500: Internal Server Error
URI
/assetManagement/login/authfail
Class
groovy.lang.MissingPropertyException
Message
g
Around line 108 of grails-app/controllers/LoginController.groovy
105: msg = g.message(code: "springSecurity.errors.login.locked")106: }107: else {108: msg = g.message(code: "springSecurity.errors.login.fail")109: }110: }111:
Around line 82 of ProfilerFilter.java
79: // Pass execution on to the next filter.80: ProfilerFilterResponse filterResponse = new ProfilerFilterResponse(response);81: try {82: filterChain.doFilter(request, filterResponse);83: }84: finally {85: // End time.
Around line 37 of MiniProfilerFilter.java
34: miniProfiler = profilerProvider.start(ProfileLevel.Info);35: httpServletResponse.addHeader("X-MiniProfiler-Ids", "["" + miniProfiler.getId().toString() + ""]");36: }37: filterChain.doFilter(httpServletRequest, httpServletResponse);38: } finally {39: if(miniProfiler != null) {40: miniProfiler.stop();
Hi,
you're plugin is AWESOME :-). I was in your talk last GGX 2012 but I couldn't try the plugin because it wasn't compatible with Grails 2.1.X. Now I've tried it and it's really cool.
There is a problem if the grails application uses mongdb plugin with transactional mongo services.
I've some services with:
static transactional = 'mongo'
And during my app startup I've got the following error:
Configuring Spring Security Core ...
... finished configuring Spring Security Core
2013-08-15 13:26:35.530 ERROR GrailsContextLoader:213 - Error executing bootstraps: Error creating bean with name 'userDynDataService': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManager' of bean class [org.springframework.aop.framework.ProxyFactoryBean]: Bean property 'transactionManager' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDynDataService': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManager' of bean class [org.springframework.aop.framework.ProxyFactoryBean]: Bean property 'transactionManager' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManager' of bean class [org.springframework.aop.framework.ProxyFactoryBean]: Bean property 'transactionManager' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
... 5 more
If I comment out the line static transaction = 'mongo'
in userDynDataService
the app starts ok.
Regards, Iván.
Currently miniprofiler is enabled only for default data source. It will be great to add support for all data sources present in application.
After quick inspection of plugin source, I modified MiniprofilerGrailsPlugin.groovy and, in doWithSpring closure, replaced
BeanConfiguration dataSourceConfig = springConfig.getBeanConfig('dataSource')
if(dataSourceConfig) {
springConfig.addBeanConfiguration("dataSourceOriginal", dataSourceConfig)
dataSource(ProfilingDataSource, ref('dataSourceOriginal'), profilerProvider)
}
with
List<String> dataSourceBeanNames = springConfig.getBeanNames().findAll { it.startsWith("dataSource") && it.indexOf("Unproxied") == -1}
dataSourceBeanNames.each { String dataSourceBeanName ->
BeanConfiguration dataSourceConfiguration = springConfig.getBeanConfig(dataSourceBeanName)
if (dataSourceConfiguration) {
springConfig.addBeanConfiguration("${dataSourceBeanName}_Original", dataSourceConfiguration)
"${dataSourceBeanName}"(ProfilingDataSource, ref("${dataSourceBeanName}_Original"), profilerProvider)
}
}
With this change only, I was able to get sql profiling for all data sources available in app.
The miniprofiler's namesake supports AJAX request timings. With dynamic apps, this can be a non-trivial amount of requests that could use the miniprofiler to help with performance tuning.
Hi there,
I'm getting the following exception when trying the build the plugin.
Error generating web.xml file (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
groovy.lang.MissingMethodException: No signature of method:
groovy.xml.dom.DOMCategory$NodesHolder.putAt() is applicable for argument types:
(java.lang.Integer, java.lang.String) values:[0,com.energizedwork.miniprofiler.ProfilingGrailsPageFilter]
Possible solutions: putAt(java.lang.String, java.lang.Object), getAt(java.lang.String), wait(), dump(), item(int), print(java.io.PrintWriter)
at MiniprofilerGrailsPlugin$_closure1.doCall(MiniprofilerGrailsPlugin.groovy:68)
at _GrailsPackage_groovy$_run_closure5_closure10.doCall(_GrailsPackage_groovy:121)
at _GrailsPackage_groovy$_run_closure5_closure10.doCall(_GrailsPackage_groovy)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at _GrailsPackage_groovy$_run_closure5.doCall(_GrailsPackage_groovy:119)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at rg.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
...
I could get rid of the exception but then it appears not updating the web.xml file at all (and consequently failing on Spring injections).
Would be nice if you could have a look at this.
Ondrej
I know it's not your plugin exactly, but I got this working on Grails 2.2 this morning by modifying the profiler plugin as depicted in the attached file.
In the main plugin file, add some ? to beanConfig and beanDefinition on line 85 (and I think on 86/87 just to be safe?)
then in the 'else' section below that, add a 'if(beanConfig)' block to skip that code if the beanConfig is null.
The profiler plugin is not on github or in any version control I can submit a patch to. :/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.