<PackageReference Include="Microsoft.ApplicationInsights" Version="2.23.0" />

Microsoft.ApplicationInsights.TelemetryClientExtensions

public static class TelemetryClientExtensions
Extension class to telemetry client that creates operation object with the respective fields initialized.
public static IOperationHolder<T> StartOperation<T>(this TelemetryClient telemetryClient, string operationName) where T : OperationTelemetry

Start operation creates an operation object with a respective telemetry item.

public static IOperationHolder<T> StartOperation<T>(this TelemetryClient telemetryClient, string operationName, string operationId, string parentOperationId = null) where T : OperationTelemetry

Start operation creates an operation object with a respective telemetry item.

public static IOperationHolder<T> StartOperation<T>(this TelemetryClient telemetryClient, T operationTelemetry) where T : OperationTelemetry

Creates an operation object with a given telemetry item.

public static IOperationHolder<T> StartOperation<T>(this TelemetryClient telemetryClient, Activity activity) where T : OperationTelemetry

Creates an operation object with a respective telemetry item using Activity instance that holds tracing context.

public static void StopOperation<T>(this TelemetryClient telemetryClient, IOperationHolder<T> operation) where T : OperationTelemetry

Stop operation computes the duration of the operation and tracks it using the respective telemetry client.