tomdcc / grails-miniprofiler

Miniprofiler plugin for Grails
Other
16 stars 4 forks source link

Add http requrests profiler #5

Open dadmin opened 11 years ago

dadmin commented 11 years ago

Hi... Is it possible to add HTTP profiling? It will be very useful for SOLR/Elasticsearch profiling

tomdcc commented 11 years ago

Hi dadmin. Could you explain what sort of information you want profiled?

dadmin commented 11 years ago

SOLR / Elasticsearch has REST API. Our service is based on SOLR. We have plain old DB but mostly we use SOLR. So we need tool that will give us more info about REST API comunication.

  1. What HTTP requests was made during the processing the request
  2. How long service (SOLR) was answering
  3. (optional) HTTP Request / Response data - url, params, headers, body

note: I'm talking about debugging HTTP requests that my service do during processing my request

tomdcc commented 11 years ago

Hi dadmin. In the next version of the plugin I plan to pull most of the functionality out into a core java library and just leave the grails-specific bits in the plugin. Then I would imagine that a SOLR-specific wrapper could be more easily developed.

In the meantime you could instrument your solr service by getting a handle on the current MiniProfiler object (inject the profilerProvider spring bean into the service and call getCurrentProfiler()) and then adding timings by calling the step() method. You can even add specific values to a timing - see the keyValues map on the Timing object. I presume that those get displayed in some sort of way by the javascript in the front end, but I haven't tried it myself.

I'm going to leave this open as a reminder to make some sort of http client profiling a feature of the split-out java code.

dadmin, which http client library are you using?

fedotxxl commented 11 years ago

Hi. We are using httpClient (java version) or httpBuilder (groovy wrapper). By the way pls check this suggestion - http://grails.1312388.n4.nabble.com/Let-s-create-one-more-plugin-together-tp4645756.html . I think your plugin perfectly suits this suggestion