From 3a4a5681ac3772734ba3d8829c3bfeb094d83a98 Mon Sep 17 00:00:00 2001 From: Jean Bisutti Date: Mon, 14 Oct 2024 15:01:21 +0200 Subject: [PATCH] Display byos message for profiler --- .../agent/internal/profiler/ProfilingInitializer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/profiler/ProfilingInitializer.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/profiler/ProfilingInitializer.java index 46e14920d54..ad61588acd8 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/profiler/ProfilingInitializer.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/profiler/ProfilingInitializer.java @@ -163,10 +163,17 @@ private void pullProfilerSettings(ConfigService configService) { } private void logProfilerPullError(Throwable e) { + String exceptionMessage = e.getMessage(); + boolean displayByosMessage = exceptionMessage.contains("Received error code 403 from"); + String byosMessage = + " If you bring your own storage, please follow these instructions: " + + "https://learn.microsoft.com/azure/azure-monitor/profiler/profiler-bring-your-own-storage"; + String logMessage = + "Error pulling service profiler settings." + (displayByosMessage ? byosMessage : ""); if (currentlyEnabled.get()) { - logger.error("Error pulling service profiler settings", e); + logger.error(logMessage, e); } else { - logger.debug("Error pulling service profiler settings", e); + logger.debug(logMessage, e); } }