Repository: open-telemetry/opentelemetry-java
File: sdk/common/src/main/java/io/opentelemetry/sdk/common/export/RetryPolicy.java (Java)

Code before:
        .setRetryExceptionPredicate(DEFAULT_RETRY_PREDICATE);
  }

  /**
   * Returns a {@link RetryPolicyBuilder} reflecting configuration values for this {@link
   * RetryPolicy}.
   *
   * @since 1.29.0
   */
  public abstract RetryPolicyBuilder toBuilder();

  /** Returns the max number of attempts, including the original request. */
  public abstract int getMaxAttempts();

  /** Returns the initial backoff. */
  public abstract Duration getInitialBackoff();

  /** Returns the max backoff. */
  public abstract Duration getMaxBackoff();

  /** Returns the backoff multiplier. */
  public abstract double getBackoffMultiplier();

  /** Returns the predicate if exception is retryable. */
  public abstract Predicate<IOException> getRetryExceptionPredicate();

  /** Builder for {@link RetryPolicy}. */
  @AutoValue.Builder
  public abstract static class RetryPolicyBuilder {

    RetryPolicyBuilder() {}

    /**
     * Set the maximum number of attempts, including the original request. Must be greater than 1
     * and less than 6. Defaults to {@value DEFAULT_MAX_ATTEMPTS}.
     */
    public abstract RetryPolicyBuilder setMaxAttempts(int maxAttempts);

    /**
     * Set the initial backoff. Must be greater than 0. Defaults to {@value
     * DEFAULT_INITIAL_BACKOFF_SECONDS} seconds.
     */
    public abstract RetryPolicyBuilder setInitialBackoff(Duration initialBackoff);

    /**
     * Set the maximum backoff. Must be greater than 0. Defaults to {@value
     * DEFAULT_MAX_BACKOFF_SECONDS} seconds.
     */
    public abstract RetryPolicyBuilder setMaxBackoff(Duration maxBackoff);

    /**

Review comment (refactor):
We can't have a default retry predicate because the default predicate varies by sender implementation. Instead, let's make this method `@Nullable`, and use `null` to indicate that the "protocol and sender specific default retry predicate should be used". 

I sketched out a commit of how this works: https://github.com/open-telemetry/opentelemetry-java/commit/317397a6f5bd9e387143aeaaa4c57a8d284995e2

Notice how JdkHttpSender and OkHttpSender each have their own default predicate. Because the RetryPolicy is more generic than JdkHttpSender, OkHttpSender, and even more generic than OTLP, it can't contain protocol and sender specific logic.

```suggestion
  @Nullable
  public abstract Predicate<IOException> getRetryExceptionPredicate();
```

Code after:
  /**
   * Returns a {@link RetryPolicyBuilder} reflecting configuration values for this {@link
   * RetryPolicy}.
   *
   * @since 1.29.0
   */
  public abstract RetryPolicyBuilder toBuilder();

  /** Returns the max number of attempts, including the original request. */
  public abstract int getMaxAttempts();

  /** Returns the initial backoff. */
  public abstract Duration getInitialBackoff();

  /** Returns the max backoff. */
  public abstract Duration getMaxBackoff();

  /** Returns the backoff multiplier. */
  public abstract double getBackoffMultiplier();

  /**
   * Returns the predicate used to determine if thrown exception is retryableor {@code null} if no
   * predicate was set.
   */
  @Nullable
  public abstract Predicate<IOException> getRetryExceptionPredicate();

  /** Builder for {@link RetryPolicy}. */
  @AutoValue.Builder
  public abstract static class RetryPolicyBuilder {

    RetryPolicyBuilder() {}

    /**
     * Set the maximum number of attempts, including the original request. Must be greater than 1
     * and less than 6. Defaults to {@value DEFAULT_MAX_ATTEMPTS}.
     */
    public abstract RetryPolicyBuilder setMaxAttempts(int maxAttempts);

    /**
     * Set the initial backoff. Must be greater than 0. Defaults to {@value
     * DEFAULT_INITIAL_BACKOFF_SECONDS} seconds.
     */
    public abstract RetryPolicyBuilder setInitialBackoff(Duration initialBackoff);

    /**
     * Set the maximum backoff. Must be greater than 0. Defaults to {@value
     * DEFAULT_MAX_BACKOFF_SECONDS} seconds.
     */
    public abstract RetryPolicyBuilder setMaxBackoff(Duration maxBackoff);