From d16f2315a4fa95bbb8a4f94192cb1be0aad3097a Mon Sep 17 00:00:00 2001 From: Brendan O'Handley Date: Thu, 6 Feb 2025 18:26:25 -0600 Subject: [PATCH] Explore metrics: Always check that custom var is present for otel dep env migration (#100233) --- .../trails/migrations/otelDeploymentEnvironment.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/public/app/features/trails/migrations/otelDeploymentEnvironment.ts b/public/app/features/trails/migrations/otelDeploymentEnvironment.ts index 969c95bf662..517ce88ce2c 100644 --- a/public/app/features/trails/migrations/otelDeploymentEnvironment.ts +++ b/public/app/features/trails/migrations/otelDeploymentEnvironment.ts @@ -32,8 +32,15 @@ export function migrateOtelDeploymentEnvironment(trail: DataTrail, urlParams: Ur ) { return; } - // if there is no dep env, does not need to be migrated - if (!deploymentEnv) { + + // check that there is a deployment environment variable value to migrate + // in some cases the deployment environment may not present + // but due to this change it is now always present and the value is undefined + // https://github.com/grafana/scenes/pull/1033 + if ( + !deploymentEnv || + (Array.isArray(deploymentEnv) && deploymentEnv.length > 0 && deploymentEnv[0] === 'undefined') + ) { return; }