Appendix - Custom Action API

Overview

Custom actions are executed when the monitoring agent 'sees' a particular function being executed - that is, custom functions are not based on any errors being detected in the code. A simple example would be writing to the event log when a particular function is encountered.

The user selects a function that should trigger an action or set of actions. This function may be an entry-point, resource call, exception tracking handler or other type. If the function is not typed it will be instrumented for Actions only. At start of JIT compilation for this function, the Performance Monitor (PMonitor) reads the set of custom actions defined for this function from the PMonitor.default.config and actions configuration files. PMonitor then instruments the functions like entry points or resource calls. The PMonitor inserts a snap-in (for each custom action defined in configuration file) - depending on the action, it may be inserted into one or more of the following places:

Three types of custom action functions can be implemented:

The snap in sends  the set of parameters, GUID of entry-point and function execution duration to the custom action. It gets the GUID from the entry-point information of the current thread in Instrumentation.dll. In case the stack does not have an entry-point it should be empty. It gets the duration of the current function's execution from the unmanaged part of PMonitor. At the AppDomainLoader the monitor inserts references to all assemblies that implement actions. These assemblies are defined in PMonitor.default.config in the  “instrumentationAssembly” section.

The signature for implementing a custom action function is:

Public static void Action1(Object[] args, Object eventID, Int32 executionTime, Object exception, Int32 functionID)

The signature for implementing a custom action based on conditions is:

Public static void Action2(Object[] args, Object conditions, Object parameters, Object eventID, Int32 executionTime, Object exception, Int32 functionID)

Actions are set up in the xxx.instrument.config file as:

<ss:actions>

<ss:action name="ActionExample" assembly="CustomActionExample" class="CustomActionExample.ActionExample" method="Action1" />

<ss:action name="ActionExampleForConditions" assembly="CustomActionExample" class="CustomActionExample.ActionExample" method="Action2" />

</ss:actions>

To associate monitored functions (in the xxx.instrument.config file) with actions in the custom action assembly:

<ss:functions>

<ss:function name="System.Web.UI.WebControls.Button.OnClick" module="System.Web.dll">

<ss:action name="ActionExample" position="prefix"/>

</ss:function>

<ss:function name="System.Web.UI.Page.ProcessRequest" paramCount="2" module="System.Web.dll">

<ss:action name="ActionExampleForConditions" position="postfix"/>

</ss:function>

Notes: "prefix" means that the custom action will execute before executing the body of the method . "postfix" means that the custom action will execute after executing the body of the method

Custom Actions Infrastructure

Scenario

Configuration

The user selects a function that will trigger some action or set of actions. This function may be an entry-point, resource, exception tracking, handler or other type.  If the function does not have a type, it will be instrumented for Actions only.

The selected function will execute the Action code except for under the following circumstances:

Disabled domains Actions for a disabled domain will not be called.
Calling from instrumented code If a function is called from a producer function or from some other function in instrumented code, the actions for some of the functions will not be called
Cases when the monitor doesn’t work:  For example, after an agent upgrade, or after an access violation in the agent

At start of JIT compilation of this function, the PMonitor will read the set of custom actions defined for this function from PMonitor.default.config and the actions configuration files.

Instrumentation and action types

The PMonitor instruments the function by the function's main role (such as entry-point or resource). PMonitor then inserts a snap-in for each custom action defined in the configuration file in the following locations:

Restrictions on custom actions implemented in the User's Assembly

The following restrictions apply to Custom Actions:

Interface for custom actions

Custom actions are static functions that are defined in the user's class. The name of class is the action name, and the name of function is the action type. This class will define the custom action which will be implemented by either the “SimpleSyncAction” or “SyncAction” function:

public static void SimpleSyncAction(Object[] args, Object entryPointGUID, long executionTime, Object exception, unsigned long functionID)

 

public static void SyncAction(Object[] args, Object conditions, Object parameters, Object entryPointGUID, long executionTime, Object exception, unsigned long functionID)

