11package io .quarkus .opentelemetry .runtime .exporter .otlp ;
22
3- import static io .quarkus .opentelemetry .runtime .config .build .ExporterType .Constants .OTLP_VALUE ;
43import static io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterConfig .Protocol .GRPC ;
54import static io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterConfig .Protocol .HTTP_PROTOBUF ;
65import static io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterRuntimeConfig .DEFAULT_GRPC_BASE_URI ;
2726import io .opentelemetry .exporter .internal .otlp .traces .TraceRequestMarshaler ;
2827import io .opentelemetry .exporter .otlp .internal .OtlpUserAgent ;
2928import io .opentelemetry .sdk .autoconfigure .spi .ConfigurationException ;
29+ import io .opentelemetry .sdk .common .InternalTelemetryVersion ;
30+ import io .opentelemetry .sdk .internal .StandardComponentId ;
3031import io .opentelemetry .sdk .logs .export .LogRecordExporter ;
3132import io .opentelemetry .sdk .metrics .Aggregation ;
3233import io .opentelemetry .sdk .metrics .InstrumentType ;
@@ -75,14 +76,17 @@ public class OTelExporterRecorder {
7576 private final OTelBuildConfig buildConfig ;
7677 private final RuntimeValue <OTelRuntimeConfig > runtimeConfig ;
7778 private final RuntimeValue <OtlpExporterRuntimeConfig > exporterRuntimeConfig ;
79+ private final RuntimeValue <ExporterBridge > exporterBridge ;
7880
7981 public OTelExporterRecorder (
8082 final OTelBuildConfig buildConfig ,
8183 final RuntimeValue <OTelRuntimeConfig > runtimeConfig ,
82- final RuntimeValue <OtlpExporterRuntimeConfig > exporterRuntimeConfig ) {
84+ final RuntimeValue <OtlpExporterRuntimeConfig > exporterRuntimeConfig ,
85+ final RuntimeValue <ExporterBridge > exporterBridge ) {
8386 this .buildConfig = buildConfig ;
8487 this .runtimeConfig = runtimeConfig ;
8588 this .exporterRuntimeConfig = exporterRuntimeConfig ;
89+ this .exporterBridge = exporterBridge ;
8690 }
8791
8892 public Function <SyntheticCreationalContext <LateBoundSpanProcessor >, LateBoundSpanProcessor > spanProcessorForOtlp (
@@ -156,8 +160,6 @@ private SpanExporter createOtlpGrpcSpanExporter(OtlpExporterRuntimeConfig export
156160 OtlpExporterTracesConfig tracesConfig = exporterRuntimeConfig .traces ();
157161
158162 return new VertxGrpcSpanExporter (new GrpcExporter <TraceRequestMarshaler >(
159- OTLP_VALUE , // use the same as OTel does
160- "span" , // use the same as OTel does
161163 new VertxGrpcSender (
162164 baseUri ,
163165 VertxGrpcSender .GRPC_TRACE_SERVICE_NAME ,
@@ -166,7 +168,11 @@ private SpanExporter createOtlpGrpcSpanExporter(OtlpExporterRuntimeConfig export
166168 populateTracingExportHttpHeaders (tracesConfig ),
167169 new HttpClientOptionsConsumer (tracesConfig , baseUri , tlsConfigurationRegistry ),
168170 vertx ),
169- MeterProvider ::noop ));
171+ InternalTelemetryVersion .LATEST ,
172+ exporterBridge .getValue ()
173+ .createStandardComponentId (StandardComponentId .ExporterType .OTLP_GRPC_SPAN_EXPORTER ), // use the same as OTel does
174+ MeterProvider ::noop ,
175+ baseUri .toASCIIString ()));
170176 }
171177
172178 private SpanExporter createHttpSpanExporter (OtlpExporterRuntimeConfig exporterRuntimeConfig , Vertx vertx ,
@@ -178,8 +184,8 @@ private SpanExporter createHttpSpanExporter(OtlpExporterRuntimeConfig exporterRu
178184 boolean exportAsJson = false ; //TODO: this will be enhanced in the future
179185
180186 return new VertxHttpSpanExporter (new HttpExporter <TraceRequestMarshaler >(
181- OTLP_VALUE , // use the same as OTel does
182- "span" , // use the same as OTel does
187+ exporterBridge . getValue ()
188+ . createStandardComponentId ( StandardComponentId . ExporterType . OTLP_HTTP_SPAN_EXPORTER ),
183189 new VertxHttpSender (
184190 baseUri ,
185191 VertxHttpSender .TRACES_PATH ,
@@ -190,7 +196,8 @@ private SpanExporter createHttpSpanExporter(OtlpExporterRuntimeConfig exporterRu
190196 new HttpClientOptionsConsumer (tracesConfig , baseUri , tlsConfigurationRegistry ),
191197 vertx ),
192198 MeterProvider ::noop ,
193- exportAsJson ));
199+ InternalTelemetryVersion .LATEST ,
200+ baseUri .toASCIIString ()));
194201 }
195202 };
196203 }
@@ -222,8 +229,6 @@ public MetricExporter apply(SyntheticCreationalContext<MetricExporter> context)
222229 if (GRPC .equals (protocol )) {
223230 metricExporter = new VertxGrpcMetricExporter (
224231 new GrpcExporter <MetricsRequestMarshaler >(
225- OTLP_VALUE , // use the same as OTel does
226- "metric" , // use the same as OTel does
227232 new VertxGrpcSender (
228233 baseUri ,
229234 VertxGrpcSender .GRPC_METRIC_SERVICE_NAME ,
@@ -232,15 +237,19 @@ public MetricExporter apply(SyntheticCreationalContext<MetricExporter> context)
232237 populateTracingExportHttpHeaders (metricsConfig ),
233238 new HttpClientOptionsConsumer (metricsConfig , baseUri , tlsConfigurationRegistry ),
234239 vertx .get ()),
235- MeterProvider ::noop ),
240+ InternalTelemetryVersion .LATEST ,
241+ exporterBridge .getValue ().createStandardComponentId (
242+ StandardComponentId .ExporterType .OTLP_GRPC_METRIC_EXPORTER ), // use the same as OTel does
243+ MeterProvider ::noop ,
244+ baseUri .toASCIIString ()),
236245 aggregationTemporalityResolver (metricsConfig ),
237246 aggregationResolver (metricsConfig ));
238247 } else if (HTTP_PROTOBUF .equals (protocol )) {
239248 boolean exportAsJson = false ; //TODO: this will be enhanced in the future
240249 metricExporter = new VertxHttpMetricsExporter (
241250 new HttpExporter <MetricsRequestMarshaler >(
242- OTLP_VALUE , // use the same as OTel does
243- "metric" , // use the same as OTel does
251+ exporterBridge . getValue (). createStandardComponentId (
252+ StandardComponentId . ExporterType . OTLP_HTTP_METRIC_EXPORTER ),
244253 new VertxHttpSender (
245254 baseUri ,
246255 VertxHttpSender .METRICS_PATH ,
@@ -251,7 +260,8 @@ public MetricExporter apply(SyntheticCreationalContext<MetricExporter> context)
251260 new HttpClientOptionsConsumer (metricsConfig , baseUri , tlsConfigurationRegistry ),
252261 vertx .get ()),
253262 MeterProvider ::noop ,
254- exportAsJson ),
263+ InternalTelemetryVersion .LATEST ,
264+ baseUri .toASCIIString ()),
255265 aggregationTemporalityResolver (metricsConfig ),
256266 aggregationResolver (metricsConfig ));
257267 } else {
@@ -294,8 +304,6 @@ public LogRecordExporter apply(SyntheticCreationalContext<LogRecordExporter> con
294304 if (GRPC .equals (protocol )) {
295305 logRecordExporter = new VertxGrpcLogRecordExporter (
296306 new GrpcExporter <LogsRequestMarshaler >(
297- OTLP_VALUE , // use the same as OTel does
298- "log" , // use the same as OTel does
299307 new VertxGrpcSender (
300308 baseUri ,
301309 VertxGrpcSender .GRPC_LOG_SERVICE_NAME ,
@@ -304,13 +312,17 @@ public LogRecordExporter apply(SyntheticCreationalContext<LogRecordExporter> con
304312 populateTracingExportHttpHeaders (logsConfig ),
305313 new HttpClientOptionsConsumer (logsConfig , baseUri , tlsConfigurationRegistry ),
306314 vertx .get ()),
307- MeterProvider ::noop ));
315+ InternalTelemetryVersion .LATEST ,
316+ exporterBridge .getValue ().createStandardComponentId (
317+ StandardComponentId .ExporterType .OTLP_GRPC_LOG_EXPORTER ), // use the same as OTel does
318+ MeterProvider ::noop ,
319+ baseUri .toASCIIString ()));
308320 } else if (HTTP_PROTOBUF .equals (protocol )) {
309321 boolean exportAsJson = false ; //TODO: this will be enhanced in the future
310322 logRecordExporter = new VertxHttpLogRecordExporter (
311323 new HttpExporter <LogsRequestMarshaler >(
312- OTLP_VALUE , // use the same as OTel does
313- "log" , // use the same as OTel does
324+ exporterBridge . getValue (). createStandardComponentId (
325+ StandardComponentId . ExporterType . OTLP_HTTP_LOG_EXPORTER ),
314326 new VertxHttpSender (
315327 baseUri ,
316328 VertxHttpSender .LOGS_PATH ,
@@ -321,7 +333,8 @@ public LogRecordExporter apply(SyntheticCreationalContext<LogRecordExporter> con
321333 new HttpClientOptionsConsumer (logsConfig , baseUri , tlsConfigurationRegistry ),
322334 vertx .get ()),
323335 MeterProvider ::noop ,
324- exportAsJson ));
336+ InternalTelemetryVersion .LATEST ,
337+ baseUri .toASCIIString ()));
325338 } else {
326339 throw new IllegalArgumentException (String .format ("Unsupported OTLP protocol %s specified. " +
327340 "Please check `quarkus.otel.exporter.otlp.logs.protocol` property" , protocol ));
0 commit comments