diff --git a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_attribute_keys.py b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_attribute_keys.py index 41a01d662..71e675cd3 100644 --- a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_attribute_keys.py +++ b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_attribute_keys.py @@ -33,4 +33,4 @@ AWS_LAMBDA_FUNCTION_NAME: str = "aws.lambda.function.name" AWS_LAMBDA_RESOURCEMAPPING_ID: str = "aws.lambda.resource_mapping.id" AWS_LAMBDA_FUNCTION_ARN: str = "aws.lambda.function.arn" -AWS_AI_AGENT_TYPE: str = "aws.ai.agent.type" +AWS_SERVICE_TYPE: str = "aws.service.type" diff --git a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py index 761852f39..8a97b7afc 100644 --- a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py +++ b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py @@ -9,7 +9,7 @@ from importlib_metadata import version from typing_extensions import override -from amazon.opentelemetry.distro._aws_attribute_keys import AWS_AI_AGENT_TYPE, AWS_LOCAL_SERVICE +from amazon.opentelemetry.distro._aws_attribute_keys import AWS_LOCAL_SERVICE, AWS_SERVICE_TYPE from amazon.opentelemetry.distro._aws_resource_attribute_configurator import get_service_attribute from amazon.opentelemetry.distro._utils import is_agent_observability_enabled, is_installed from amazon.opentelemetry.distro.always_record_sampler import AlwaysRecordSampler @@ -558,10 +558,10 @@ def _customize_resource(resource: Resource) -> Resource: custom_attributes = {AWS_LOCAL_SERVICE: service_name} if is_agent_observability_enabled(): - # Add aws.ai.agent.type if it doesn't exist in the resource - if resource and resource.attributes.get(AWS_AI_AGENT_TYPE) is None: + # Add aws.service.type if it doesn't exist in the resource + if resource and resource.attributes.get(AWS_SERVICE_TYPE) is None: # Set a default agent type for AI agent observability - custom_attributes[AWS_AI_AGENT_TYPE] = "default" + custom_attributes[AWS_SERVICE_TYPE] = "gen_ai_agent" return resource.merge(Resource.create(custom_attributes)) diff --git a/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py b/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py index 795e1ce4f..b2eb70e60 100644 --- a/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py +++ b/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py @@ -10,7 +10,7 @@ from requests import Session -from amazon.opentelemetry.distro._aws_attribute_keys import AWS_AI_AGENT_TYPE, AWS_LOCAL_SERVICE +from amazon.opentelemetry.distro._aws_attribute_keys import AWS_LOCAL_SERVICE, AWS_SERVICE_TYPE from amazon.opentelemetry.distro.always_record_sampler import AlwaysRecordSampler from amazon.opentelemetry.distro.attribute_propagating_span_processor import AttributePropagatingSpanProcessor from amazon.opentelemetry.distro.aws_batch_unsampled_span_processor import BatchUnsampledSpanProcessor @@ -1106,7 +1106,7 @@ def test_customize_resource_without_agent_observability(self, mock_get_service_a # Should only have AWS_LOCAL_SERVICE added self.assertEqual(result.attributes[AWS_LOCAL_SERVICE], "test-service") - self.assertNotIn(AWS_AI_AGENT_TYPE, result.attributes) + self.assertNotIn(AWS_SERVICE_TYPE, result.attributes) @patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.is_agent_observability_enabled") @patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.get_service_attribute") @@ -1120,9 +1120,9 @@ def test_customize_resource_with_agent_observability_default( resource = Resource.create({ResourceAttributes.SERVICE_NAME: "test-service"}) result = _customize_resource(resource) - # Should have both AWS_LOCAL_SERVICE and AWS_AI_AGENT_TYPE with default value + # Should have both AWS_LOCAL_SERVICE and AWS_SERVICE_TYPE with default value self.assertEqual(result.attributes[AWS_LOCAL_SERVICE], "test-service") - self.assertEqual(result.attributes[AWS_AI_AGENT_TYPE], "default") + self.assertEqual(result.attributes[AWS_SERVICE_TYPE], "gen_ai_agent") @patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.is_agent_observability_enabled") @patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.get_service_attribute") @@ -1133,13 +1133,13 @@ def test_customize_resource_with_existing_agent_type(self, mock_get_service_attr # Create resource with existing agent type resource = Resource.create( - {ResourceAttributes.SERVICE_NAME: "test-service", AWS_AI_AGENT_TYPE: "existing-agent"} + {ResourceAttributes.SERVICE_NAME: "test-service", AWS_SERVICE_TYPE: "existing-agent"} ) result = _customize_resource(resource) # Should preserve existing agent type and not override it self.assertEqual(result.attributes[AWS_LOCAL_SERVICE], "test-service") - self.assertEqual(result.attributes[AWS_AI_AGENT_TYPE], "existing-agent") + self.assertEqual(result.attributes[AWS_SERVICE_TYPE], "existing-agent") def validate_distro_environ():