The main difference between SimpleSyncAction and SyncAction is that  function data is not collected for SimpleSyncAction, and therefore this action will execute quickly. If the user needs to have collected parameters, then SyncAction should be used.

Example

namespace PerfCountersActions

{

public class ResourceCounterAction

{

public static void SimpleSyncAction(Object[] args, Object eventID, Int32 executionTime, Object exception, Int32 functionID)

{

}

}

public class EntryPointCounterAction

{

public static void SyncAction(Object[] args, Object conditions, Object parameters, Object eventID, Int32 executionTime, Object exception, Int32 functionID)

{

}

}

}

Arguments of Actions

args Contains the list of monitored function arguments packed into an array of objects.
conditions Contains a string with the entry-point keys collected by the entry-point producer. This is an XML fragment collected by the prefix entry-point producer.
Null If the monitored function is not an entry-point and does not collect data in the prefix.
parameters Contains a string with parameters of the function collected before exiting the function. This is an XML fragment collected by the postfix entry-point and resource producer.
eventID Unique ID of the event in the context of the monitored function that is executed.
Null If the function is executed out of the event context boundary
executionTime The monitored function's execution time.
exception If this function ends by exception then this parameter contains a reference to the thrown exception object
Null If the function exits by a regular return.
functionID The FuncionID is provided by the Profiling API, used function identity to make unmanaged request to PMonitor.

Additional context information

The majority of information about the context of the function is through the parameters of the Custom Action.  But in the progress of custom actions additional context parameters are needed. An additional API dll provides additional context information by requests.

This API contains a set of functions that can be called inside of the custom action. The API function will make an unmanaged call to PMonitor or a managed call to Instrumentation dll. Instrumentation dll will return the current exception context, domain context, and will implement additional common functionality, e.g. calculate hash of condition, provide the static containers for action, etc.

API functions are realized as unmanaged calls to PMonitor. These functions are defined as empty functions in the API dll. To implement a call to PMonitor the JitComplilation will fill the body of the function with a call to PMonitor ( calli ).

Instrumentation API

Due to requirements from the Statistics performance counters action, the following requests have been implemented for context information:

GetDomainInformation()

Return structure Display name, full domain name, application full path, framework version, flag domain excluded. This is static information that could be obtaining from Instrumentation.dll Manager. This structure can be hashed for better performance. InstrumentationAPI does not  hash it and creates it on each request. CustomAction can hash the result for better performance.
Display name  Application display name.
Full domain name  The full domain name from IIS without the last digits (for example, /LM/w3svc/1/root/SessionVariablesTest)
Application path The same value as in the MMC console. For web applications,  WebSiteName/DomainName (for example, Default Web Site/SessionVariablesTest), for other hosts use the application exe full path (with directory name).
Framework version  The current framework version. Silverlight can have different frameworks in one process, but one domain has only one framework version

 

GetProcessInformation()

Returns structure ProcessName, DisplayName, ProcessPath, ProcessID, ProcessStartTime, ApplicationPool, AgentVersion.

This is static information that can be obtained from the Instrumentation.dll Manager.

GetFunctionInformation(FunctionID)

This is an unmanaged call to PMonitor, whereby the PMonitor gets the name of function in the current thread at the  top of the Tracking Threads. It checks consistency by the given functionID, and returns a structure with the function name. The method returns information only about the current top function on the stack, otherwise there is an error.

IsThresholdExceeded(FunctionID)

This method is an unmanaged call to PMonitor, the PMonitor get flag threshold exceeded. This flag is not dependent on the light-heavy, throttling logic. The method only returns information about the current top function on the stack – error otherwise.

This method uses the alerting threshold and is useful for EntryPoints only.

SendEvent(xmlEvent, event class, event version, domain name)

This method sends the prepared event to the Dispatcher. Managed function in Instrumentation.dll.

IsAgentActive()

This method returns a boolean variable – true if the Agent is active, false otherwise. Check this value before accessing other methods.

StartSafeThread(ThreadStart threadStart)

