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