Monday, August 12, 2013

Persist timing data from Spring Insight

Spring Insight is a powerful tool for tracing time spent in various methods during the progress of a web application call. While you can export traces from the Insight UI, the resultant file is in binary format, and can only be opened with the Insight UI itself. Fortunately, there is a workaround if you want to persist the data recorded during a call.
Insight adds extra headers to the repsonse object from a call - X-TraceId and X-TraceUrl. The traceId is (unsurprisingly) the id of the compelted trace and the trace url is a link to the trace on the Insight server that is in the form "/insight/services/traces/?type=[json|xml] with json as the default.
If you enter this url into your browser, the Insight server will return the data from the call in the selected format.
If you can access the response headers programattically (e.g. in a headerless browser, or using a proxy) you will be able to access the X-TraceId and X-TraceUrl values and from there can request and persist the Insight data.

No comments: