Commit 7745ce0
feat: Add botocore instrumentation extension for Bedrock AgentCore services (#490)
*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.
---------
Co-authored-by: ADOT Patch workflow <[email protected]>1 parent 54acafb commit 7745ce0
File tree
5 files changed
+214
-0
lines changed- aws-opentelemetry-distro
- src/amazon/opentelemetry/distro
- patches
- tests/amazon/opentelemetry/distro/patches
5 files changed
+214
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
Lines changed: 92 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
247 | 250 | | |
248 | 251 | | |
249 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
250 | 257 | | |
251 | 258 | | |
252 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
13 | 31 | | |
14 | 32 | | |
15 | 33 | | |
| |||
38 | 56 | | |
39 | 57 | | |
40 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
41 | 77 | | |
42 | 78 | | |
43 | 79 | | |
| |||
160 | 196 | | |
161 | 197 | | |
162 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
163 | 207 | | |
164 | 208 | | |
165 | 209 | | |
| |||
237 | 281 | | |
238 | 282 | | |
239 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
240 | 319 | | |
241 | 320 | | |
242 | 321 | | |
| |||
854 | 933 | | |
855 | 934 | | |
856 | 935 | | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
857 | 961 | | |
858 | 962 | | |
859 | 963 | | |
| |||
0 commit comments