Service Virtualization

  • 1.  Enable DyanaTrace tagging for each transaction

    Posted 12-28-2015 07:24 PM

    I am trying to use a DynaTrace library to connect the client's path to the path on the SV server by using this guide: Tagging ADK for Java - Dynatrace 6.2 - Dynatrace Community

     

    The goal is that we will be able to see how long each transaction is taking and connect that with the corresponding request that was made by the client. DynaTrace is already set up on our SV server. I have also added the DynaTrace ADK JAR file to my Lisa/hotDeploy folder.

     

    I added code for using the DynaTrace library into a JavaScript step right after the "HTTP/S Listener Step" to initialize the path, and in a second JavaScript step right after the "HTTP/S Responder".

     

    Script 1:

    import com.dynatrace.adk.DynaTraceADKFactory;
    import com.dynatrace.adk.Tagging;
    import com.itko.util.ParameterList;
    
    
    
    ParameterList metadata = lisa_vse_request.getMetaData();
    
    
    //theVal = FW1;-1998823266;199882326;6;1998823266;56678;2
    String theVal = metadata.getParameterValue("X-dynaTrace");
    
    
    //initialize the dynatrace object
    DynaTraceADKFactory.initialize();
    
    //tagging object used to connect the pure path
    Tagging tagging = DynaTraceADKFactory.createTagging();
    
    
    //set the full DT tag as value to pass
    //tagAsString = FW1;-1998823266;199882326;6;1998823266;56678;2
    String tagAsString = theVal;
    tagging.setTagFromString(tagAsString);
    
    
    //DynaTraceADKFactory.uninitialize();
    tagging.startServerPurePath();
    
    
    //save to property so that we can use in different script
    testExec.setStateValue("dynatrace_tagging", tagging);
    

     

     

    Script 2:

    import com.dynatrace.adk.DynaTraceADKFactory;
    import com.dynatrace.adk.Tagging;
    
    
    
    //get the lisa property that was set when tagging was initialized
    Tagging tag = testExec.getStateValue("dynatrace_tagging");
    
    
    //end pure path for this tag
    tagging.endServerPurePath();
    
    
    //uninitialize the dynatrace object
    DynaTraceADKFactory.uninitialize();
    

     

     

    The client is able see the transactions but the path is not ending properly, so we are unable to get the time spent in each transaction. My thought is that Lisa is using internal methods to invoke each "Step" in the VSM, and ideally the DynaTrace tagging code should be set within the Lisa code that is calling the steps of the VSM. Because this is a vendor tool, I do not have that level of control.

     

    Does anyone have an idea how to properly implement this, and if my understanding of how it works is correct?



  • 2.  Re: Enable DyanaTrace tagging for each transaction

    Posted 12-29-2015 05:29 PM

    Hello! This looks like a very similar question to the discussion happening on the Dynatrace community here. Feel free to pile on to the chat if you don't see the specific answer you are looking for.

     

    -Ryan