<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.19.1-rc.1" />

OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient.OtlpRetry

static class OtlpRetry
Implementation of the OTLP retry policy used by both OTLP/gRPC and OTLP/HTTP. OTLP/gRPC https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#failures OTLP/HTTP https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#failures-1 The specification requires retries use an exponential backoff strategy, but does not provide specifics for the implementation. As such, this implementation is inspired by the retry strategy provided by Grpc.Net.Client which implements the gRPC retry specification. Grpc.Net.Client retry implementation https://github.com/grpc/grpc-dotnet/blob/83d12ea1cb628156c990243bc98699829b88738b/src/Grpc.Net.Client/Internal/Retry/RetryCall.cs#L94 gRPC retry specification https://github.com/grpc/proposal/blob/master/A6-client-retries.md The gRPC retry specification outlines configurable parameters used in its exponential backoff strategy: initial backoff, max backoff, backoff multiplier, and max retry attempts. The OTLP specification does not declare a similar set of parameters, so this implementation uses fixed settings. Furthermore, since the OTLP spec does not specify a max number of attempts, this implementation will retry until the deadline is reached. The throttling mechanism for OTLP differs from the throttling mechanism described in the gRPC retry specification. See: https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#otlpgrpc-throttling.
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient { internal static class OtlpRetry { public readonly struct RetryResult { public readonly bool Throttled; public readonly TimeSpan RetryDelay; public readonly int NextRetryDelayMilliseconds; public RetryResult(bool throttled, TimeSpan retryDelay, int nextRetryDelayMilliseconds); } public const int InitialBackoffMilliseconds = 1000; public static bool TryGetHttpRetryResult(ExportClientHttpResponse response, int retryDelayInMilliSeconds, out RetryResult retryResult); public static bool IsRetryable(ExportClientGrpcResponse response); public static bool IsRetryable(ExportClientHttpResponse response); public static bool TryGetGrpcRetryResult(ExportClientGrpcResponse response, int retryDelayMilliseconds, out RetryResult retryResult); } }