This method starts a thread, safe for the Agent. No methods from that thread will be monitored. Use it for starting your working threads.

GetConfigurationDirectory()

This method returns a path to the directory where the configuration files are located.

This is static information that can be obtained from Instrumentation.dll Manager.

SerializeArgument(FunctionID, argument, collectingRule)

This method returns a fragment of XML containing the collected data of argument in form of event XML. This argument is collected by the rule that defines the “collectingRule” parameter. This function collects the data the same as th eCustom producer and the “collectingRule” is equivalent of “argument” tag of “function” definition in PMonitor.default.config.

GetConditionString(name, value, type)

This method returns a string that represents a condition using the name, type and value. This string can be looked for in the conditions string passed to the SyncAction.

Also instrumentationAPI has helper classes for writing producers.

Configuration of custom actions

The configuration files for all actions placed in the catalog “Agent/[version]/Configuration/Standard”. This directory can be obtained using the GetConfigurationDirectory API function.

Configuration of each action could have next configuration files:

[Action name].instrument.config Configures instrumentation of action.
[Action name].action.config  Configures action logic. This config file is optional.
[Action name].data.config  Defines data collection rules for action. This config file is optional and provided for actions of type “SyncAction”.

Action config

This file configures the  logic of the work of the custom action. The schema of this configuration file is specified for each action. The custom action reads and parses this configuration itself.

Instrumentation config

This file defines how to instrument actions, and which functions in a user application should be instrumented for actions. This file also defines which module implements the action.

<?xml version="0" encoding="utf-16"?>

<ss:configuration xmlns="http://AVICode.com/Intercept/MonitorConfig" xmlns:ss="http://AVICode.com/Intercept/MonitorConfig">

<ss:applicationSetting>

<ss:instrumentationAssemblies>

<ss:instrumentationAssembly name="" keyToken="" version="" locale="" />

</ss:instrumentationAssemblies>

<ss:actions>

<ss:action name="" assembly="" class="" method=""/>

</ss:actions>

<ss:functions>

<ss:function name="" include="" enable="" paramCount="" module="" minVersion="" maxVersion="">

<ss:action name="" position="" include="" enable=""/>

</ss:function>

</ss:functions>

 

<!-- configuration of functions instrumented by actions -->

<ss:applications>

<ss:application name="" displayName="" include="" enable="">

<ss:functions>

<ss:function name="" include="" enable="" paramCount="" module="" minVersion="" maxVersion="">

<ss:action name="" position="" include="" enable=""/>

</ss:function>

<ss:function name="" include="" enable="" paramCount="" module="" minVersion="" maxVersion="">

<ss:action name="" position="" include="" enable=""/>

<ss:action name="" position="" include="" enable=""/>

</ss:function>

</ss:functions>

</ss:application>

</ss:applications>

</ss:applicationSetting>

</ss:configuration>

The "action" tag defines what kind of action is used below. It defines the name of the action referenced below. The assembly, class and method define the instrumentation of the action (Note: the method may be SimpleSyncAction or SyncAction).

Example of custom action definition for function in instrument.config

<?xml version="0" encoding="utf-16"?>

<ss:configuration xmlns="http://AVICode.com/Intercept/MonitorConfig" xmlns:ss="http://AVICode.com/Intercept/MonitorConfig">

<ss:options>

<ss:agentVersion value="8" />

</ss:options>

<ss:applicationSetting>

<ss:detaillevels>

<ss:level name="." parameter="3/10" object="3/10" />

</ss:detaillevels>

<ss:instrumentationAssemblies>

<ss:instrumentationAssembly name="StatisticCounters" keyToken="8750569721733372" version="0" locale="Neutral" />

</ss:instrumentationAssemblies>

<ss:actions>

<ss:action name="StatisticCounter" assembly="StatisticCounters" class="StatisticCounters.StatisticCounter" method="SimpleSyncAction" />

<ss:action name="StatisticCounterForConditions" assembly="StatisticCounters" class="StatisticCounters.StatisticCounter" method="SyncAction" />

