Skip to content

Commit 82bd892

Browse files
author
ADOT Patch workflow
committed
move gen ai constants to avoid botocore dependency
1 parent dc491e9 commit 82bd892

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
SERVICE_METRIC,
7272
MetricAttributeGenerator,
7373
)
74-
from amazon.opentelemetry.distro.patches._bedrock_agentcore_patches import (
74+
from amazon.opentelemetry.distro.patches.semconv._incubating.attributes.gen_ai_attributes import (
7575
GEN_AI_BROWSER_ID,
7676
GEN_AI_CODE_INTERPRETER_ID,
7777
GEN_AI_GATEWAY_ID,

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/patches/_bedrock_agentcore_patches.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
AWS_BEDROCK_AGENTCORE_WORKLOAD_IDENTITY_ARN,
1414
AWS_GATEWAY_TARGET_ID,
1515
)
16+
from amazon.opentelemetry.distro.patches.semconv._incubating.attributes.gen_ai_attributes import (
17+
GEN_AI_BROWSER_ID,
18+
GEN_AI_CODE_INTERPRETER_ID,
19+
GEN_AI_GATEWAY_ID,
20+
GEN_AI_MEMORY_ID,
21+
GEN_AI_RUNTIME_ID,
22+
)
1623
from opentelemetry.instrumentation.botocore.extensions.types import (
1724
_AttributeMapT,
1825
_AwsSdkExtension,
@@ -21,12 +28,6 @@
2128
)
2229
from opentelemetry.trace.span import Span
2330

24-
GEN_AI_RUNTIME_ID = "gen_ai.runtime.id"
25-
GEN_AI_BROWSER_ID = "gen_ai.browser.id"
26-
GEN_AI_CODE_INTERPRETER_ID = "gen_ai.code_interpreter.id"
27-
GEN_AI_MEMORY_ID = "gen_ai.memory.id"
28-
GEN_AI_GATEWAY_ID = "gen_ai.gateway.id"
29-
3031
# Mapping of flattened JSON paths to attribute keys
3132
_ATTRIBUTE_MAPPING = {
3233
"agentRuntimeArn": AWS_BEDROCK_AGENTCORE_RUNTIME_ARN,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
Utility module holding attribute keys for incubating Gen AI semantic conventions.
3+
Remove this once we've contributed them to upstream.
4+
"""
5+
6+
GEN_AI_RUNTIME_ID = "gen_ai.runtime.id"
7+
GEN_AI_BROWSER_ID = "gen_ai.browser.id"
8+
GEN_AI_CODE_INTERPRETER_ID = "gen_ai.code_interpreter.id"
9+
GEN_AI_MEMORY_ID = "gen_ai.memory.id"
10+
GEN_AI_GATEWAY_ID = "gen_ai.gateway.id"

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/patches/test_instrumentation_patch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
AWS_BEDROCK_AGENTCORE_WORKLOAD_IDENTITY_ARN,
2222
AWS_GATEWAY_TARGET_ID,
2323
)
24-
from amazon.opentelemetry.distro.patches._bedrock_agentcore_patches import (
24+
from amazon.opentelemetry.distro.patches._instrumentation_patch import (
25+
AWS_GEVENT_PATCH_MODULES,
26+
apply_instrumentation_patches,
27+
)
28+
from amazon.opentelemetry.distro.patches.semconv._incubating.attributes.gen_ai_attributes import (
2529
GEN_AI_BROWSER_ID,
2630
GEN_AI_CODE_INTERPRETER_ID,
2731
GEN_AI_GATEWAY_ID,
2832
GEN_AI_MEMORY_ID,
2933
GEN_AI_RUNTIME_ID,
3034
)
31-
from amazon.opentelemetry.distro.patches._instrumentation_patch import (
32-
AWS_GEVENT_PATCH_MODULES,
33-
apply_instrumentation_patches,
34-
)
3535
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
3636
from opentelemetry.instrumentation.botocore.extensions import _KNOWN_EXTENSIONS, bedrock_utils
3737
from opentelemetry.propagate import get_global_textmap

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
)
5151
from amazon.opentelemetry.distro._aws_metric_attribute_generator import _AwsMetricAttributeGenerator
5252
from amazon.opentelemetry.distro.metric_attribute_generator import DEPENDENCY_METRIC, SERVICE_METRIC
53-
from amazon.opentelemetry.distro.patches._bedrock_agentcore_patches import (
53+
from amazon.opentelemetry.distro.patches.semconv._incubating.attributes.gen_ai_attributes import (
5454
GEN_AI_BROWSER_ID,
5555
GEN_AI_CODE_INTERPRETER_ID,
5656
GEN_AI_GATEWAY_ID,

0 commit comments

Comments
 (0)