diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/diagnostics/DiagnosticsHelper.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/diagnostics/DiagnosticsHelper.java index 69051daf403..0864f55008d 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/diagnostics/DiagnosticsHelper.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/diagnostics/DiagnosticsHelper.java @@ -47,15 +47,16 @@ public static void initRpIntegration(Path agentPath) { if (RpAttachType.INTEGRATED_AUTO.equals(RpAttachType.getRpAttachType())) { appSvcRpIntegratedAuto = true; } + } else if (!Strings.isNullOrEmpty( + System.getenv("APPLICATIONINSIGHTS_SPRINGCLOUD_SERVICE_ID"))) { + // Spring Cloud needs to be checked before AKS since it runs on AKS + PropertyHelper.setRpIntegrationChar('s'); + setRpAttachType(agentPath, "springcloud.codeless"); } else if (!Strings.isNullOrEmpty(System.getenv("AKS_ARM_NAMESPACE_ID"))) { // AKS_ARM_NAMESPACE_ID is an env var available in AKS only and it's also used as the AKS // attach rate numerator PropertyHelper.setRpIntegrationChar('k'); setRpAttachType(agentPath, "aks.codeless"); - } else if (!Strings.isNullOrEmpty( - System.getenv("APPLICATIONINSIGHTS_SPRINGCLOUD_SERVICE_ID"))) { - PropertyHelper.setRpIntegrationChar('s'); - setRpAttachType(agentPath, "springcloud.codeless"); } else { RpAttachType.setRpAttachType(RpAttachType.STANDALONE_AUTO); // default }