</ss:actions>

<ss:applications>

<ss:application name="w3wp.exe" displayName="Web Applications" enable="true">

<ss:functions>

<ss:function name="System.Web.UI.Page.ProcessRequest" paramCount="2" module="System.Web.dll">

<ss:action name="StatisticCounterForConditions" position="postfix"/>

</ss:function>

<ss:function name="DuwamishWeb.Cart.AddItem" module="DuwamishWeb.dll">

<ss:action name="StatisticCounter" position="postfix"/>

</ss:function>

<ss:function name="DuwamishWeb.DailyPickModule.AddToCartButton_Click" module="DuwamishWeb.dll">

<ss:action name="StatisticCounter" position="postfix"/>

</ss:function>

</ss:functions>

</ss:application>

</ss:applications>

</ss:applicationSetting>

</ss:configuration>

Data config

This file is used for configuration for data collection for actions of type “SyncAction”. The data for this action is collected by the producer functions defined for a monitored function in PMonitor.default.config. This file expands the default definition for data collection for a monitored function.

The producer function is defined here for an instrumented function or to describe data collection of additional parameters. This section can be merged with the PMonitor default config in the monitor at load config before parsing the configuration.

If the function is defined in PMonitor.default.config and redefined in [Action].data.config, then the data collection rules in data.config extend the data rules defined in default.config.

This is configuration file format of application settings of the PMonitor default config.

User cannot define the special producer in the configuration. In this case we will use our predefined CustomProducer,

This is slow data producer.

<ss:datacollectionSetting>

<ss:functions>

<ss:function name="IBM.Data.DBDB2Command.ExecuteScalar" methodInfo="" paramCount="1" module="IBM.Data.DBdll" minVersion="0" maxVersion="0">

<ss:instrumentation name="Instrumentation.InstrumentationClass.IBMDB2CommandsProducer" assembly="Instrumentation" />

</ss:function>

</ss:functions>

<ss:classes>

<ss:class name="System.Net.HttpWebRequest" module="System.Web.dll " minVersion="005" maxVersion="0072732">

<ss:member name="_HttpRequestHeaders/System.Net.WebHeaderCollection::m_InnerCollection" detaillevel="2/10" alias="headers" />

<ss:member name="_Uri" alias="address" />

<ss:member name="_OriginVerb" alias="method" />

<ss:member name="_OriginUri" alias="requestUri" />

<ss:member name="_Timeout" />

</ss:class>

</ss: classes>

</ss:datacollectionSetting>

Reading the configuration of actions

The main idea what we can union default configuration with configurations of all actions and parse combined configuration as one file at the moment of parsing configuration in monitor.

The union logic works with instrument.config and data.config.

For instrumentation actions the monitor unions all instrument.config placed in the Standard directory.

For data collection the monitor unions PMonitor.default.config and all data.config files placed in Standard directory.

For the work with united config we use special forms of XPath queries that could get data from all united sections.

Reading data

Instrumentation process

Usage scenario. Cartridges for Duwamish and Jaggle

Agenda:

On the server of a customer are installed several Web applications. IIS is configured for work with 15 applications pools. There is installed Intercept Studio (Including the “BAM Statistics counters” action).

The points of interest of managers are BAM monitoring of Duwamish7 and Jaggle Real Estate applications.

Both applications work in different application pools.

Also the operations personal have configured the operational monitoring of Web Applications on several application pools including Duwamish7 and Jaggle.

The requirements of BAM monitoring of Duwamish application includes the next business activities

The requirements of BAM monitoring of Jaggle Real Estate application includes the next business activities

The customer ordered two cartridges for monitoring these applications.

Requirement for Duwamish Cartridge: Requirement for Jaggle Real Estate Cartridge:
From BAM:
Make a report that contains a chart diagram showing portions of Logon, Submit order pages in comparison to all user activity on the application.
Integrate the added activity metrics to the customer’s BAM system.
From support and operations:
Extend Web Page events to show the Duwamish application specific session variables.
 
