Skip to content

Commit 264493e

Browse files
yiyuan-hemxiamxia
andauthored
update gen_ai.system attribute key (#302)
*Description of changes:* Updating `gen_ai.system` attribute key to better align with upstream Otel conventions. Context: open-telemetry/semantic-conventions#1574 (comment) *Test plan:* Ran updated unit tests and contract tests. <img width="2560" alt="Screenshot 2024-12-16 at 10 42 28 AM" src="https://github.com/user-attachments/assets/b0886292-5a99-4e90-87b0-4ee009a3553e" /> <img width="2560" alt="Screenshot 2024-12-16 at 10 58 38 AM" src="https://github.com/user-attachments/assets/4dab00d0-9141-43f5-980d-fdcd6924d69f" /> 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: Min Xia <[email protected]>
1 parent 913203f commit 264493e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
_GUARDRAIL_ID: str = "guardrailId"
4242
_GUARDRAIL_ARN: str = "guardrailArn"
4343
_MODEL_ID: str = "modelId"
44-
_AWS_BEDROCK_SYSTEM: str = "aws_bedrock"
44+
_AWS_BEDROCK_SYSTEM: str = "aws.bedrock"
4545

4646
_logger = logging.getLogger(__name__)
4747
# Set logger level to DEBUG

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
_BEDROCK_DATASOURCE_ID: str = "DataSourceId"
2929
_BEDROCK_GUARDRAIL_ID: str = "GuardrailId"
3030
_BEDROCK_KNOWLEDGEBASE_ID: str = "KnowledgeBaseId"
31-
_GEN_AI_SYSTEM: str = "aws_bedrock"
31+
_GEN_AI_SYSTEM: str = "aws.bedrock"
3232
_GEN_AI_REQUEST_MODEL: str = "genAiReuqestModelId"
3333
_SECRET_ARN: str = "arn:aws:secretsmanager:us-west-2:000000000000:secret:testSecret-ABCDEF"
3434
_TOPIC_ARN: str = "topicArn"

contract-tests/tests/test/amazon/botocore/botocore_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
_GEN_AI_RESPONSE_FINISH_REASONS: str = "gen_ai.response.finish_reasons"
4444
_GEN_AI_USAGE_INPUT_TOKENS: str = "gen_ai.usage.input_tokens"
4545
_GEN_AI_USAGE_OUTPUT_TOKENS: str = "gen_ai.usage.output_tokens"
46+
_GEN_AI_SYSTEM: str = "gen_ai.system"
4647

4748
_AWS_SECRET_ARN: str = "aws.secretsmanager.secret.arn"
4849
_AWS_STATE_MACHINE_ARN: str = "aws.stepfunctions.state_machine.arn"
@@ -428,6 +429,7 @@ def test_bedrock_runtime_invoke_model_amazon_titan(self):
428429
cloudformation_primary_identifier="amazon.titan-text-premier-v1:0",
429430
request_specific_attributes={
430431
_GEN_AI_REQUEST_MODEL: "amazon.titan-text-premier-v1:0",
432+
_GEN_AI_SYSTEM: "aws.bedrock",
431433
_GEN_AI_REQUEST_MAX_TOKENS: 3072,
432434
_GEN_AI_REQUEST_TEMPERATURE: 0.7,
433435
_GEN_AI_REQUEST_TOP_P: 0.9,
@@ -455,6 +457,7 @@ def test_bedrock_runtime_invoke_model_anthropic_claude(self):
455457
cloudformation_primary_identifier="anthropic.claude-v2:1",
456458
request_specific_attributes={
457459
_GEN_AI_REQUEST_MODEL: "anthropic.claude-v2:1",
460+
_GEN_AI_SYSTEM: "aws.bedrock",
458461
_GEN_AI_REQUEST_MAX_TOKENS: 1000,
459462
_GEN_AI_REQUEST_TEMPERATURE: 0.99,
460463
_GEN_AI_REQUEST_TOP_P: 1,
@@ -482,6 +485,7 @@ def test_bedrock_runtime_invoke_model_meta_llama(self):
482485
cloudformation_primary_identifier="meta.llama2-13b-chat-v1",
483486
request_specific_attributes={
484487
_GEN_AI_REQUEST_MODEL: "meta.llama2-13b-chat-v1",
488+
_GEN_AI_SYSTEM: "aws.bedrock",
485489
_GEN_AI_REQUEST_MAX_TOKENS: 512,
486490
_GEN_AI_REQUEST_TEMPERATURE: 0.5,
487491
_GEN_AI_REQUEST_TOP_P: 0.9,
@@ -509,6 +513,7 @@ def test_bedrock_runtime_invoke_model_cohere_command(self):
509513
cloudformation_primary_identifier="cohere.command-r-v1:0",
510514
request_specific_attributes={
511515
_GEN_AI_REQUEST_MODEL: "cohere.command-r-v1:0",
516+
_GEN_AI_SYSTEM: "aws.bedrock",
512517
_GEN_AI_REQUEST_MAX_TOKENS: 512,
513518
_GEN_AI_REQUEST_TEMPERATURE: 0.5,
514519
_GEN_AI_REQUEST_TOP_P: 0.65,
@@ -538,6 +543,7 @@ def test_bedrock_runtime_invoke_model_ai21_jamba(self):
538543
cloudformation_primary_identifier="ai21.jamba-1-5-large-v1:0",
539544
request_specific_attributes={
540545
_GEN_AI_REQUEST_MODEL: "ai21.jamba-1-5-large-v1:0",
546+
_GEN_AI_SYSTEM: "aws.bedrock",
541547
_GEN_AI_REQUEST_MAX_TOKENS: 512,
542548
_GEN_AI_REQUEST_TEMPERATURE: 0.6,
543549
_GEN_AI_REQUEST_TOP_P: 0.8,
@@ -565,6 +571,7 @@ def test_bedrock_runtime_invoke_model_mistral(self):
565571
cloudformation_primary_identifier="mistral.mistral-7b-instruct-v0:2",
566572
request_specific_attributes={
567573
_GEN_AI_REQUEST_MODEL: "mistral.mistral-7b-instruct-v0:2",
574+
_GEN_AI_SYSTEM: "aws.bedrock",
568575
_GEN_AI_REQUEST_MAX_TOKENS: 4096,
569576
_GEN_AI_REQUEST_TEMPERATURE: 0.75,
570577
_GEN_AI_REQUEST_TOP_P: 0.99,

0 commit comments

Comments
 (0)