Splunk AppDynamics

Split .Net Business Transaction on Method Array Parameters

Andrew_Draut
Explorer

Given the program below that accepts arguments from the command-line via the string[] args parameter, how do I setup a business transaction that will split based on the first value, args[0]?

I have it set to use Parameter index 0 and a Getter chain value of .[0] right now, which doesn't seem to work.  For the Getter chain I have also tried string/0 and int/0 an those do not seem to work either.

The Using Getter Chains documentation is not very clear about this and does not provide clear example of accessing a value in a parameter that is an array.

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
  public static void Main(string[] args)
  {
    switch(args[0])
    {
      case "A":
       DoA();
       break;
      case "B":
       DoB();
       break;
    }
}

  private static void DoA(){}

  private static void DoB(){}
}
Labels (1)
0 Karma
1 Solution

Ashish_Singh
Communicator

Hi Andrew,

 

As the below share code is for the standalone application, where main method will only call one time. So, to detect the transactions for instrumented application below are min requirement- 

  1. Instrumented application process should be up for more than one min, so .Net agent will collect and send the metrics in next mins.
  2. Business transaction ( class/methods) on which you are creating BT, that should execute more than 2 times in its lifetime

Now, if we see the example. Parameters are passed on Main method, based on that your switch case will execute and required methods will execute.

So, we would suggest creating POCO BT on  DoA and DoB methods individually.

 

Let us know if it does not help. In case you have any question, could you please share some more details of the requirement and on which kind of application and transaction type you are creating the BT.

 

Thanks,

Ashish.

View solution in original post

Ashish_Singh
Communicator

Hi Andrew,

 

As the below share code is for the standalone application, where main method will only call one time. So, to detect the transactions for instrumented application below are min requirement- 

  1. Instrumented application process should be up for more than one min, so .Net agent will collect and send the metrics in next mins.
  2. Business transaction ( class/methods) on which you are creating BT, that should execute more than 2 times in its lifetime

Now, if we see the example. Parameters are passed on Main method, based on that your switch case will execute and required methods will execute.

So, we would suggest creating POCO BT on  DoA and DoB methods individually.

 

Let us know if it does not help. In case you have any question, could you please share some more details of the requirement and on which kind of application and transaction type you are creating the BT.

 

Thanks,

Ashish.

Andrew_Draut
Explorer

That does answer my question.  I had hoped to use the BT on the Main method as a fallback for unconfigured specific BTs for a .Net console application that acts as a job/process runner.  It would be nice for this scenario to work, though as it would save a lot of time configuring BTs and allow instrumenting the entire process as there is a bunch of setup code that runs before each job/process that is not currently captured because we have to configure the BT for something farther down the call chain.

Get Updates on the Splunk Community!

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...

Enhance Your Splunk App Development: New Tools & Support

UCC FrameworkAdd-on Builder has been around for quite some time. It helps build Splunk apps faster, but it ...