Skip to content

PerfectCarl/play-profiler

Repository files navigation

profiler

The profiler module is a simple but effective mini-profiler for Play 1.2 and 1.3.

A demo is available (the complete source code is available at github)

This project is heavily inspired from mini-profiler and java implementation done by alvin’s java-mini-profiler and

Features

Server side calls

The module logs the duration for the following:

  • total request (routing included): time spent from PlayPlugin.routeRequest to the PlayPlugin.afterInvocation
  • action: time spent in the controller action

Ajax calls

The module logs the subsequent Ajax calls:

Play internal monitoring

The module displays Play internal monitor statistics (querying Jamon data).

Custom code profiling

You may profile your own code using MiniProfiler class.

import play.modules.profiler.MiniProfiler;
import play.modules.profiler.Step;
...

    public static void custom() {
        step = MiniProfiler.step("database", "DB calls");
        List result;
        try {
            result = Data.findAll();
        } finally {
            step.close();
        }
        render(result);
    }

Supports Google App Engine

The profiler works with Google App Engine which hosts the demo

Getting started

Add the module to your application:

require:
    - play
    - carl -> profiler 0.6.9.3
repositories:        
    - githubModules:
        type: http
        artifact: "https://github.com/PerfectCarl/play-[module]/raw/master/dist/[module]-[revision].zip"
        contains:
            - carl -> *

Then include the profiler’s css and javascript resources in your root template file(likely main.html) :

<html>
    <head>
		...
		${profiler.styles.raw()}     
	</head>
	<body>
		...
		${profiler.scripts.raw()}    
    </body>
</html>

Sample application

A complete sample is available demonstrating the use of the module.

How to build

play deps
play build-module

The zip file is created in the dist folder.

Then open the zip file created in the dist/ folder and delete the following:

  • the sample folder
  • the eclipse folder
  • lib/appengine*.jar

About

mini-profiler for play1

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published