Tracing .NET client applications

CICS® Transaction Gateway (CICS TG) 10.1 supports tracing the .NET client applications. CICS TG 9.3 consists of a user module that supports the functionality.

CICS TG provides two methods to configure a traceparent within the .NET requests. You can use one of the methods to trace CICS TG transactions from a .NET client application. For more information, refer to the Setting traceparent in CICS TG clients procedure in the IBM CICS Transaction Gateway for z/OS documentation.

To connect the transactions to the upstream calls, Instana must be tracing the application and retrieve the traceparent from the Instana .NET software development kit (SDK). Refer to the following topics in the current version of the Instana documentation:

  • Monitoring .NET and .NET Core based applications to enable .NET tracing.

  • .NET or .NET Core Tracing SDK for information about how to acquire and use the SDK.

.NET applications traceparent

Following is a sample .NET application that uses method 2 in the CICS TG documentation. It uses the Instana .NET SDK to collect the traceID and spanID to create a traceparent. You can use it with the instructions within the CICS TG documentation to trace a .NET application with Instana.

This program uses the following specifications:

using System;
using IBM.CTG;
using Instana.Tracing.Sdk.Spans;
namespace Distributed.Tracing
{
    public class SpanCreation : TraceParentInterface
    {
        public string getTraceParent(string requestEvent)
        {
            using (CustomSpan span = CustomSpan.FromCurrentContext())
            {
                string traceparent = "00-0000000000000000" + span.TraceId.ToString("X2") + "-" + span.SpanId.ToString("X2") + "-01";
                return traceparent.ToLower();
            }
        }
    }
}
Note:

Enable trace in the .NET client application to check if traceparent is created. For more information, see Tracing for Microsoft NET Framework-based and .NET Core client programs in the IBM CICS Transaction Gateway for z/OS documentation. The log output consists of a line that prints the traceparent. For example:

GatewayConnection : traceParent  is 00-000000000000000022F29CED687889C7-22F29CED687889C7-01