Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry Policy for OtlpHttpSpanExporter and OtlpGrpcSpanExporter are not auto-configured #44645

Open
as428y opened this issue Mar 7, 2025 · 6 comments
Labels
for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged

Comments

@as428y
Copy link

as428y commented Mar 7, 2025

It requires to override Beans for
OtlpHttpSpanExporter and OtlpGrpcSpanExporter, in order to populate RetryPolicy

In this case better would to have Customizer or Dedicated bean for HTTP\gRPC rather overriding Bean

@Bean
@ConditionalOnProperty(prefix = "management.otlp.tracing", name = "transport", havingValue = "grpc")
OtlpGrpcSpanExporter otlpGrpcSpanExporter(OtlpTracingProperties properties,
                                          OtlpTracingConnectionDetails connectionDetails)
{
    //org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConfigurations$Exporters
    RetryPolicy retryPolicy = RetryPolicy.builder()
            .setMaxAttempts(5)                      // Max retry attempts
            .setInitialBackoff(Duration.ofMillis(100)) // Initial backoff duration
            .setMaxBackoff(Duration.ofSeconds(5))    // Max backoff duration
            .setBackoffMultiplier(2.0)              // Backoff multiplier
            //.setMaxRetryDuration(Duration.ofMinutes(1)) // Maximum retry duration
            .build();

    OtlpGrpcSpanExporterBuilder builder = OtlpGrpcSpanExporter.builder()
            .setRetryPolicy(retryPolicy) //********************************************
            .setEndpoint(connectionDetails.getUrl(Transport.GRPC))
            .setTimeout(properties.getTimeout())
            .setConnectTimeout(properties.getConnectTimeout())
            .setCompression(properties.getCompression().name().toLowerCase(Locale.ROOT));
    properties.getHeaders().forEach(builder::addHeader);

   //io.opentelemetry.sdk.trace.export.BatchSpanProcessor

    return builder.build();
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 7, 2025
@mhalbritter
Copy link
Contributor

We can either add customizers for OtlpHttpSpanExporterBuilder and OtlpGrpcSpanExporterBuilder or we could add properties to configure the retry.

There are more set... methods on the builders, so I'm leaning towards the customizers.

@mhalbritter mhalbritter added the for: team-attention An issue we'd like other members of the team to review label Mar 13, 2025
@nosan
Copy link
Contributor

nosan commented Mar 13, 2025

... so I'm leaning towards the customizers.

I believe this is the only viable option here.

Considering the current issue with configuring RetryPolicy, RetryPolicy cannot be
configured only by using properties alone because of RetryPolicy.builder().setRetryExceptionPredicate(Predicate<Exception>).

Unfortunately, this would require introducing two customizers

@nosan
Copy link
Contributor

nosan commented Mar 13, 2025

I have implemented the customizers approach in this branch

@as428y
Copy link
Author

as428y commented Mar 13, 2025

Thanks for implementing !
Is there an ETA in what version it will be released?

@nosan
Copy link
Contributor

nosan commented Mar 13, 2025

@as428y
Apologies for the confusion, let me clarify. As a contributor, I’ve prepared a solution for this issue by using customizers. This solution currently exists in my forked spring-boot repository and is not part of the main spring-boot repository.

The final decision on whether to use properties or customizers has not been made yet.

@as428y
Copy link
Author

as428y commented Mar 13, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

4 participants