diff --git a/src/OpenTelemetry.Resources.Azure/CHANGELOG.md b/src/OpenTelemetry.Resources.Azure/CHANGELOG.md index dcc564a71f..dad1807cdd 100644 --- a/src/OpenTelemetry.Resources.Azure/CHANGELOG.md +++ b/src/OpenTelemetry.Resources.Azure/CHANGELOG.md @@ -6,6 +6,13 @@ App Service resource detector. ([#5138](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/5138)) +* Updated the following values for the `cloud.platform` attribute to + comply with v1.43.0 of the OpenTelemetry Semantic Conventions: + * `azure_app_service` to `azure.app_service` + * `azure_container_apps` to `azure.container_apps` + * `azure_vm` to `azure.vm` + ([#5143](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/5143)) + ## 1.18.0-beta.1 Released 2026-Aug-21 diff --git a/src/OpenTelemetry.Resources.Azure/README.md b/src/OpenTelemetry.Resources.Azure/README.md index c32bf29fac..d6c919fe3b 100644 --- a/src/OpenTelemetry.Resources.Azure/README.md +++ b/src/OpenTelemetry.Resources.Azure/README.md @@ -53,7 +53,7 @@ using var loggerFactory = LoggerFactory.Create(builder => | azure.app.service.stamp | The specific "stamp" cluster within Azure where the App Service is running, e.g., "waws-prod-sn1-001". | | azure.resource_group.name | The Azure resource group from `WEBSITE_RESOURCE_GROUP`. Emitted when the environment variable is non-empty. | | cloud.account.id | The Azure subscription ID parsed from `WEBSITE_OWNER_NAME`. Emitted when the environment variable is non-empty. | -| cloud.platform | The cloud platform. Here, it's always "azure_app_service". | +| cloud.platform | The cloud platform. Here, it's always "azure.app_service". | | cloud.provider | The cloud service provider. In this context, it's always "azure". | | cloud.resource_id | The Azure Resource Manager URI uniquely identifying the Azure App Service. Typically in the format "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Web/sites/{siteName}". | | cloud.region | The Azure region where the App Service is hosted, e.g., "East US", "West Europe", etc. | @@ -86,7 +86,7 @@ using var meterProvider = Sdk.CreateMeterProviderBuilder() | Attribute | Description | | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | azure.vm.scaleset.name | The name of the Virtual Machine Scale Set if the VM is part of one. | -| cloud.platform | The cloud platform, which is always set to "azure_vm" in this context. | +| cloud.platform | The cloud platform, which is always set to "azure.vm" in this context. | | cloud.provider | The cloud service provider, which is always set to "azure" in this context. | | cloud.region | The Azure region where the Virtual Machine is hosted, such as "East US", "West Europe", etc. | | cloud.resource_id | The Azure Resource Manager URI uniquely identifying the Azure Virtual Machine. It typically follows this format: "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/virtualMachines/{vmName}". | @@ -120,7 +120,7 @@ using var meterProvider = Sdk.CreateMeterProviderBuilder() | Attribute | Description | | ------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| cloud.platform | The cloud platform. Here, it's always "azure_container_apps". | +| cloud.platform | The cloud platform. Here, it's always "azure.container_apps". | | cloud.provider | The cloud service provider. In this context, it's always "azure". | | service.instance.id | Represents the specific instance ID of Azure Container Apps, useful in scaled-out configurations. | | service.name | The name of the Azure Container Apps or Azure Container Apps job. | diff --git a/src/OpenTelemetry.Resources.Azure/ResourceAttributeConstants.cs b/src/OpenTelemetry.Resources.Azure/ResourceAttributeConstants.cs index 40585cfe9a..dd66281c10 100644 --- a/src/OpenTelemetry.Resources.Azure/ResourceAttributeConstants.cs +++ b/src/OpenTelemetry.Resources.Azure/ResourceAttributeConstants.cs @@ -32,8 +32,8 @@ internal sealed class ResourceAttributeConstants internal const string AzureContainerAppJobExecutionNameEnvVar = "CONTAINER_APP_JOB_EXECUTION_NAME"; // Azure resource attributes constant values - internal const string AzureAppServicePlatformValue = "azure_app_service"; + internal const string AzureAppServicePlatformValue = "azure.app_service"; internal const string AzureCloudProviderValue = "azure"; - internal const string AzureVmCloudPlatformValue = "azure_vm"; - internal const string AzureContainerAppsPlatformValue = "azure_container_apps"; + internal const string AzureVmCloudPlatformValue = "azure.vm"; + internal const string AzureContainerAppsPlatformValue = "azure.container_apps"; } diff --git a/test/OpenTelemetry.Resources.Azure.Tests/AzureResourceDetectorTests.cs b/test/OpenTelemetry.Resources.Azure.Tests/AzureResourceDetectorTests.cs index bde686d3db..228abe2b26 100644 --- a/test/OpenTelemetry.Resources.Azure.Tests/AzureResourceDetectorTests.cs +++ b/test/OpenTelemetry.Resources.Azure.Tests/AzureResourceDetectorTests.cs @@ -108,6 +108,7 @@ public void AppServiceResourceDetectorReturnsResourceWithAttributes() Assert.Contains(new KeyValuePair(ResourceSemanticConventions.AttributeCloudResourceId, expectedResourceUri), resource.Attributes); Assert.Contains(new KeyValuePair(ResourceAttributeConstants.AzureResourceGroupName, "testResourceGroup"), resource.Attributes); Assert.Contains(new KeyValuePair(ResourceSemanticConventions.AttributeServiceName, "sitename"), resource.Attributes); + Assert.Contains(new KeyValuePair(ResourceSemanticConventions.AttributeCloudPlatform, "azure.app_service"), resource.Attributes); foreach (var kvp in AppServiceResourceDetector.AppServiceResourceAttributes) { @@ -183,7 +184,7 @@ public void TestAzureVmResourceDetector() var expectedValue = field switch { ResourceSemanticConventions.AttributeServiceInstance => new KeyValuePair(field, ResourceSemanticConventions.AttributeHostId), - ResourceSemanticConventions.AttributeCloudPlatform => new KeyValuePair(field, ResourceAttributeConstants.AzureVmCloudPlatformValue), + ResourceSemanticConventions.AttributeCloudPlatform => new KeyValuePair(field, "azure.vm"), ResourceSemanticConventions.AttributeCloudProvider => new KeyValuePair(field, ResourceAttributeConstants.AzureCloudProviderValue), _ => new KeyValuePair(field, field), }; @@ -222,6 +223,7 @@ public void AzureContainerAppsResourceDetectorReturnsResourceWithAttributes() Assert.StartsWith("https://opentelemetry.io/schemas/", resource.SchemaUrl); Assert.Contains(new KeyValuePair(ResourceSemanticConventions.AttributeServiceName, "containerAppName"), resource.Attributes); + Assert.Contains(new KeyValuePair(ResourceSemanticConventions.AttributeCloudPlatform, "azure.container_apps"), resource.Attributes); foreach (var kvp in AzureContainerAppsResourceDetector.AzureContainerAppResourceAttributes) { @@ -250,6 +252,7 @@ public void AzureContainerAppsJobResourceDetectorReturnsResourceWithAttributes() Assert.StartsWith("https://opentelemetry.io/schemas/", resource.SchemaUrl); Assert.Contains(new KeyValuePair(ResourceSemanticConventions.AttributeServiceName, "containerAppJobName"), resource.Attributes); + Assert.Contains(new KeyValuePair(ResourceSemanticConventions.AttributeCloudPlatform, "azure.container_apps"), resource.Attributes); foreach (var kvp in AzureContainerAppsResourceDetector.AzureContainerAppJobResourceAttributes) {