none
How do I identify the application calling an AVIcode-monitored web service

    Question

  • Hi,

    If I have a web service monitored by AVIcode and this web service is called by a number of other applications, leading to events being generated, what can I do to identify which of these applications called my monitored web service for any given event?

    eg Is there a way to identify the request credentials or request headers, in the event data?

    thanks,

    Jonathan

    Tuesday, February 21, 2012 12:23 PM

Answers

  • Hello Jonathan,

    Depending on the entrypoint function you see in the event from web service you might be able to modify the configuration file to collect more parameters for this method with Custom Data Producers.

    I believe there is a special custom data producer for BeginProcessRequestMethod (and ProcessRequest)(Agent.Instrumentation.InstrumentationClass.BeginProcessRequestCustomizeFragmentProducer & Agent.Instrumentation.InstrumentationClass.ProcessRequestCustomizeFragmentProducer) and common one for all other methods (Agent.Instrumentation.InstrumentationClass.CustomProducer).

    Using a syntax ([Index of Parameter]/Type::Member/Type::Collection[Item]/Type) you may configure those producers to extract parameters you need. Here is the example for Header extraction in BeginProcessRequest method (I can't guarantee it will work, but it should as of top of my head):

    <ss:function name="System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest" module="System.Web.dll" methodInfo="System.Web.HttpContext context,System.AsyncCallback cb,System.Web.HttpContext extraData">
                  <ss:argument name="1/System.Web.HttpContext::Request/System.Web.HttpRequest::Headers[MyHeader]/System.String" alias="MyHeader"></ss:argument>
                    <ss:instrumentation value="prefix" name="Agent.Instrumentation.InstrumentationClass.BeginProcessRequestConditionsProducer" assembly="Agent.Instrumentation"/>
                    <ss:instrumentation value="postfix" name="Agent.Instrumentation.InstrumentationClass.BeginProcessRequestCustomizeFragmentProducer" assembly="Agent.Instrumentation"/>
                    <!--The next producer is commented Out to use CustomizeProducer instead-->
                    <!--<ss:instrumentation value="postfix" name="Agent.Instrumentation.InstrumentationClass.BeginProcessRequestFragmentProducer" assembly="Agent.Instrumentation"/>-->
                    <ss:instrumentation value="onException" name="Agent.Instrumentation.InstrumentationClass.OnExceptionEmptyProducer" assembly="Agent.Instrumentation"/>
      </ss:function>

    Default definition for BeginProcessRequest and other methods is located in PMonitor2_0.default.config, so you should edit this file to change\enhance the existing definition. Be careful and do not try to collect all available parameters in Production environments - any additional collected parameter for the request increases noise from the monitoring for this request.

    If you are using a WCF call - entrypoint could be slightly different and possibly you may need to get a static variable in the function (like static HttpContext on the thread). It may be solved like this (add "isStatic" attribute and change the syntax a bit):

    <ss:function name="System.Windows.Forms.ToolBar.OnButtonClick" module="System.Windows.Forms.dll" methodInfo="ToolBarButtonClickEventArgs e">
                    <ss:argument name="UserName/System.Environment" isStatic="true" alias="UserName"/>
                    <ss:instrumentation value="postfix" name="Agent.Instrumentation.InstrumentationClass.CustomProducer" assembly="Agent.Instrumentation"/>
     </ss:function>


    Dmitry Matveev

    • Marked as answer by jmccomb Thursday, February 23, 2012 3:51 PM
    Tuesday, February 21, 2012 7:51 PM

All replies

  • Hello Jonathan,

    Depending on the entrypoint function you see in the event from web service you might be able to modify the configuration file to collect more parameters for this method with Custom Data Producers.

    I believe there is a special custom data producer for BeginProcessRequestMethod (and ProcessRequest)(Agent.Instrumentation.InstrumentationClass.BeginProcessRequestCustomizeFragmentProducer & Agent.Instrumentation.InstrumentationClass.ProcessRequestCustomizeFragmentProducer) and common one for all other methods (Agent.Instrumentation.InstrumentationClass.CustomProducer).

    Using a syntax ([Index of Parameter]/Type::Member/Type::Collection[Item]/Type) you may configure those producers to extract parameters you need. Here is the example for Header extraction in BeginProcessRequest method (I can't guarantee it will work, but it should as of top of my head):

    <ss:function name="System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest" module="System.Web.dll" methodInfo="System.Web.HttpContext context,System.AsyncCallback cb,System.Web.HttpContext extraData">
                  <ss:argument name="1/System.Web.HttpContext::Request/System.Web.HttpRequest::Headers[MyHeader]/System.String" alias="MyHeader"></ss:argument>
                    <ss:instrumentation value="prefix" name="Agent.Instrumentation.InstrumentationClass.BeginProcessRequestConditionsProducer" assembly="Agent.Instrumentation"/>
                    <ss:instrumentation value="postfix" name="Agent.Instrumentation.InstrumentationClass.BeginProcessRequestCustomizeFragmentProducer" assembly="Agent.Instrumentation"/>
                    <!--The next producer is commented Out to use CustomizeProducer instead-->
                    <!--<ss:instrumentation value="postfix" name="Agent.Instrumentation.InstrumentationClass.BeginProcessRequestFragmentProducer" assembly="Agent.Instrumentation"/>-->
                    <ss:instrumentation value="onException" name="Agent.Instrumentation.InstrumentationClass.OnExceptionEmptyProducer" assembly="Agent.Instrumentation"/>
      </ss:function>

    Default definition for BeginProcessRequest and other methods is located in PMonitor2_0.default.config, so you should edit this file to change\enhance the existing definition. Be careful and do not try to collect all available parameters in Production environments - any additional collected parameter for the request increases noise from the monitoring for this request.

    If you are using a WCF call - entrypoint could be slightly different and possibly you may need to get a static variable in the function (like static HttpContext on the thread). It may be solved like this (add "isStatic" attribute and change the syntax a bit):

    <ss:function name="System.Windows.Forms.ToolBar.OnButtonClick" module="System.Windows.Forms.dll" methodInfo="ToolBarButtonClickEventArgs e">
                    <ss:argument name="UserName/System.Environment" isStatic="true" alias="UserName"/>
                    <ss:instrumentation value="postfix" name="Agent.Instrumentation.InstrumentationClass.CustomProducer" assembly="Agent.Instrumentation"/>
     </ss:function>


    Dmitry Matveev

    • Marked as answer by jmccomb Thursday, February 23, 2012 3:51 PM
    Tuesday, February 21, 2012 7:51 PM
  • Thanks, I'll investigate that to see what I can get.

    regards,

    Jonathan

    Tuesday, February 21, 2012 8:56 PM