Skip to content

Commit 7d9cdae

Browse files
committed
update remote service and remote environment env var names
1 parent 9efb2d5 commit 7d9cdae

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ def _set_remote_type_and_identifier(span: ReadableSpan, attributes: BoundedAttri
454454
# call is "Invoke". Otherwise, we treat the downstream lambda as an AWS resource.
455455
if span.attributes.get(_RPC_METHOD) == "Invoke":
456456
attributes[AWS_REMOTE_SERVICE] = os.environ.get(
457-
"AWS_LAMBDA_REMOTE_SERVICE", span.attributes.get(AWS_LAMBDA_FUNCTION_NAME)
457+
"LAMBDA_APPLICATION_SIGNALS_REMOTE_SERVICE", span.attributes.get(AWS_LAMBDA_FUNCTION_NAME)
458458
)
459459
attributes[AWS_REMOTE_ENVIRONMENT] = (
460-
f"lambda:{os.environ.get('AWS_LAMBDA_REMOTE_ENVIRONMENT', 'default')}"
460+
f'lambda:{os.environ.get("LAMBDA_APPLICATION_SIGNALS_REMOTE_ENVIRONMENT", "default")}'
461461
)
462462
else:
463463
remote_resource_type = _NORMALIZED_LAMBDA_SERVICE_NAME + "::Function"

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ def test_sdk_client_span_with_remote_resource_attributes(self):
11761176
self._mock_attribute([AWS_LAMBDA_FUNCTION_NAME, SpanAttributes.RPC_METHOD], [None, None])
11771177

11781178
# Test AWS Lambda Invoke scenario with user-configured lambda remote environment
1179-
os.environ["AWS_LAMBDA_REMOTE_ENVIRONMENT"] = "test"
1179+
os.environ["LAMBDA_APPLICATION_SIGNALS_REMOTE_ENVIRONMENT"] = "test"
11801180
self.span_mock.kind = SpanKind.CLIENT
11811181
self._mock_attribute(
11821182
[AWS_LAMBDA_FUNCTION_NAME, SpanAttributes.RPC_METHOD],
@@ -1193,10 +1193,10 @@ def test_sdk_client_span_with_remote_resource_attributes(self):
11931193
self.assertNotIn(AWS_REMOTE_RESOURCE_IDENTIFIER, dependency_attributes)
11941194
self.assertNotIn(AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER, dependency_attributes)
11951195
self._mock_attribute([AWS_LAMBDA_FUNCTION_NAME, SpanAttributes.RPC_METHOD], [None, None])
1196-
os.environ.pop("AWS_LAMBDA_REMOTE_ENVIRONMENT", None)
1196+
os.environ.pop("LAMBDA_APPLICATION_SIGNALS_REMOTE_ENVIRONMENT", None)
11971197

11981198
# Test AWS Lambda Invoke scenario with user-configured lambda remote service
1199-
os.environ["AWS_LAMBDA_REMOTE_SERVICE"] = "test_downstream_lambda2"
1199+
os.environ["LAMBDA_APPLICATION_SIGNALS_REMOTE_SERVICE"] = "test_downstream_lambda2"
12001200
self.span_mock.kind = SpanKind.CLIENT
12011201
self._mock_attribute(
12021202
[AWS_LAMBDA_FUNCTION_NAME, SpanAttributes.RPC_METHOD],
@@ -1213,7 +1213,7 @@ def test_sdk_client_span_with_remote_resource_attributes(self):
12131213
self.assertNotIn(AWS_REMOTE_RESOURCE_IDENTIFIER, dependency_attributes)
12141214
self.assertNotIn(AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER, dependency_attributes)
12151215
self._mock_attribute([AWS_LAMBDA_FUNCTION_NAME, SpanAttributes.RPC_METHOD], [None, None])
1216-
os.environ.pop("AWS_LAMBDA_REMOTE_SERVICE", None)
1216+
os.environ.pop("LAMBDA_APPLICATION_SIGNALS_REMOTE_SERVICE", None)
12171217

12181218
# Test AWS Lambda non-Invoke scenario
12191219
self.span_mock.kind = SpanKind.CLIENT

0 commit comments

Comments
 (0)