Skip to content

Conversation

liustve
Copy link
Contributor

@liustve liustve commented Oct 16, 2025

Description of changes:
Follow up to: #490

  1. Normalizes AWS::Bedrock AgentCore and AWS::Bedrock AgentCore Control from botocore instrumentation to AWS::BedrockAgentCore

  2. Add Resource and CFN attributes for Bedrock AgentCore support as following:

    a. Runtime: Extract agentRuntimeId or parse from agentRuntimeArn and add into aws.remote.resource.identifier span attribute.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::Runtime.

    b. Runtime Endpoint: Extract endpoint ID from agentRuntimeEndpointArn and add into aws.remote.resource.identifier span attribute, but use full ARN as aws.cloudformation.primary.identifier.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::RuntimeEndpoint.

    c. Browser: Extract browserIdentifier or parse from browserArn, and add into aws.remote.resource.identifier span attribute.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::Browser (for aws.browser.v1) or AWS::BedrockAgentCore::BrowserCustom (for custom browsers).

    d. Gateway: Extract gatewayId or parse from gatewayArn, and add into aws.remote.resource.identifier span attribute.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::Gateway.

    e. Gateway Target: Extract targetId from span attributes and add into aws.remote.resource.identifier span attribute.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::GatewayTarget. Takes priority over Gateway when present.

    f. Code Interpreter: Extract codeInterpreterIdentifier or parse from codeInterpreterArn, and add into aws.remote.resource.identifier span attribute.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::CodeInterpreter (for aws.codeinterpreter.v1) or AWS::BedrockAgentCore::CodeInterpreterCustom (for custom interpreters).

    g. Memory: Extract memoryId or parse from memoryArn and add into aws.remote.resource.identifier span attribute, but use full ARN as aws.cloudformation.primary.identifier when available.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::Memory.

    h. Identity: Extract provider ID from credential provider ARNs for OAuth2 and API Key credential providers and add into aws.remote.resource.identifier span attribute.
    Set aws.remote.resource.type to AWS::BedrockAgentCore::OAuth2CredentialProvider or AWS::BedrockAgentCore::APIKeyCredentialProvider.

Testing

  1. Contract tests added to validate E2E behavior of new Application Signals attributes.
  2. Unit tests added to validate logic flow is as expected.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@liustve liustve requested a review from a team as a code owner October 16, 2025 01:17
@liustve liustve changed the title [WIP]feat: Add Application Signals Attributes for Bedrock AgentCore spans feat: Add Application Signals Attributes for Bedrock AgentCore spans Oct 16, 2025
@liustve liustve changed the title feat: Add Application Signals Attributes for Bedrock AgentCore spans feat: Add Resource Attributes for Bedrock AgentCore spans Oct 16, 2025
@liustve liustve changed the title feat: Add Resource Attributes for Bedrock AgentCore spans feat: Add Resource and CFN Attributes for Bedrock AgentCore spans Oct 16, 2025
Comment on lines 737 to 740
if browser_arn:
resource_identifier = extract_bedrock_agentcore_resource_id_from_arn(str(browser_arn))
if browser_id:
resource_identifier = str(browser_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you always need to check on two if browser_id value exists?

Suggested change
if browser_arn:
resource_identifier = extract_bedrock_agentcore_resource_id_from_arn(str(browser_arn))
if browser_id:
resource_identifier = str(browser_id)
if browser_id:
resource_identifier = str(browser_id)
elif browser_arn:
resource_identifier = extract_bedrock_agentcore_resource_id_from_arn(str(browser_arn))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or this resource_identifier = str(browser_id) should be agentcore_cfn_id = str(browser_id)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack. That makes sense.

resource_identifier = extract_bedrock_agentcore_resource_id_from_arn(str(gateway_arn))
if gateway_id:
resource_identifier = str(gateway_id)
return "Gateway", resource_identifier, resource_identifier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. why you return the resource_identifier value for both Remote Resource Identifier and CFN_Identifier. Seems not correct

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Primary identifier for Gateway is the id:

"primaryIdentifier": [ "/properties/GatewayIdentifier" ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants