In Spring Boot RC2 I set the following properties:

management.opentelemetry.logging.export.otlp.transport: GPRC
management.opentelemetry.logging.export.otlp.endpoint:  http://opentelemetry-collector.nais-system:4317/v1/metrics

The endpoint URL is a service listening on port 4317 expecting a grpc payload/transport.

However, it appears that the http protocol is still being used, and the transport then obviously fails. Is this a regression?, it worked as expected in 3.5.7.

Failed to publish metrics to OTLP receiver (context: url=http://opentelemetry-collector.nais-system:4317/v1/metrics

Comment From: mhalbritter

With those properties:

management.opentelemetry.logging.export.otlp.transport=GPRC
management.opentelemetry.logging.export.otlp.endpoint=http://opentelemetry-collector.nais-system:4317/v1/metrics

I get

Failed to bind properties under 'management.opentelemetry.logging.export.otlp.transport' to org.springframework.boot.opentelemetry.autoconfigure.logging.otlp.Transport:

    Property: management.opentelemetry.logging.export.otlp.transport
    Value: "GPRC"
    Origin: class path resource [application.properties] - 2:56
    Reason: failed to convert java.lang.String to org.springframework.boot.opentelemetry.autoconfigure.logging.otlp.Transport (caused by java.lang.IllegalArgumentException: No enum constant org.springframework.boot.opentelemetry.autoconfigure.logging.otlp.Transport.GPRC)

Action:

Update your application's configuration. The following values are valid:

    GRPC
    HTTP

With the fixed property (it's GRPC not GPRC):

management.opentelemetry.logging.export.otlp.transport=GRPC

a breakpoint in org.springframework.boot.opentelemetry.autoconfigure.logging.otlp.OtlpLoggingConfigurations.Exporters#otlpGrpcLogRecordExporter is triggered.

Note that you have to include the spring-boot-starter-actuator dependency, otherwise org.springframework.boot.opentelemetry.autoconfigure.logging.otlp.OtlpLoggingConfigurations.Exporters isn't enabled.

If that doesn't solve your problem, please upload a minimal sample to reproduce.

Comment From: jan-olaveide

Sorry, that was a typo from me, I actually use the value grpc. I also have a OtlpGrpcLogRecordExporter bean defined, so the autoconfiguration has done its job. But I still get the error.

Comment From: mhalbritter

The error message is talking about metrics: "Failed to publish metrics to OTLP receiver (context: url=http://opentelemetry-collector.nais-system:4317/v1/metrics"

You have set the endpoint for logging: management.opentelemetry.logging.export.otlp.endpoint.

So something is mixed up in your configuration.

Comment From: jonatan-ivanov

Not sure what kind of OTel Collector is this but I also think that sending logs to the metrics endpoint will not work since the collector will not understand metrics on an endpoint it is expecting logs:

management.opentelemetry.logging.export.otlp.endpoint: http://opentelemetry-collector.nais-system:4317/v1/metrics

Comment From: jan-olaveide

I understand a bit more now: There are properties for setting the endpoint (and transport) for logging and traces, but not for metrics, is this intentional? For metrics it appears we need to set the environment variable OTEL_EXPORTER_OTLP_METRICS_ENDPOINT. When it is not set, we get a fallback to OTEL_EXPORTER_OTLP_ENDPOINT, this explains my original error, since this is set by the platform. We have the metrics collector on a different port

Any reason for this lack of symmetry, property-wise?

Comment From: wilkinsona

The property for metrics is management.otlp.metrics.export.url. This is the case in both 3.5.x and 4.0.x.