Skip to content

Commit a1693bc

Browse files
authored
Merge pull request #58 from AdamJKing/feat/otlp-exporter/36-make-backoff-exponential-with-jitter
2 parents 7a05b95 + 9ff2a8b commit a1693bc

File tree

1 file changed

+2
-1
lines changed
  • sdk-exporter/common/src/main/scala/org/typelevel/otel4s/sdk/exporter/otlp

1 file changed

+2
-1
lines changed

sdk-exporter/common/src/main/scala/org/typelevel/otel4s/sdk/exporter/otlp/OtlpClient.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ private[otlp] object OtlpClient {
170170

171171
def backoff(attempt: Int): Option[FiniteDuration] =
172172
Option.when(attempt < retryPolicy.maxAttempts) {
173+
val jitterMultiplier = math.random()
173174
val next =
174-
retryPolicy.initialBackoff * attempt.toLong * retryPolicy.backoffMultiplier
175+
retryPolicy.initialBackoff * attempt.toLong * (jitterMultiplier * retryPolicy.backoffMultiplier)
175176

176177
val delay =
177178
next.min(retryPolicy.maxBackoff)

0 commit comments

Comments
 (0)