From BAM:
Make a report containing a chart diagram showing portions of Logon, Logout, Request Commercial apartments, Request residential apartments in comparison to all user activity on the application. Also it should show percentages of requests from VIP and ordinal clients.

Note: The specifics of this application that the Logon, Logout can be monitored on base of Web pages entry-points.
But the Request commercial apartments, Request residential apartments for VIP clients, and Request residential apartments for usual clients made on base of functions from business level, these functions encapsulated in business layer module and called inside of Web Service.
 
The configuration of cartridge contains:
DuwamishStatistics.action.config
Duwamishdata.config

The DuwamishStatistics.action.config defines the configuration of the Statistics counters for the Logon page, Logout page, Submit order. Duwamishdata.config defines the additional call of the Custom producer function for ProcessRequest and defines data collection rules for classes stored in session cache.
 
The configuration of cartridge contains:
Jaggle.Statistics.instrument.config
Jaggle.Statistics.action.config
Jaggle.data.config

The Jaggle.Statistics.instrument.config defines the instrumentation of the business layer module.
Jaggle.Statistics.action.config defines Entry-point Statistics counters for the Logon, Logout Web Pages. Also it defines the Function Statistics counters for functions in the business layer module that implements Request residential apartments for VIP clients, and Request residential apartments for usual clients.
Jaggle.data.config defines the classes and functions for Business Layer module.
 
The cartridge includes the configuration files, DuwamishProducers.dll, Duwamish report. The cartridge includes the configuration files, Jaggle report.

The cartridge includes the configuration files and the Jaggle report.

The list of instances in group of “.Net Statistic” counters defined on this server:

Instrumentation configuration files

<?xml version="0" encoding="utf-16"?>
<ss:configuration xmlns="http://AVICode.com/Intercept/MonitorConfig" xmlns:ss="http://AVICode.com/Intercept/MonitorConfig">
<ss:applicationSetting>
<ss:instrumentationAssemblies>
<ss:instrumentationAssembly name="StatisticCounters" keyToken="4565654878" version="0.0.0" locale="Neutral" />
</ss:instrumentationAssemblies>
<ss:actions>
<ss:action name="EntryPointStatisticCounters" assembly="StatisticCounters" class="StatisticCounters.EntryPointCounters" method="SyncAction" />
</ss:actions>
<ss:applications>
<ss:application name="w3pw.exe" displayName="Web Applications" >
<ss:functions>
<ss:function name="System.Web.UI.Page.ProcessRequest" paramCount="2">
<ss:action name="EntryPointStatisticCounters" position="postfix"/>
</ss:function>
</ss:functions>
</ss:application>
</ss:applications>
</ss:applicationSetting>
</ss:configuration>
 
<?xml version="0" encoding="utf-16"?>
<ss:configuration xmlns="http://AVICode.com/Intercept/MonitorConfig" xmlns:ss="http://AVICode.com/Intercept/MonitorConfig">
<ss:applicationSetting>
<ss:instrumentationAssemblies>
<ss:instrumentationAssembly name="StatisticCounters" keyToken="4565654878" version="0.0.0" locale="Neutral" />
</ss:instrumentationAssemblies>
<ss:actions>
<ss:action name="EntryPointStatisticCounters" assembly="StatisticCounters" class="StatisticCounters.EntryPointCounters" method="SyncAction" />

<ss:action name="FunctionStatisticCounters" assembly="StatisticCounters" class="StatisticCounters.FunctionCounters" method="SimpleSyncAction" />
</ss:actions>
<ss:applications>
<ss:application name="w3pw.exe" displayName="Web Applications" >
<ss:function name="System.Web.UI.Page.ProcessRequest" paramCount="2" module="" >
<ss:action name="EntryPointStatisticCounters" position="postfix"/>
</ss:function>

<ss:function name="Business.VIPResApps.Request" >
<ss:action name="FunctionStatisticCounters" position="postfix"/>
</ss:function>

