Http Sensor

Available with version 1.3

Overview

The http sensor allows to keep track of http related information within your application. Each http based request that your application gets will be displayed and measured. You get the request URI, all headers, parameters and attributes that were provided with the request. As the http sensor also captures the time each request took you get a very good overview about which http operation took the most time in your system. As the http sensor also fully supports navigation you can easily navigate to the invocation sequences that were executed for each http request and thus diagnose a problematic runtime with ease.

The http sensor only provides one measurement per invocation. Think of it like that: If you instrument a Filter Chain which in fact passes the request from one filter to the next filter you do not want to have multiple http timers measured as this would complicate analysis later. Just think what an approach like that would mean: You would get multiple http timers for one request. The aggregate view will thus show the calls to some specific URL multiple times (a higher count value) than it really happened (it only happened once).

Please see the WORKING WITH ... pages for further information of how the http timer can be used to monitor and diagnose your system.

Configuration

Configuration basics

Using the UI configuration interface no configuration is required at all as method sensor types are activated automatically if a profile defines such sensor assignment. 

Enabling session attribute capturing

The Http sensor can capture information about the http session that is currently associated with the respective request. In the current realization the http sensor always captures the session attributes at the start of the invocation. This capturing is disabled by default. Session capturing will never open a new http session, but just read data from an existing one.

Configuration using UI configuration interface

The HTTP session capturing setting is available under Sensor options part in the Environment configuration.

Sensor assignment

Usually you do not need to change the assignment of the http sensor as inspectIT provides an out-of-the-box assignment for the http sensor. You can have a look at this instrumentation at the file http.cfg in the Out-of-the-box instrumentation or in the HTTP Common profile if you are using UI configuration. If you want to make additional assignments, please be aware of the following rules:

  • The http sensor assumes that it is attached to methods that provide a ServletRequest object as first parameter. It will check if the given parameter is in fact also realizing HttpServletRequest as only this will provide the necessary http information. If the object does not realize this interface, nothing will be done
  • If you attach the sensor to a method that does not provide a HttpServletRequest (as runtime class of the object) within the first parameter, the sensor will never provide any information at all.

Other options

Regular expression URI modification

from version 1.5

Not available under UI based configuration interface.

 Old configuration settings...

The HTTP sensor definition brings the possibility to define the regular expression that can be used to transform the URI during the analysis in the User interface. The following example extracts the second part of the URI

method-sensor-type http info.novatec.inspectit.agent.sensor.method.http.HttpSensor MAX stringLength=500 regEx=/[\w]+/([\w]+).* 

With following settings, when activated in the User interface, following URI transformation occur:

Without RegEx transformationWith RegEx transformation

/dvdstore/browse
/dvdstore/checkout
/dvdstore/complete
/dvdstore/confirm
/dvdstore/dvd
/dvdstore/dvd/104
/dvdstore/dvd/112
/dvdstore/dvd/114
/dvdstore/dvd/118
/dvdstore/dvd/123
/dvdstore/dvd/129
/dvdstore/home

browse
checkout
complete
confirm
dvd
home

From above we can conclude that all the dvd actions have been grouped to one single group.

No white-spaces allowed in RegEx

 Although matching white spaces is allowed in the regular expression, due to the limitations in reading the configuration file in this case it's not allowed.

Defining Templates

[DEPRECATED] Configuration using configuration file(s)

It is also possible to define the template that will be displayed in combination with the transformed URI. For example, the following settings:

method-sensor-type http info.novatec.inspectit.agent.sensor.method.http.HttpSensor MAX stringLength=500 regEx=/[\w]+/([\w]+).* regExTemplate=Action:$1$ 

will substitute the $1$ marker with the first extracted group from the regular expression transformation. The same set of URI from the previous example, would now look like this:

Without RegEx transformationWith RegEx transformation

/dvdstore/browse
/dvdstore/checkout
/dvdstore/complete
/dvdstore/confirm
/dvdstore/dvd
/dvdstore/dvd/104
/dvdstore/dvd/112
/dvdstore/dvd/114
/dvdstore/dvd/118
/dvdstore/dvd/123
/dvdstore/dvd/129
/dvdstore/home

Action:browse
Action:checkout
Action:complete
Action:confirm
Action:dvd
Action:home

It is also possible to extract more groups with the regular expression and combine them into more meaningful transformation output. Since the first part of the example URIs we have is dvdstore, it is clear that that represents the name of our application. Thus, with following settings:

method-sensor-type http info.novatec.inspectit.agent.sensor.method.http.HttpSensor MAX stringLength=500 regEx=/([\w]+)/([\w]+).* regExTemplate=Application:$1$,Action:$2$ 

We would extract both first and second part of the URI and with defined template, the example results would look like this:

Without RegEx transformationWith RegEx transformation

/dvdstore/browse
/dvdstore/checkout
/dvdstore/complete
/dvdstore/confirm
/dvdstore/dvd
/dvdstore/dvd/104
/dvdstore/dvd/112
/dvdstore/dvd/114
/dvdstore/dvd/118
/dvdstore/dvd/123
/dvdstore/dvd/129
/dvdstore/home
/someotherapp/home
/someotherapp/search

Application:dvdstore,Action:browse
Application:dvdstore,Action:checkout
Application:dvdstore,Action:complete
Application:dvdstore,Action:confirm
Application:dvdstore,Action:dvd
Application:dvdstore,Action:home
Application:someotherapp,Action:home
Application:someotherapp,Action:search

No white-spaces allowed in RegEx Template

As for defining the regEx configuration, the regExTemplate configuration also can not have any white spaces, due to the limitations in reading the configuration file.

Check the Working with the HTTP sensor page for information on how to trun regular expression URI modification on/off in the UI.

Correct regular expression

Make sure that you have defined the correct regular expression to be used. If the expression can not be compiled, transformation option will not be available on the UI. It's recommended that prior to defining the expression, same is tested against the URIs in monitored application.

String length

from version 1.3

Configuration using UI configuration interface

The string length configuration for all sensors is available in the Environment configuration. You can read more about string length limitations Environment configuration page.

Â