Skip to content

Conversation

liustve
Copy link
Contributor

@liustve liustve commented Oct 10, 2025

Description of changes:

Patches botocore instrumentor to add span attributes for Bedrock AgentCore control and data plane calls.

  • Added _BedrockAgentCoreExtension to extract telemetry attributes from API parameters
  • Registered extensions for bedrock-agentcore (data plane) and bedrock-agentcore-control (control plane)
  • Added attribute constants for runtime, browser, code interpreter, gateway, memory, and identity resources

New semantic conventions based off this PR:
open-telemetry/semantic-conventions#2886

Manually tested verified span attributes examples:

{
    "name": "Bedrock AgentCore.InvokeAgentRuntime",
    "context": {
        "trace_id": "0x68e9815d69c6335ba2be2c3a0dc9460d",
        "span_id": "0x7b65fdc962dfe773",
        "trace_state": "[]"
    },
    "kind": "SpanKind.CLIENT",
    "parent_id": null,
    "start_time": "2025-10-10T21:57:49.492869Z",
    "end_time": "2025-10-10T21:57:50.070664Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "rpc.system": "aws-api",
        "rpc.service": "Bedrock AgentCore",
        "rpc.method": "InvokeAgentRuntime",
        "aws.region": "us-east-1",
        "server.address": "bedrock-agentcore.us-east-1.amazonaws.com",
        "server.port": 443,
        "aws.auth.region": "us-east-1",
        "aws.auth.account.access_key": "",
        "aws.bedrock.agentcore.runtime.arn": "arn:aws:bedrock-agentcore:us-east-1:571600841604:runtime/completeAgent-w8slyU6q5M",
        "aws.request_id": "a4483186-85ba-4879-b83e-99562da78376",
        "retry_attempts": 0,
        "http.status_code": 200
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.33.1",
            "service.name": "unknown_service",
            "telemetry.auto.version": "0.12.1.dev0-aws",
            "aws.local.service": "UnknownService"
        },
        "schema_url": ""
    }
}

{
    "name": "Bedrock AgentCore.InvokeCodeInterpreter",
    "context": {
        "trace_id": "0x68e98228e901936ec8fe3d76839e3da3",
        "span_id": "0x1751acb67a5b3073",
        "trace_state": "[]"
    },
    "kind": "SpanKind.CLIENT",
    "parent_id": null,
    "start_time": "2025-10-10T22:01:12.522286Z",
    "end_time": "2025-10-10T22:01:12.691952Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "rpc.system": "aws-api",
        "rpc.service": "Bedrock AgentCore",
        "rpc.method": "InvokeCodeInterpreter",
        "aws.region": "us-east-1",
        "server.address": "bedrock-agentcore.us-east-1.amazonaws.com",
        "server.port": 443,
        "aws.auth.region": "us-east-1",
        "gen_ai.code_interpreter.id": "agentCodeInterpreter-m9Mvuwkg6j",
        "aws.request_id": "b9fd2327-edc4-413d-89d7-715ae836ec64",
        "retry_attempts": 0,
        "http.status_code": 200
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.33.1",
            "service.name": "unknown_service",
            "telemetry.auto.version": "0.12.1.dev0-aws",
            "aws.local.service": "UnknownService"
        },
        "schema_url": ""
    }
}

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 10, 2025 22:43
@liustve liustve merged commit 7745ce0 into main Oct 16, 2025
16 checks passed
@liustve liustve deleted the bedrock-agentcore-resource-support branch October 16, 2025 01:16
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.

3 participants