From 3a67f7820e10e23b1099ae285a258bb8a7486230 Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 15 May 2026 03:45:08 +0200 Subject: [PATCH] fix(backend): disable OTel SDK in tests + exclude azure-resources to fix semconv conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit opentelemetry-spring-boot-starter:2.27.0 pulls in AzureAppServiceResourceProvider which references ServiceAttributes.SERVICE_INSTANCE_ID — a field absent from the semconv version used by this project. This caused every integration test to fail with NoSuchFieldError during Spring context startup. Fix 1 (application-test.yaml): set otel.sdk.disabled=true so the OTel auto-configuration never runs during tests at all. Fix 2 (pom.xml): exclude opentelemetry-azure-resources from the starter dependency to remove the problematic provider from the dependency graph entirely. Co-Authored-By: Claude Sonnet 4.6 --- backend/pom.xml | 8 ++++++++ backend/src/test/resources/application-test.yaml | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/backend/pom.xml b/backend/pom.xml index 03a1e4ac..7ac0a6a5 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -215,6 +215,14 @@ io.opentelemetry.instrumentation opentelemetry-spring-boot-starter 2.27.0 + + + + io.opentelemetry.contrib + opentelemetry-azure-resources + + diff --git a/backend/src/test/resources/application-test.yaml b/backend/src/test/resources/application-test.yaml index b561b54e..06a4ada1 100644 --- a/backend/src/test/resources/application-test.yaml +++ b/backend/src/test/resources/application-test.yaml @@ -14,6 +14,12 @@ spring: mail: host: localhost +# Disable OTel SDK entirely in tests — prevents auto-configuration from loading resource providers +# (e.g. AzureAppServiceResourceProvider) that fail against the semconv version used here. +otel: + sdk: + disabled: true + # Disable trace export in tests — prevents OTLP connection attempts when no Tempo is running. # Sampling probability 0.0 means no spans are created, so no export is attempted. management: