From 43418903187a24582d787cea75c93de71aee928b Mon Sep 17 00:00:00 2001 From: Helen <56097766+heyams@users.noreply.github.com> Date: Wed, 22 Feb 2023 07:46:13 -0800 Subject: [PATCH] Set resultCode to zero when Span.httpStatusCode is not present (#2925) https://1dsdocs.azurewebsites.net/schema/Mappings/AzureMonitor-AI.html#remotedependencyresultcode --- .../opentelemetry/exporter/implementation/SpanDataMapper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agent/azure-monitor-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/SpanDataMapper.java b/agent/azure-monitor-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/SpanDataMapper.java index cc7886d2712..f2abc4ecc8e 100644 --- a/agent/azure-monitor-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/SpanDataMapper.java +++ b/agent/azure-monitor-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/SpanDataMapper.java @@ -300,6 +300,9 @@ private static void applyHttpClientSpan( Long httpStatusCode = attributes.get(SemanticAttributes.HTTP_STATUS_CODE); if (httpStatusCode != null) { telemetryBuilder.setResultCode(Long.toString(httpStatusCode)); + } else { + // https://1dsdocs.azurewebsites.net/schema/Mappings/AzureMonitor-AI.html#remotedependencyresultcode + telemetryBuilder.setResultCode("0"); } telemetryBuilder.setData(httpUrl);