Skip to content

Commit 8479ac9

Browse files
committed
Merge branch 'logs-mainline' of https://github.com/liustve/aws-otel-python-instrumentation into logs-mainline
2 parents bce91dc + 153679a commit 8479ac9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_attribute_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
AWS_LAMBDA_FUNCTION_NAME: str = "aws.lambda.function.name"
3434
AWS_LAMBDA_RESOURCEMAPPING_ID: str = "aws.lambda.resource_mapping.id"
3535
AWS_LAMBDA_FUNCTION_ARN: str = "aws.lambda.function.arn"
36-
AWS_AI_AGENT_TYPE: str = "aws.ai.agent.type"
36+
AWS_SERVICE_TYPE: str = "aws.service.type"

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from importlib_metadata import version
1111
from typing_extensions import override
1212

13-
from amazon.opentelemetry.distro._aws_attribute_keys import AWS_AI_AGENT_TYPE, AWS_LOCAL_SERVICE
13+
from amazon.opentelemetry.distro._aws_attribute_keys import AWS_LOCAL_SERVICE, AWS_SERVICE_TYPE
1414
from amazon.opentelemetry.distro._aws_resource_attribute_configurator import get_service_attribute
1515
from amazon.opentelemetry.distro._utils import is_agent_observability_enabled, is_installed
1616
from amazon.opentelemetry.distro.always_record_sampler import AlwaysRecordSampler
@@ -574,10 +574,10 @@ def _customize_resource(resource: Resource) -> Resource:
574574
custom_attributes = {AWS_LOCAL_SERVICE: service_name}
575575

576576
if is_agent_observability_enabled():
577-
# Add aws.ai.agent.type if it doesn't exist in the resource
578-
if resource and resource.attributes.get(AWS_AI_AGENT_TYPE) is None:
577+
# Add aws.service.type if it doesn't exist in the resource
578+
if resource and resource.attributes.get(AWS_SERVICE_TYPE) is None:
579579
# Set a default agent type for AI agent observability
580-
custom_attributes[AWS_AI_AGENT_TYPE] = "default"
580+
custom_attributes[AWS_SERVICE_TYPE] = "gen_ai_agent"
581581

582582
return resource.merge(Resource.create(custom_attributes))
583583

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from requests import Session
1212

13-
from amazon.opentelemetry.distro._aws_attribute_keys import AWS_AI_AGENT_TYPE, AWS_LOCAL_SERVICE
13+
from amazon.opentelemetry.distro._aws_attribute_keys import AWS_LOCAL_SERVICE, AWS_SERVICE_TYPE
1414
from amazon.opentelemetry.distro.always_record_sampler import AlwaysRecordSampler
1515
from amazon.opentelemetry.distro.attribute_propagating_span_processor import AttributePropagatingSpanProcessor
1616
from amazon.opentelemetry.distro.aws_batch_unsampled_span_processor import BatchUnsampledSpanProcessor
@@ -1100,7 +1100,7 @@ def test_customize_resource_without_agent_observability(self, mock_get_service_a
11001100

11011101
# Should only have AWS_LOCAL_SERVICE added
11021102
self.assertEqual(result.attributes[AWS_LOCAL_SERVICE], "test-service")
1103-
self.assertNotIn(AWS_AI_AGENT_TYPE, result.attributes)
1103+
self.assertNotIn(AWS_SERVICE_TYPE, result.attributes)
11041104

11051105
@patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.is_agent_observability_enabled")
11061106
@patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.get_service_attribute")
@@ -1114,9 +1114,9 @@ def test_customize_resource_with_agent_observability_default(
11141114
resource = Resource.create({ResourceAttributes.SERVICE_NAME: "test-service"})
11151115
result = _customize_resource(resource)
11161116

1117-
# Should have both AWS_LOCAL_SERVICE and AWS_AI_AGENT_TYPE with default value
1117+
# Should have both AWS_LOCAL_SERVICE and AWS_SERVICE_TYPE with default value
11181118
self.assertEqual(result.attributes[AWS_LOCAL_SERVICE], "test-service")
1119-
self.assertEqual(result.attributes[AWS_AI_AGENT_TYPE], "default")
1119+
self.assertEqual(result.attributes[AWS_SERVICE_TYPE], "gen_ai_agent")
11201120

11211121
@patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.is_agent_observability_enabled")
11221122
@patch("amazon.opentelemetry.distro.aws_opentelemetry_configurator.get_service_attribute")
@@ -1127,13 +1127,13 @@ def test_customize_resource_with_existing_agent_type(self, mock_get_service_attr
11271127

11281128
# Create resource with existing agent type
11291129
resource = Resource.create(
1130-
{ResourceAttributes.SERVICE_NAME: "test-service", AWS_AI_AGENT_TYPE: "existing-agent"}
1130+
{ResourceAttributes.SERVICE_NAME: "test-service", AWS_SERVICE_TYPE: "existing-agent"}
11311131
)
11321132
result = _customize_resource(resource)
11331133

11341134
# Should preserve existing agent type and not override it
11351135
self.assertEqual(result.attributes[AWS_LOCAL_SERVICE], "test-service")
1136-
self.assertEqual(result.attributes[AWS_AI_AGENT_TYPE], "existing-agent")
1136+
self.assertEqual(result.attributes[AWS_SERVICE_TYPE], "existing-agent")
11371137

11381138

11391139
def validate_distro_environ():

0 commit comments

Comments
 (0)