Appspy collected data

Common collected data

Name Type Database field Data provider (by default) Description
organization String Org.orgCode ConfigBasedOrganizationDataProvider The code of the organization (company, business unit, entity).
environment String Env.envCode ConfigBasedEnvironmentDataProvider The code of the environment (production, test, ...).
application String App.appCode ServletContextBasedApplicationDataProvider The code of the application.
version String AppVersion.versionName ServletContextBasedVersionDataProvider The version of the application.
host String Host.hostName HostDataProvider The name of the host on which the data is collected.
collection date java.util.Date Hit.hitDate TimerDataProvider Date/Time of the data collection.
timer delay long Hit.hitDelay TimerDataProvider Elapsed time (in ms).
blocking delay long Hit.blockingDelay TimerDataProvider Elapsed time during the thread was blocked (ms). According to : http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadInfo.html#getBlockedTime()
blocking count long Hit.blockingCount TimerDataProvider Number of times the thread was blocked. According to : http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadInfo.html#getBlockedCount()
cpu time long Hit.cpuTime TimerDataProvider Thread CPU time (in ns). According to : http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadMXBean.html#getCurrentThreadCpuTime()
cpu user time long Hit.cpuUserTime TimerDataProvider Thread CPU user time (in ns). According to : http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadMXBean.html#getCurrentThreadUserTime()
wait delay long Hit.waitDelay TimerDataProvider Elapsed time during the thread was waiting (ms). According to : http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadInfo.html#getWaitedTime()
wait count long Hit.waitCount TimerDataProvider Number of times the thread has been waiting. According to : http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadInfo.html#getWaitedCount()
timer type int Hit.delayType TimerDataProvider Timer type. (for the moment, only PerfTimeTpye.SERVER is supported)
result int Hit.hitResult ResponseCodeDataProvider SUCCESS = 1 ; ERROR = -1

Webapp specific collected data

Name Type Database field Data provider (by default) Description
context path String Webapp.webappName ContextPathDataProvider The path of the webapp.
url String Feature.featureName URLDataProvider The requested URL.
response code int HitURL.responseCode ResponseCodeDataProvider The HTTP response code (200, 404, ...).
http method String HitURL.method HttpMethodDataProvider The HTTP method requested (GET, POST, ...).
remote user String Hit.userId UserDataProvider The user name.
session id String Session.sessionCode SessionDataProvider The id of the HTTP session.
is new session boolean HitURL.isNewSession SessionDataProvider True if this session has just been created by this request.
remote IP String ClientHost.clientHostIP RemoteIPDataProvider IP address of the HTTP client.
query string size int HitURL.queryStringSize QueryStringSizeDataProvider The size of the query string.
input header size long HitURL.inputHeaderSize InputHeaderSizeDataProvider The size of the request headers.
input byte size long HitURL.inputStreamSize InputByteSizeDataProvider The size of the input stream that was read by the servlet.
output header size long HitURL.outputHeaderSize OutputHeaderSizeDataProvider The size of the response headers.
output byte size long HitURL.outputStreamSize OutputByteSizeDataProvider The size of the stream send in the response.
parameters ListString, String URLParam.urlParamName and URLParVal.urlParamValue ParametersDataProvider The parameters of the request.

The data providers for web applications

Those data are provided by classes that implements the interface org.appspy.perf.servlet.provider.DataProvider.

ConfigBasedEnvironmentDataProvider sets the environment code according to the value "environment" of the config property file.
ConfigBasedOrganizationDataProvider sets the organization code according to the value "organization" of the config property file.
ContextPathDataProvider sets the context path using HttpServletRequest.getContextPath().
HostDataProvider sets the host name using InetAddress.getLocalHost().getCanonicalHostName().
HttpMethodDataProvider sets the HTTP method using HttpServletRequest.getMethod().
InputByteSizeDataProvider sets the size of the stream read by the servlet.
InputHeaderSizeDataProvider sets the size of the request headers.
OutputByteSizeDataProvider sets the size of the response stream.
ParametersDataProvider sets the name/values of the parameters.
QueryStringSizeDataProvider sets the size of the query string.
RemoteIPDataProvider sets the client ip using HttpServletRequest.getHeader("x-forwarded-for") or if not present : HttpServletRequest.getRemoteAddr()
ResponseCodeDataProvider sets the result and the response code
ServletContextBasedApplicationDataProvider sets the code of the application using the servlet context parameter "org.appspy.applicationName".
ServletContextBasedEnvironmentDataProvider sets the code of the environment using the servlet context parameter "org.appspy.environment". (Not used in the default configuration)
ServletContextBasedOrganizationDataProvider sets the code of the organization using the servlet context parameter "org.appspy.organization". (Not used in the default configuration)
ServletContextBasedVersionDataProvider sets the version using the servlet context parameter "org.appspy.version".
SessionDataProvider sets the session id and is new session using HttpServletRequest.getSession(false).getId() and HttpServletRequest.getSession(false).isNew()
TimerDataProvider sets collection date, timer delay, cpu time, cpu user time, wait delay, wait count, blocking delay and blocking count.
URLDataProvider sets the request URL.
UserDataProvider sets the user of the application using HttpServletRequest.getRemoteUser().

Data provider configuration

The data providers are configured in the webapp configuration file (appspy-webapp-${appspy-mode}.xml).

Every data provider have to be declared in this file and added to the list of the data providers of the bean webappDataProvider.

        <bean id="webappDataProvider" class="org.appspy.perf.servlet.provider.CompositeDataProvider">
                <property name="dataProviders">
                        <list>
                                ...
                                <ref bean="userProvider"/>
                                ...
                        </list>
                </property>
        </bean>
        
        ...
        
        <bean id="userProvider" class="org.appspy.perf.servlet.provider.UserDataProvider">
        </bean>
        

Create your own data provider

For different reasons you may need to change the behaviour of the data collection. This can be achieved by implementing a data provider. Here is the DataProvider interface :

public interface DataProvider {

        public void beforeRequest(ServletTimerData servletTimerData, HttpServletRequest req, HttpServletResponse res, ServletContext servletContext);
        
        public void afterRequest(ServletTimerData servletTimerData, HttpServletRequest req, HttpServletResponse res, ServletContext servletContext, Throwable throwable);
}

Example : the SessionDataProvider collects informations about the HttpSession. This is done after the process of the request by the applications since the session may have not been created before.

        public void beforeRequest(ServletTimerData servletTimerData, HttpServletRequest req, HttpServletResponse res,
                        ServletContext servletContext) {

        }

        public void afterRequest(ServletTimerData servletTimerData, HttpServletRequest req, HttpServletResponse res,
                        ServletContext servletContext, Throwable throwable) {

                try
                {
                        HttpSession session = req.getSession(false);
                        if (session != null)
                        {
                                servletTimerData.setSessionId(session.getId());
                                servletTimerData.setNewSession(session.isNew());
                        }
                }
                catch (Throwable t)
                {
                        CollectorFactory.getCollectorInfo().setStatus(CollectorInfo.STATUS_ERROR, t);
                }

        }