<ss:function name="Business.ResApps.Request">
<ss:action name="FunctionStatisticCounters" position="postfix"/>
</ss:function>

<ss:function name="Business.CommApps.Request" >
<ss:action name="FunctionStatisticCounters" position="postfix"/>
</ss:function>
</ss:application>
</ss:applications>
</ss:applicationSetting>
</ss:configuration>

 

Action configuration files

<?xml version="0" encoding="utf-16"?>
<ss:configuration xmlns:ss="http://AVICode.com/Intercept/Cartridges/StatisticCounterAction">
<ss:actionSettings>
<ss:applications>
<ss:application name="w3wp.exe" displayName="Web Applications" include="true" enable="true">
<ss:appdomains>
<ss:appdomain name="Default Web Site\Duwamish7" displayName="Duwamish7">
<ss:functions>
<ss:function name="System.Web.UI.Page.ProcessRequest" paramCount="2">
<ss:action name="EntryPointStatisticCounters">
<ss:property name="instance" value="TestInstance" />
</ss:action>
</ss:function>
</ss:functions>
</ss:appdomain>
</ss:appdomains>
</ss:application>
</ss:applications>
</ss:actionSettings>
</ss:configuration>

 
<?xml version="0" encoding="utf-16"?>
<ss:configuration xmlns:ss="http://AVICode.com/Intercept/Cartridges/StatisticCounterAction">
<ss:actionSettings>
<ss:applications>
<ss:application name="w3wp.exe" displayName="Web Applications" include="true" enable="true">
<ss:appdomains>
<ss:appdomain name="Default Web Site\JaggleRealEstate" displayName="JaggleRealEstate">
<ss:functions>
<function name="System.Web.UI.Page.ProcessRequest" paramCount="2" module="">
<ss:action name="EntryPointStatisticCounters">
<ss:property name="instance" value="TestInstance" />
</ss:action>
</function>
<function name="Business.VIPResApps.Request" >
<ss:action name="FunctionStatisticCounters">
<ss:property name="instance" value="Business.VIPResApps.Request" />
</ss:action>
</function>
<function name="Business.ResApps.Request" >
<ss:action name="FunctionStatisticCounters">
<ss:property name="instance" value="Business.ResApps.Request" />
</ss:action>
</function>
<function name="Business.CommApps.Request" >
<ss:action name="FunctionStatisticCounters">
<ss:property name="instance" value="Business.CommApps.Request" />
</ss:action>
</function>
</ss:functions>
</ss:appdomain>
</ss:appdomains>
</ss:application>
</ss:applications>
</ss:actionSettings>
</ss:configuration>
 

Custom Actions Applications

Statistic Performance Counters

Overview

Statistics counters for entry-point

Support for defining performance counters (max, arg, count, count/sec) for a specific entry point key (page name, web service method and so on). There is a limit on the number of entry point keys with which that feature is enabled. The perf counter name has a limited size so we use a portion of the page or web service name (when we pick a portion , we take the right side of the name since it is more representative) We  provide a way to view those performance counters in SE-Viewer and expose them in the management pack.

Statistics counters for functions

