Skip to content

Commit 0876084

Browse files
authored
Remove Lambda:Function:Name resource type support (#280)
*Description of changes:* Remove `RemoteResourceTargetIdentifier` attribute which will treat Lambda Function as a regular AWS resource. It may conflict with the current concept that have Lambda function defined as a service. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d723f96 commit 0876084

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
AWS_BEDROCK_KNOWLEDGE_BASE_ID,
1414
AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER,
1515
AWS_KINESIS_STREAM_NAME,
16-
AWS_LAMBDA_FUNCTION_NAME,
1716
AWS_LAMBDA_RESOURCEMAPPING_ID,
1817
AWS_LOCAL_OPERATION,
1918
AWS_LOCAL_SERVICE,
@@ -458,9 +457,6 @@ def _set_remote_type_and_identifier(span: ReadableSpan, attributes: BoundedAttri
458457
elif is_key_present(span, AWS_LAMBDA_RESOURCEMAPPING_ID):
459458
remote_resource_type = _NORMALIZED_LAMBDA_SERVICE_NAME + "::EventSourceMapping"
460459
remote_resource_identifier = _escape_delimiters(span.attributes.get(AWS_LAMBDA_RESOURCEMAPPING_ID))
461-
elif is_key_present(span, AWS_LAMBDA_FUNCTION_NAME):
462-
remote_resource_type = _NORMALIZED_LAMBDA_SERVICE_NAME + "::Function"
463-
remote_resource_identifier = _escape_delimiters(span.attributes.get(AWS_LAMBDA_FUNCTION_NAME))
464460
elif is_db_span(span):
465461
remote_resource_type = _DB_CONNECTION_STRING_TYPE
466462
remote_resource_identifier = _get_db_connection(span)

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
AWS_BEDROCK_KNOWLEDGE_BASE_ID,
1515
AWS_CONSUMER_PARENT_SPAN_KIND,
1616
AWS_KINESIS_STREAM_NAME,
17-
AWS_LAMBDA_FUNCTION_NAME,
1817
AWS_LAMBDA_RESOURCEMAPPING_ID,
1918
AWS_LOCAL_OPERATION,
2019
AWS_LOCAL_SERVICE,
@@ -1137,26 +1136,21 @@ def test_sdk_client_span_with_remote_resource_attributes(self):
11371136
self._validate_remote_resource_attributes("AWS::StepFunctions::Activity", "testActivity")
11381137
self._mock_attribute([AWS_STEPFUNCTIONS_ACTIVITY_ARN], [None])
11391138

1140-
# Validate behaviour of AWS_LAMBDA_FUNCTION_NAME attribute, then remove it.
1141-
self._mock_attribute([AWS_LAMBDA_FUNCTION_NAME], ["aws_lambda_function_name"], keys, values)
1142-
self._validate_remote_resource_attributes("AWS::Lambda::Function", "aws_lambda_function_name")
1143-
self._mock_attribute([AWS_LAMBDA_FUNCTION_NAME], [None])
1144-
11451139
# Validate behaviour of AWS_LAMBDA_RESOURCEMAPPING_ID attribute, then remove it.
11461140
self._mock_attribute([AWS_LAMBDA_RESOURCEMAPPING_ID], ["aws_event_source_mapping_id"], keys, values)
11471141
self._validate_remote_resource_attributes("AWS::Lambda::EventSourceMapping", "aws_event_source_mapping_id")
11481142
self._mock_attribute([AWS_LAMBDA_RESOURCEMAPPING_ID], [None])
11491143

1150-
# Validate behaviour of both AWS_LAMBDA_FUNCTION_NAME and AWS_LAMBDA_RESOURCE_MAPPING_ID,
1144+
# Validate behaviour of AWS_LAMBDA_RESOURCE_MAPPING_ID,
11511145
# then remove it.
11521146
self._mock_attribute(
1153-
[AWS_LAMBDA_FUNCTION_NAME, AWS_LAMBDA_RESOURCEMAPPING_ID],
1154-
["aws_lambda_function_name", "aws_event_source_mapping_id"],
1147+
[AWS_LAMBDA_RESOURCEMAPPING_ID],
1148+
["aws_event_source_mapping_id"],
11551149
keys,
11561150
values,
11571151
)
11581152
self._validate_remote_resource_attributes("AWS::Lambda::EventSourceMapping", "aws_event_source_mapping_id")
1159-
self._mock_attribute([AWS_LAMBDA_FUNCTION_NAME, AWS_LAMBDA_RESOURCEMAPPING_ID], [None, None])
1153+
self._mock_attribute([AWS_LAMBDA_RESOURCEMAPPING_ID], [None])
11601154

11611155
self._mock_attribute([SpanAttributes.RPC_SYSTEM], [None])
11621156

0 commit comments

Comments
 (0)