11package io .quarkus .opentelemetry .runtime .exporter .otlp ;
22
3- import static io .quarkus . opentelemetry .runtime . config . build .ExporterType .Constants . OTLP_VALUE ;
3+ import static io .opentelemetry .sdk . internal . StandardComponentId .ExporterType .OTLP_GRPC_METRIC_EXPORTER ;
44import static io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterConfig .Protocol .GRPC ;
55import static io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterConfig .Protocol .HTTP_PROTOBUF ;
66import static io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterRuntimeConfig .DEFAULT_GRPC_BASE_URI ;
2727import io .opentelemetry .exporter .internal .otlp .traces .TraceRequestMarshaler ;
2828import io .opentelemetry .exporter .otlp .internal .OtlpUserAgent ;
2929import io .opentelemetry .sdk .autoconfigure .spi .ConfigurationException ;
30+ import io .opentelemetry .sdk .common .InternalTelemetryVersion ;
31+ import io .opentelemetry .sdk .internal .ComponentId ;
32+ import io .opentelemetry .sdk .internal .StandardComponentId ;
3033import io .opentelemetry .sdk .logs .export .LogRecordExporter ;
3134import io .opentelemetry .sdk .metrics .Aggregation ;
3235import io .opentelemetry .sdk .metrics .InstrumentType ;
4346import io .quarkus .opentelemetry .runtime .config .build .OTelBuildConfig ;
4447import io .quarkus .opentelemetry .runtime .config .runtime .BatchSpanProcessorConfig ;
4548import io .quarkus .opentelemetry .runtime .config .runtime .OTelRuntimeConfig ;
46- import io .quarkus .opentelemetry .runtime .config .runtime .exporter .*;
49+ import io .quarkus .opentelemetry .runtime .config .runtime .exporter .CompressionType ;
50+ import io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterConfig ;
51+ import io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterLogsConfig ;
52+ import io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterMetricsConfig ;
53+ import io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterRuntimeConfig ;
54+ import io .quarkus .opentelemetry .runtime .config .runtime .exporter .OtlpExporterTracesConfig ;
4755import io .quarkus .opentelemetry .runtime .exporter .otlp .logs .NoopLogRecordExporter ;
4856import io .quarkus .opentelemetry .runtime .exporter .otlp .logs .VertxGrpcLogRecordExporter ;
4957import io .quarkus .opentelemetry .runtime .exporter .otlp .logs .VertxHttpLogRecordExporter ;
@@ -105,6 +113,7 @@ public LateBoundSpanProcessor apply(
105113 try {
106114 TlsConfigurationRegistry tlsConfigurationRegistry = context
107115 .getInjectedReference (TlsConfigurationRegistry .class );
116+
108117 var spanExporter = createSpanExporter (exporterRuntimeConfig .getValue (), vertx .get (), baseUri ,
109118 tlsConfigurationRegistry );
110119
@@ -140,9 +149,11 @@ private SpanExporter createSpanExporter(OtlpExporterRuntimeConfig exporterRuntim
140149
141150 String protocol = tracesConfig .protocol ().get ();
142151 if (GRPC .equals (protocol )) {
143- return createOtlpGrpcSpanExporter (exporterRuntimeConfig , vertx , baseUri , tlsConfigurationRegistry );
152+ return createOtlpGrpcSpanExporter (exporterRuntimeConfig , vertx , baseUri ,
153+ tlsConfigurationRegistry );
144154 } else if (HTTP_PROTOBUF .equals (protocol )) {
145- return createHttpSpanExporter (exporterRuntimeConfig , vertx , baseUri , protocol , tlsConfigurationRegistry );
155+ return createHttpSpanExporter (exporterRuntimeConfig , vertx , baseUri , protocol ,
156+ tlsConfigurationRegistry );
146157 }
147158
148159 throw new IllegalArgumentException (String .format ("Unsupported OTLP protocol %s specified. " +
@@ -156,8 +167,6 @@ private SpanExporter createOtlpGrpcSpanExporter(OtlpExporterRuntimeConfig export
156167 OtlpExporterTracesConfig tracesConfig = exporterRuntimeConfig .traces ();
157168
158169 return new VertxGrpcSpanExporter (new GrpcExporter <TraceRequestMarshaler >(
159- OTLP_VALUE , // use the same as OTel does
160- "span" , // use the same as OTel does
161170 new VertxGrpcSender (
162171 baseUri ,
163172 VertxGrpcSender .GRPC_TRACE_SERVICE_NAME ,
@@ -166,7 +175,10 @@ private SpanExporter createOtlpGrpcSpanExporter(OtlpExporterRuntimeConfig export
166175 populateTracingExportHttpHeaders (tracesConfig ),
167176 new HttpClientOptionsConsumer (tracesConfig , baseUri , tlsConfigurationRegistry ),
168177 vertx ),
169- MeterProvider ::noop ));
178+ InternalTelemetryVersion .LATEST ,
179+ ComponentId .generateLazy (StandardComponentId .ExporterType .OTLP_GRPC_SPAN_EXPORTER ), // use the same as OTel does
180+ MeterProvider ::noop ,
181+ baseUri .toASCIIString ()));
170182 }
171183
172184 private SpanExporter createHttpSpanExporter (OtlpExporterRuntimeConfig exporterRuntimeConfig , Vertx vertx ,
@@ -178,8 +190,7 @@ private SpanExporter createHttpSpanExporter(OtlpExporterRuntimeConfig exporterRu
178190 boolean exportAsJson = false ; //TODO: this will be enhanced in the future
179191
180192 return new VertxHttpSpanExporter (new HttpExporter <TraceRequestMarshaler >(
181- OTLP_VALUE , // use the same as OTel does
182- "span" , // use the same as OTel does
193+ ComponentId .generateLazy (StandardComponentId .ExporterType .OTLP_HTTP_SPAN_EXPORTER ),
183194 new VertxHttpSender (
184195 baseUri ,
185196 VertxHttpSender .TRACES_PATH ,
@@ -190,7 +201,8 @@ private SpanExporter createHttpSpanExporter(OtlpExporterRuntimeConfig exporterRu
190201 new HttpClientOptionsConsumer (tracesConfig , baseUri , tlsConfigurationRegistry ),
191202 vertx ),
192203 MeterProvider ::noop ,
193- exportAsJson ));
204+ InternalTelemetryVersion .LATEST ,
205+ baseUri .toASCIIString ()));
194206 }
195207 };
196208 }
@@ -222,8 +234,6 @@ public MetricExporter apply(SyntheticCreationalContext<MetricExporter> context)
222234 if (GRPC .equals (protocol )) {
223235 metricExporter = new VertxGrpcMetricExporter (
224236 new GrpcExporter <MetricsRequestMarshaler >(
225- OTLP_VALUE , // use the same as OTel does
226- "metric" , // use the same as OTel does
227237 new VertxGrpcSender (
228238 baseUri ,
229239 VertxGrpcSender .GRPC_METRIC_SERVICE_NAME ,
@@ -232,15 +242,18 @@ public MetricExporter apply(SyntheticCreationalContext<MetricExporter> context)
232242 populateTracingExportHttpHeaders (metricsConfig ),
233243 new HttpClientOptionsConsumer (metricsConfig , baseUri , tlsConfigurationRegistry ),
234244 vertx .get ()),
235- MeterProvider ::noop ),
245+ InternalTelemetryVersion .LATEST ,
246+ ComponentId .generateLazy (OTLP_GRPC_METRIC_EXPORTER ), // use the same as OTel does
247+ MeterProvider ::noop ,
248+ baseUri .toASCIIString ()),
236249 aggregationTemporalityResolver (metricsConfig ),
237250 aggregationResolver (metricsConfig ));
238251 } else if (HTTP_PROTOBUF .equals (protocol )) {
239252 boolean exportAsJson = false ; //TODO: this will be enhanced in the future
240253 metricExporter = new VertxHttpMetricsExporter (
241254 new HttpExporter <MetricsRequestMarshaler >(
242- OTLP_VALUE , // use the same as OTel does
243- "metric" , // use the same as OTel does
255+ ComponentId . generateLazy (
256+ StandardComponentId . ExporterType . OTLP_HTTP_METRIC_EXPORTER ),
244257 new VertxHttpSender (
245258 baseUri ,
246259 VertxHttpSender .METRICS_PATH ,
@@ -251,7 +264,8 @@ public MetricExporter apply(SyntheticCreationalContext<MetricExporter> context)
251264 new HttpClientOptionsConsumer (metricsConfig , baseUri , tlsConfigurationRegistry ),
252265 vertx .get ()),
253266 MeterProvider ::noop ,
254- exportAsJson ),
267+ InternalTelemetryVersion .LATEST ,
268+ baseUri .toASCIIString ()),
255269 aggregationTemporalityResolver (metricsConfig ),
256270 aggregationResolver (metricsConfig ));
257271 } else {
@@ -294,8 +308,6 @@ public LogRecordExporter apply(SyntheticCreationalContext<LogRecordExporter> con
294308 if (GRPC .equals (protocol )) {
295309 logRecordExporter = new VertxGrpcLogRecordExporter (
296310 new GrpcExporter <LogsRequestMarshaler >(
297- OTLP_VALUE , // use the same as OTel does
298- "log" , // use the same as OTel does
299311 new VertxGrpcSender (
300312 baseUri ,
301313 VertxGrpcSender .GRPC_LOG_SERVICE_NAME ,
@@ -304,13 +316,17 @@ public LogRecordExporter apply(SyntheticCreationalContext<LogRecordExporter> con
304316 populateTracingExportHttpHeaders (logsConfig ),
305317 new HttpClientOptionsConsumer (logsConfig , baseUri , tlsConfigurationRegistry ),
306318 vertx .get ()),
307- MeterProvider ::noop ));
319+ InternalTelemetryVersion .LATEST ,
320+ ComponentId .generateLazy (
321+ StandardComponentId .ExporterType .OTLP_GRPC_LOG_EXPORTER ), // use the same as OTel does
322+ MeterProvider ::noop ,
323+ baseUri .toASCIIString ()));
308324 } else if (HTTP_PROTOBUF .equals (protocol )) {
309325 boolean exportAsJson = false ; //TODO: this will be enhanced in the future
310326 logRecordExporter = new VertxHttpLogRecordExporter (
311327 new HttpExporter <LogsRequestMarshaler >(
312- OTLP_VALUE , // use the same as OTel does
313- "log" , // use the same as OTel does
328+ ComponentId . generateLazy (
329+ StandardComponentId . ExporterType . OTLP_HTTP_LOG_EXPORTER ),
314330 new VertxHttpSender (
315331 baseUri ,
316332 VertxHttpSender .LOGS_PATH ,
@@ -321,7 +337,8 @@ public LogRecordExporter apply(SyntheticCreationalContext<LogRecordExporter> con
321337 new HttpClientOptionsConsumer (logsConfig , baseUri , tlsConfigurationRegistry ),
322338 vertx .get ()),
323339 MeterProvider ::noop ,
324- exportAsJson ));
340+ InternalTelemetryVersion .LATEST ,
341+ baseUri .toASCIIString ()));
325342 } else {
326343 throw new IllegalArgumentException (String .format ("Unsupported OTLP protocol %s specified. " +
327344 "Please check `quarkus.otel.exporter.otlp.logs.protocol` property" , protocol ));
0 commit comments