|
41 | 41 | AWS_STEPFUNCTIONS_STATEMACHINE_ARN,
|
42 | 42 | )
|
43 | 43 | from amazon.opentelemetry.distro._aws_resource_attribute_configurator import get_service_attribute
|
| 44 | +from amazon.opentelemetry.distro.instrumentation.mcp.semconv import MCPSpanAttributes |
44 | 45 | from amazon.opentelemetry.distro._aws_span_processing_util import (
|
45 | 46 | LOCAL_ROOT,
|
46 | 47 | MAX_KEYWORD_LENGTH,
|
|
97 | 98 | _SERVER_SOCKET_PORT: str = SpanAttributes.SERVER_SOCKET_PORT
|
98 | 99 | _AWS_TABLE_NAMES: str = SpanAttributes.AWS_DYNAMODB_TABLE_NAMES
|
99 | 100 | _AWS_BUCKET_NAME: str = SpanAttributes.AWS_S3_BUCKET
|
| 101 | +_MCP_METHOD_NAME: str = MCPSpanAttributes.MCP_METHOD_NAME |
100 | 102 |
|
101 | 103 | # Normalized remote service names for supported AWS services
|
102 | 104 | _NORMALIZED_DYNAMO_DB_SERVICE_NAME: str = "AWS::DynamoDB"
|
@@ -263,6 +265,9 @@ def _set_remote_service_and_operation(span: ReadableSpan, attributes: BoundedAtt
|
263 | 265 | elif is_key_present(span, _GRAPHQL_OPERATION_TYPE):
|
264 | 266 | remote_service = _GRAPHQL
|
265 | 267 | remote_operation = _get_remote_operation(span, _GRAPHQL_OPERATION_TYPE)
|
| 268 | + elif is_key_present(span, _MCP_METHOD_NAME) and is_key_present(span, _RPC_SERVICE): |
| 269 | + remote_service = _normalize_remote_service_name(span, _get_remote_service(span, _RPC_SERVICE)) |
| 270 | + remote_operation = _get_remote_operation(span, _MCP_METHOD_NAME) |
266 | 271 |
|
267 | 272 | # Peer service takes priority as RemoteService over everything but AWS Remote.
|
268 | 273 | if is_key_present(span, _PEER_SERVICE) and not is_key_present(span, AWS_REMOTE_SERVICE):
|
|
0 commit comments