|
22 | 22 | import static org.mockito.Mockito.mock;
|
23 | 23 | import static org.mockito.Mockito.when;
|
24 | 24 | import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AGENT_ID;
|
25 |
| -import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BEDROCK_RUNTIME_MODEL_ID; |
26 | 25 | import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BUCKET_NAME;
|
27 | 26 | import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATASOURCE_ID;
|
28 | 27 | import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_GUARDRAIL_ID;
|
|
40 | 39 | import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_TABLE_NAME;
|
41 | 40 | import static software.amazon.opentelemetry.javaagent.providers.MetricAttributeGenerator.DEPENDENCY_METRIC;
|
42 | 41 | import static software.amazon.opentelemetry.javaagent.providers.MetricAttributeGenerator.SERVICE_METRIC;
|
| 42 | +import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.GEN_AI_REQUEST_MODEL; |
43 | 43 |
|
44 | 44 | import io.opentelemetry.api.common.AttributeKey;
|
45 | 45 | import io.opentelemetry.api.common.Attributes;
|
@@ -710,25 +710,51 @@ public void testSdkClientSpanWithRemoteResourceAttributes() {
|
710 | 710 | validateRemoteResourceAttributes("AWS::Bedrock::Agent", "test_agent_id");
|
711 | 711 | mockAttribute(AWS_AGENT_ID, null);
|
712 | 712 |
|
| 713 | + // Validate behaviour of AWS_BEDROCK_AGENT_ID attribute with special chars(^), then remove it. |
| 714 | + mockAttribute(AWS_AGENT_ID, "test_agent_^id"); |
| 715 | + validateRemoteResourceAttributes("AWS::Bedrock::Agent", "test_agent_^^id"); |
| 716 | + mockAttribute(AWS_AGENT_ID, null); |
| 717 | + |
713 | 718 | // Validate behaviour of AWS_KNOWLEDGEBASE_ID attribute, then remove it.
|
714 | 719 | mockAttribute(AWS_KNOWLEDGEBASE_ID, "test_knowledgeBase_id");
|
715 | 720 | validateRemoteResourceAttributes("AWS::Bedrock::KnowledgeBase", "test_knowledgeBase_id");
|
716 | 721 | mockAttribute(AWS_KNOWLEDGEBASE_ID, null);
|
717 | 722 |
|
| 723 | + // Validate behaviour of AWS_KNOWLEDGEBASE_ID attribute with special chars(^), then remove it. |
| 724 | + mockAttribute(AWS_KNOWLEDGEBASE_ID, "test_knowledgeBase_^id"); |
| 725 | + validateRemoteResourceAttributes("AWS::Bedrock::KnowledgeBase", "test_knowledgeBase_^^id"); |
| 726 | + mockAttribute(AWS_KNOWLEDGEBASE_ID, null); |
| 727 | + |
718 | 728 | // Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute, then remove it.
|
719 | 729 | mockAttribute(AWS_DATASOURCE_ID, "test_datasource_id");
|
720 | 730 | validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_id");
|
721 | 731 | mockAttribute(AWS_DATASOURCE_ID, null);
|
722 | 732 |
|
| 733 | + // Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute with special chars(^), then remove it. |
| 734 | + mockAttribute(AWS_DATASOURCE_ID, "test_datasource_^id"); |
| 735 | + validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_^^id"); |
| 736 | + mockAttribute(AWS_DATASOURCE_ID, null); |
| 737 | + |
723 | 738 | // Validate behaviour of AWS_GUARDRAIL_ID attribute, then remove it.
|
724 | 739 | mockAttribute(AWS_GUARDRAIL_ID, "test_guardrail_id");
|
725 | 740 | validateRemoteResourceAttributes("AWS::Bedrock::Guardrail", "test_guardrail_id");
|
726 | 741 | mockAttribute(AWS_GUARDRAIL_ID, null);
|
727 | 742 |
|
| 743 | + // Validate behaviour of AWS_GUARDRAIL_ID attribute with special chars(^), then remove it. |
| 744 | + mockAttribute(AWS_GUARDRAIL_ID, "test_guardrail_^id"); |
| 745 | + validateRemoteResourceAttributes("AWS::Bedrock::Guardrail", "test_guardrail_^^id"); |
| 746 | + mockAttribute(AWS_GUARDRAIL_ID, null); |
| 747 | + |
728 | 748 | // Validate behaviour of AWS_BEDROCK_RUNTIME_MODEL_ID attribute, then remove it.
|
729 |
| - mockAttribute(AWS_BEDROCK_RUNTIME_MODEL_ID, "test.service-id"); |
730 |
| - validateRemoteResourceAttributes("AWS::Bedrock::Model", "test.service-id"); |
731 |
| - mockAttribute(AWS_BEDROCK_RUNTIME_MODEL_ID, null); |
| 749 | + mockAttribute(GEN_AI_REQUEST_MODEL, "test.service_id"); |
| 750 | + validateRemoteResourceAttributes("AWS::Bedrock::Model", "test.service_id"); |
| 751 | + mockAttribute(GEN_AI_REQUEST_MODEL, null); |
| 752 | + mockAttribute(RPC_SYSTEM, "null"); |
| 753 | + |
| 754 | + // Validate behaviour of AWS_BEDROCK_RUNTIME_MODEL_ID attribute with special chars(^), then remove it. |
| 755 | + mockAttribute(GEN_AI_REQUEST_MODEL, "test.service_^id"); |
| 756 | + validateRemoteResourceAttributes("AWS::Bedrock::Model", "test.service_^^id"); |
| 757 | + mockAttribute(GEN_AI_REQUEST_MODEL, null); |
732 | 758 | mockAttribute(RPC_SYSTEM, "null");
|
733 | 759 | }
|
734 | 760 |
|
|
0 commit comments