Documentation

Add Open Telemetry interceptor

Nomirun SDK also contains a tracing interceptor using OpenTelemetry captures detailed telemetry data about method invocations, including their execution time, input arguments, and any exceptions encountered. The OpenTelemetryTracingInterceptor leverages an ActivitySource to create and manage spans for each intercepted method. Key features include tagging method metadata (e.g., name, type), serializing input arguments, and emitting events for method start and stop. If the method returns a Task, async handling is supported. The interceptor also captures exceptions by adding error details to the span. This integration enables rich observability and distributed tracing insights for debugging and performance monitoring in modern applications.

If we expand a previous example, we just add [AddOpenTelemetryTracing] to the same method:

public class Calculator: ICalculator
{
    [AddOpenTelemetryTracing]
    [AddLogging]
    public int Sum(int a, int b)
    {
        return a + b;
    }
}

If we point the Open Telemetry collector output to Jaeger, we get a rich tracing log:

Jaeger logs