From 0a79630c452a25bf50914197acfbddde727665ed Mon Sep 17 00:00:00 2001 From: Timothy Mothra Date: Fri, 15 Sep 2023 14:07:46 -0700 Subject: [PATCH] null check (#38755) --- .../src/Internals/ResourceExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs index b4c24d207a7ce..f38ca549afd76 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs @@ -123,7 +123,7 @@ internal static class ResourceExtensions try { var exportResource = Environment.GetEnvironmentVariable(EnvironmentVariableConstants.EXPORT_RESOURCE_METRIC); - if (exportResource.Equals("true", StringComparison.OrdinalIgnoreCase)) + if (exportResource != null && exportResource.Equals("true", StringComparison.OrdinalIgnoreCase)) { shouldReportMetricTelemetry = true; }