Client instrumentation using OpenTelemetry

The CICS TG SDK provides comprehensive support for OpenTelemetry APIs and SDKs across multiple client platforms, including Java™, Jakarta EE, Java EE, .NET Framework, and .NET Core. This integration enables applications to propagate trace context and generate telemetry data whenever the CICS TG SDK is configured for OpenTelemetry tracing.

Telemetry data can be exported either to an OpenTelemetry Collector or directly to an observability back-end system, using the respective OpenTelemetry SDKs.

What is instrumentation?

Instrumentation is the method by which the API and SDK are used to record OTel data, allowing you to monitor and analyze your applications effectively. The OTel Java instrumentation ecosystem includes several categories, each suited to different needs and scenarios.

Java Agent

The Java Agent provides zero-code automatic instrumentation by dynamically injecting bytecode that calls the APIs to record OTel data at the edges of the application. This means you can start generating OTel data with minimal configuration and no changes to your existing codebase. This is particularly useful for legacy applications or in scenarios where modifying the source code is not feasible. For more information, see OpenTelemetry Java Agent.

Spring Boot starter

For Spring Boot applications, the Spring Boot starter automatically instruments Spring components to generate OTel data. This option is useful if you are developing or maintaining Spring Boot applications that you want to instrument with OTel. For more information, see OpenTelemetry Spring Boot starter.

Manual instrumentation

Application authors have the option to write custom code by using the APIs to record OTel data. This manual approach allows for more control over what OTel data is captured and how it is processed, making it suitable for complex or specialized monitoring requirements where automatic instrumentation might not provide enough detail. The SDK that implements this API and can be configured to process and export the collected OTel data. For more information, see Record Telemetry with API for Java, and see Instrumentation for OpenTelemetry .NET for .NET.

Example:

For Java clients:
Tracer tracer = GlobalOpenTelemetry.getTracer("/"); 
Span span = tracer.spanBuilder("Span 1").startSpan(); 
span.makeCurrent();
For .NET clients:
var tracerProvider = Sdk.CreateTracerProviderBuilder()
    .AddSource(serviceName)
    .ConfigureResource(resource =>
        resource.AddService(
          serviceName: serviceName,
          serviceVersion: serviceVersion))
    .AddConsoleExporter()
    .Build();