|
3 | 3 |
|
4 | 4 | package com.microsoft.applicationinsights.agent.internal.configuration; |
5 | 5 |
|
6 | | -import com.azure.monitor.opentelemetry.autoconfigure.implementation.SemanticAttributes; |
7 | 6 | import com.azure.monitor.opentelemetry.autoconfigure.implementation.statsbeat.RpAttachType; |
8 | 7 | import com.azure.monitor.opentelemetry.autoconfigure.implementation.utils.HostName; |
9 | 8 | import com.azure.monitor.opentelemetry.autoconfigure.implementation.utils.Strings; |
|
22 | 21 | import com.microsoft.applicationinsights.agent.internal.configuration.Configuration.SamplingOverride; |
23 | 22 | import com.microsoft.applicationinsights.agent.internal.diagnostics.DiagnosticsHelper; |
24 | 23 | import io.opentelemetry.api.common.AttributeKey; |
| 24 | +import io.opentelemetry.semconv.ClientAttributes; |
| 25 | +import io.opentelemetry.semconv.HttpAttributes; |
| 26 | +import io.opentelemetry.semconv.NetworkAttributes; |
| 27 | +import io.opentelemetry.semconv.ServerAttributes; |
| 28 | +import io.opentelemetry.semconv.UrlAttributes; |
| 29 | +import io.opentelemetry.semconv.incubating.HttpIncubatingAttributes; |
| 30 | +import io.opentelemetry.semconv.incubating.NetIncubatingAttributes; |
25 | 31 | import java.io.IOException; |
26 | 32 | import java.net.URL; |
27 | 33 | import java.net.URLDecoder; |
@@ -359,44 +365,44 @@ private static void supportTelemetryProcessorsOldSemConv(Configuration config) { |
359 | 365 | private static String mapAttributeKey(String oldAttributeKey) { |
360 | 366 | String result = null; |
361 | 367 | // Common attributes across HTTP client and server spans |
362 | | - if (oldAttributeKey.equals(SemanticAttributes.HTTP_METHOD.getKey())) { |
363 | | - result = SemanticAttributes.HTTP_REQUEST_METHOD.getKey(); |
364 | | - } else if (oldAttributeKey.equals(SemanticAttributes.HTTP_STATUS_CODE.getKey())) { |
365 | | - result = SemanticAttributes.HTTP_RESPONSE_STATUS_CODE.getKey(); |
| 368 | + if (oldAttributeKey.equals(HttpIncubatingAttributes.HTTP_METHOD.getKey())) { |
| 369 | + result = HttpAttributes.HTTP_REQUEST_METHOD.getKey(); |
| 370 | + } else if (oldAttributeKey.equals(HttpIncubatingAttributes.HTTP_STATUS_CODE.getKey())) { |
| 371 | + result = HttpAttributes.HTTP_RESPONSE_STATUS_CODE.getKey(); |
366 | 372 | } else if (oldAttributeKey.startsWith("http.request.header.") |
367 | 373 | || oldAttributeKey.startsWith("http.response.header.")) { |
368 | 374 | result = oldAttributeKey.replace('_', '-'); |
369 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_PROTOCOL_NAME.getKey())) { |
370 | | - result = SemanticAttributes.NETWORK_PROTOCOL_NAME.getKey(); |
371 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_PROTOCOL_VERSION.getKey())) { |
372 | | - result = SemanticAttributes.NETWORK_PROTOCOL_VERSION.getKey(); |
373 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_SOCK_PEER_ADDR.getKey())) { |
374 | | - result = SemanticAttributes.NETWORK_PEER_ADDRESS.getKey(); |
375 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_SOCK_PEER_PORT.getKey())) { |
376 | | - result = SemanticAttributes.NETWORK_PEER_PORT.getKey(); |
| 375 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_PROTOCOL_NAME.getKey())) { |
| 376 | + result = NetworkAttributes.NETWORK_PROTOCOL_NAME.getKey(); |
| 377 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_PROTOCOL_VERSION.getKey())) { |
| 378 | + result = NetworkAttributes.NETWORK_PROTOCOL_VERSION.getKey(); |
| 379 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_SOCK_PEER_ADDR.getKey())) { |
| 380 | + result = NetworkAttributes.NETWORK_PEER_ADDRESS.getKey(); |
| 381 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_SOCK_PEER_PORT.getKey())) { |
| 382 | + result = NetworkAttributes.NETWORK_PEER_PORT.getKey(); |
377 | 383 | } |
378 | 384 |
|
379 | 385 | // HTTP client span attributes |
380 | 386 | // http.url is handled via LazyHttpUrl |
381 | | - if (oldAttributeKey.equals(SemanticAttributes.HTTP_RESEND_COUNT.getKey())) { |
382 | | - result = SemanticAttributes.HTTP_REQUEST_RESEND_COUNT.getKey(); |
| 387 | + if (oldAttributeKey.equals("http.resend_count")) { |
| 388 | + result = HttpAttributes.HTTP_REQUEST_RESEND_COUNT.getKey(); |
383 | 389 | // becomes available. |
384 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_PEER_NAME.getKey())) { |
385 | | - result = SemanticAttributes.SERVER_ADDRESS.getKey(); |
386 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_PEER_PORT.getKey())) { |
387 | | - result = SemanticAttributes.SERVER_PORT.getKey(); |
| 390 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_PEER_NAME.getKey())) { |
| 391 | + result = ServerAttributes.SERVER_ADDRESS.getKey(); |
| 392 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_PEER_PORT.getKey())) { |
| 393 | + result = ServerAttributes.SERVER_PORT.getKey(); |
388 | 394 | } |
389 | 395 |
|
390 | 396 | // HTTP server span attributes |
391 | 397 | // http.target is handled via LazyHttpTarget |
392 | | - if (oldAttributeKey.equals(SemanticAttributes.HTTP_SCHEME.getKey())) { |
393 | | - result = SemanticAttributes.URL_SCHEME.getKey(); |
394 | | - } else if (oldAttributeKey.equals(SemanticAttributes.HTTP_CLIENT_IP.getKey())) { |
395 | | - result = SemanticAttributes.CLIENT_ADDRESS.getKey(); |
396 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_HOST_NAME.getKey())) { |
397 | | - result = SemanticAttributes.SERVER_ADDRESS.getKey(); |
398 | | - } else if (oldAttributeKey.equals(SemanticAttributes.NET_HOST_PORT.getKey())) { |
399 | | - result = SemanticAttributes.SERVER_PORT.getKey(); |
| 398 | + if (oldAttributeKey.equals(HttpIncubatingAttributes.HTTP_SCHEME.getKey())) { |
| 399 | + result = UrlAttributes.URL_SCHEME.getKey(); |
| 400 | + } else if (oldAttributeKey.equals(HttpIncubatingAttributes.HTTP_CLIENT_IP.getKey())) { |
| 401 | + result = ClientAttributes.CLIENT_ADDRESS.getKey(); |
| 402 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_HOST_NAME.getKey())) { |
| 403 | + result = ServerAttributes.SERVER_ADDRESS.getKey(); |
| 404 | + } else if (oldAttributeKey.equals(NetIncubatingAttributes.NET_HOST_PORT.getKey())) { |
| 405 | + result = ServerAttributes.SERVER_PORT.getKey(); |
400 | 406 | } |
401 | 407 |
|
402 | 408 | if (result == null) { |
|
0 commit comments