From ed91a91805d1b4fae6a3dce2e80185729038e6ff Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Fri, 29 Nov 2024 15:58:26 +0000 Subject: [PATCH] Update Azure Function service name logic (#2508) As titled. --- .../Elastic.Apm.Azure.Functions/AzureFunctionsContext.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/azure/Elastic.Apm.Azure.Functions/AzureFunctionsContext.cs b/src/azure/Elastic.Apm.Azure.Functions/AzureFunctionsContext.cs index 9bbdfe731..1aa573a1b 100644 --- a/src/azure/Elastic.Apm.Azure.Functions/AzureFunctionsContext.cs +++ b/src/azure/Elastic.Apm.Azure.Functions/AzureFunctionsContext.cs @@ -40,11 +40,15 @@ private void UpdateServiceInformation(Service? service) return; } - if (service.Name == AbstractConfigurationReader.AdaptServiceName(AbstractConfigurationReader.DiscoverDefaultServiceName())) + var defaultServiceName = AbstractConfigurationReader.AdaptServiceName(AbstractConfigurationReader.DiscoverDefaultServiceName()); + + // In local development `WEBSITE_SITE_NAME` may not be set, in which case, we use the discovered default service name + if (service.Name == defaultServiceName && MetaData.WebsiteSiteName is not null) { // Only override the service name if it was set to default. service.Name = MetaData.WebsiteSiteName; } + service.Framework = new() { Name = "Azure Functions", Version = MetaData.FunctionsExtensionVersion }; var runtimeVersion = service.Runtime?.Version ?? "n/a"; service.Runtime = new() { Name = MetaData.FunctionsWorkerRuntime, Version = runtimeVersion };