Support defining performance counters (max, arg, count, count/sec) for a function. We put a limit on number of entry point keys with which that feature is enabled. The perf counter name has a limited size and we use a portion of the function name (when we pick a portion, we  take the right side of the name since it is more representative. We provide a way to view those performance counters in SE-Viewer and expose them in the management pack.

We use first type of callback to support those performance counters.

Dictionary

Business activity monitoring Some functions are threaded as business activity, for example a function in a customer application ProceedOrder – performs the order in customer service. Executing such a function means the business activity execution. We monitor the activity of such functions and represent the results of monitoring as business activity monitoring.
.Net Statistic counters  Represents execution of business activity functions. We link the value of these counters with business activity execution events. Each execution of business activity function increments the appropriate .Net Statistic counter. Each instance of .Net Statistic counter represents the individual business activity.
Entry-point statistics counters  .Net Statistic counters created for entry-points. The Instance depends not only on the function name but on values of the key parameters.  It includes “Calls / sec”, “Avg execution time”, “# Performance violations / sec”, “# Exceptions / sec”

 

Functions statistics counters .Net Statistic counter linked with the execution of business activity function.  It includes “Calls / sec”, “Avg execution time”, “# Exceptions / sec” counters.

The counters mean:

“Calls / sec” – How many calls of this function/entry-point with these parameters was in application.

”Avg execution time” – Average execution time of BAM function. The measure unit is milliseconds.

Special logic has these counters:

“# Performance violations / sec” – How many calls of function/entry-point with these parameters exceeded the threshold in this application

“# Exceptions / sec” – How many calls of function/entry-point with these parameters was finished by exception in this application.

Note: the Entry-point statistics counters defined for BAM function called with appropriate key parameters. So the BAM function call in this case means the call of BAM function with appropriate key parameters

Requirements

Recommendation for Statistics counter instance naming

If the counter defined in context of process or application it should have instance name with name of application or process.

Restrictions

Design

The Statistics counters are implemented in assembly “StatisticCounters.dll”.

They are implemented as custom actions of type “SyncAction” (The Functions Statistic Counters could be implemented as “SimpleSyncAction” due to performance reason.)

The dll “StatisticsCounters.dll” will implement performance counters using standard .Net implementation.

The configuration of Statistic counters will include StatisticCounters.instrument.config and StatisticCounters.action.config.

Statistic Performance Counter structure

Counters group name –”.Net Statistic”

List of counters – “Calls / sec”, “Avg execution time”, “# Performance violations / sec”, “# Exceptions / sec”

Instance name – user defines it in MMC arbitrary. Max length is 80 symbols.

In the UI we support the conditions only for web services and web pages. They are configured in the appropriate entry-point edit dialog. Also allowed to switch on counters for Custom Entry-points edit dialog, in this case the key is function name and application name. Action switched on/off using by combo-box.

This dialog allow user to input instance name that they are want.

StatisticCounters.dll creates counter, increments their value. PerfCounterMonitor collects the counters, pack them into state event and sends to SEViewer.

Multiple Actions configuration files

The “StatisticCounters.action.config” and “StatisticCounters.instrument.config” configuration files are definition of standard set of Statistics counters included in Intercept Studio.

Additional Statistics counters are defined in other Statistics counters action configuration files.

The names of these configuration files should be in the following format:

[Some Name].StatisticCounters.action.config

[Some Name].StatisticCounters.instrument.config.

There “[SomeName]” is an arbitrary name.

Usually value of “[Some Name ]” defined by the cartridge.

Configuration of Statistics Counters in StatisticCounters.instrument.config

Actions definition section

<ss:instrumentationAssemblies>

<ss:instrumentationAssembly name="StatisticCounters" keyToken="TODO:make token" version="0.0.0" locale="Neutral" />

</ss:instrumentationAssemblies>

<actions>

<action name="FunctionStatisticCounters" assembly="StatisticCounters" class="StatisticCounters.FunctionCounters" method="SimpleSyncAction" />

<action name="EntryPointStatisticCounters" assembly="StatisticCounters" class="StatisticCounters.EntryPointCounters" method="SyncAction" />

</actions>

<functions>

Configuration of entry-points instrumentation

<function name="System.Web.UI.Page.ProcessRequest" paramCount="2">

<action name="EntryPointStatisticCounters" position="postfix"/>

</function>

<function name="System.Web.UI.Page.ProcessRequest " paramCount="4">

<action name="EntryPointStatisticCounters" position="postfix"/>

</function>

<function name="System.Web.Services.Protocols.LogicalMethodInfo.Invoke">

<action name="EntryPointStatisticCounters" position="postfix"/>

</function>

Configuration of custom entry points and the BAM functions

...

<function name="[function name]" paramCount="">

<action name="FunctionStatisticCounters" position="postfix"/>

</function>

</functions>

Configuration of Statistics Counters in StatisticCounters.action.config

Attribute “include” allows switch on/ off counters for function

Tag “property” defines instance name of counter defined by user.

Restriction: The action “EntryPointStatisticCounters” is allowed inside the “condition” tag only.

<actionSettings>

<function name="[function name]" include="[true/false]" enable="">

<action name="" include="" enable="" >

<property name="instance" value="[name of instance]">

</action>

</function>

 

<!-- configuration of functions instrumented by actions -->

<applications>

<application name="" displayName="" include="" enable="">

<function name="" include="" enable="">

<action name="FunctionStatisticCounters" include="" enable="" >

<property name="instance" value="[name of instance]">

</action>

</function>

<domain name="" displayName="" include="" enable="">

<function name="" include="" enable="">

<action name="FunctionStatisticCounters" include="" enable="" >

<property name="instance" value="[name of instance]">

</action>

<condition name="" include="" enable="" >

<expression argument="" pattern=""/>

<expression argument="" pattern=""/>

<action name="EntryPointStatisticCounters" include="" enable="">

<property name="instance" value="[name of instance]">

</action>

</condition>

</function>

<function name="" include="" enable="">

<action name="FunctionStatisticCounters" include="" enable=""/>

<property name="instance" value="[name of instance]">

</action>

</function>

</domain>

</application>

</applications>

Examples of configuration

Answers question "how many logons in application":

<application name="w3wp.exe" displayName="Web Applications">

<domain name="Duwamish7" displayName="Duwamish">

<function name="System.Web.UI.Page.ProcessRequest">

<ss:conditions>

<ss:condition name="path::Duwamish7_default.aspx">

<ss:expression argument="path" pattern="/Duwamish7/default.aspx"/>

<action name="EntryPointStatisticCounters">

<property name="instance" value="Logon" />

</action>

</ss:condition>

</ss:conditions>

</function>

</domain>

</application>

Answers question "how many web pages called":

<!-- configuration of functions instrumented by actions -->

<process name="w3wp.exe" displayName="Web Applications">

<function name="System.Web.UI.Page.ProcessRequest">

<action name="FunctionStatisticCounters">

<property name="instance" value="Web Pages" />

</action>

</function>

</process>

Read the Actions configuration in

The PMonitor unions and reads instrumentation rules in all files *.instrument.config at Initialization

The StatisticCounters.dll reads the all files *.StatisticCounters.action.config in first action call.

StatisticCounters.dll caches the configuration in static variable

Each function has a number of Instances to increment. Some instances are configured to increment on conditions. Some – without any conditions.

PerformanceCountersAction implementation

Primary Actor: PerformanceCountersAction

Stakeholders and Interests:

Precondition: the Instrumentation API provides a friendly domain name, function name, conditions.

10 PerformanceCountersAction Find the Instances set, belonging to the current function
20 PerformanceCountersAction Get the first instance’s properties
30 PerformanceCountersAction If there are conditions for this instance – check the conditions.
40 PerformanceCountersAction If we have to increment counters for that instance – get or create corresponding counters.
50 PerformanceCountersAction Increment counter
60 PerformanceCountersAction Repeat 20 for other instances
Collect Statistics counters in PerfCounterMonitor

In the current release we don’t need to make special logic for Statistics counters in PerfCounterMonitor.

We need to make definition of Statistics counters in section <ss:counterDefinitions> and allow defining counter instances manually in section <ss:counters> in PerfCounterMonitor.config.

Show Statistics counters in SEViewer

In the current release we show the Statistics counters in Computer Resource Utilization screen in list of computer counters.

Trace events

Overview

Trace events – the event signaled processing of BAM function. In contrast to the Statistic counters it provides context information about BAM function executing – application context, function parameters.

Trace event signaled the processing of BAM functions

Requirements

Security Risks

User .dll can throw exceptions

User .dll can change critical parameters values

User .dll can read critical parameters

User action could execute

Last update: Wednesday, December 08, 2010 10:04:53 AM