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

Add auto-configuration for OTLP gRPC format #35863

Closed
mhalbritter opened this issue Jun 13, 2023 · 5 comments
Closed

Add auto-configuration for OTLP gRPC format #35863

mhalbritter opened this issue Jun 13, 2023 · 5 comments
Labels
status: superseded An issue that has been superseded by another

Comments

@mhalbritter
Copy link
Contributor

mhalbritter commented Jun 13, 2023

Implement auto-configuration for OpenTelemetry's OtlpGrpcSpanExporter.

          Well, since the endpoint URL has to be provided now, it can be used to figure out which type of exporter the user wants to configure and also support the gRPC option.

Originally posted by @vpavic in #35596 (comment)

@ShakeelHussain

This comment was marked as resolved.

@wilkinsona

This comment was marked as resolved.

@meisten
Copy link

meisten commented Jun 10, 2024

Maybe it will be useful to someone. Until autoconfiguration is implemented out-of-the-box, you can use this code in your project.

package org.example.infrastructure.monitoring;

import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpProperties;
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
class OtlpGrpcExporterAutoConfiguration {

    /**
     * This is a copy of autoconfiguration {@link io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter} from
     * {@link org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConfigurations}, but for gRPC.
     */
    @Bean
    OtlpGrpcSpanExporter otlpGrpcSpanExporter(OtlpProperties properties, OtlpTracingConnectionDetails connectionDetails) {
        var builder = OtlpGrpcSpanExporter.builder()
                                          .setEndpoint(connectionDetails.getUrl())
                                          .setTimeout(properties.getTimeout())
                                          // TODO: use Enum#name instead of String#valueof. OtlpProperties#Compression
                                          //  enum has package private access
                                          .setCompression(String.valueOf(properties.getCompression()).toLowerCase());

        properties.getHeaders().forEach(builder::addHeader);
        return builder.build();
    }

}

application.yml:

management:
  otlp:
    tracing:
      endpoint: http://localhost:4317/v1/traces
      compression: gzip

@timpeeters
Copy link

I've provided an initial proposal to support OtlpGrpcSpanExporter.
See #41213
Looking forward to any feedback.

timpeeters added a commit to timpeeters/spring-boot that referenced this issue Jul 1, 2024
@mhalbritter mhalbritter added status: superseded An issue that has been superseded by another and removed type: enhancement A general enhancement theme: observability Issues related to observability labels Jul 4, 2024
@mhalbritter mhalbritter removed this from the 3.x milestone Jul 4, 2024
@mhalbritter
Copy link
Contributor Author

Superseded by #41213.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants