Skip to content

Commit c77f967

Browse files
zzhloginthpierce
authored andcommitted
Refine keys name.
1 parent 64ed536 commit c77f967

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsAttributeKeys.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ private AwsAttributeKeys() {}
6060
static final AttributeKey<String> AWS_STREAM_NAME = AttributeKey.stringKey("aws.stream.name");
6161
static final AttributeKey<String> AWS_TABLE_NAME = AttributeKey.stringKey("aws.table.name");
6262
static final AttributeKey<String> AWS_AGENT_ID = AttributeKey.stringKey("aws.bedrock.agent.id");
63-
static final AttributeKey<String> AWS_KNOWLEDGEBASE_ID =
64-
AttributeKey.stringKey("aws.bedrock.knowledgebase.id");
65-
static final AttributeKey<String> AWS_DATASOURCE_ID =
66-
AttributeKey.stringKey("aws.bedrock.datasource.id");
63+
static final AttributeKey<String> AWS_KNOWLEDGE_BASE_ID =
64+
AttributeKey.stringKey("aws.bedrock.knowledge_base.id");
65+
static final AttributeKey<String> AWS_DATA_SOURCE_ID =
66+
AttributeKey.stringKey("aws.bedrock.data_source.id");
6767
static final AttributeKey<String> AWS_GUARDRAIL_ID =
6868
AttributeKey.stringKey("aws.bedrock.guardrail.id");
6969
}

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGenerator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_PORT;
4444
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AGENT_ID;
4545
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BUCKET_NAME;
46-
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATASOURCE_ID;
46+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATA_SOURCE_ID;
4747
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_GUARDRAIL_ID;
48-
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGEBASE_ID;
48+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGE_BASE_ID;
4949
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_OPERATION;
5050
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_SERVICE;
5151
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_QUEUE_NAME;
@@ -431,14 +431,14 @@ private static void setRemoteResourceTypeAndIdentifier(SpanData span, Attributes
431431
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::Agent");
432432
remoteResourceIdentifier =
433433
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_AGENT_ID)));
434-
} else if (isKeyPresent(span, AWS_KNOWLEDGEBASE_ID)) {
434+
} else if (isKeyPresent(span, AWS_KNOWLEDGE_BASE_ID)) {
435435
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::KnowledgeBase");
436436
remoteResourceIdentifier =
437-
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_KNOWLEDGEBASE_ID)));
438-
} else if (isKeyPresent(span, AWS_DATASOURCE_ID)) {
437+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_KNOWLEDGE_BASE_ID)));
438+
} else if (isKeyPresent(span, AWS_DATA_SOURCE_ID)) {
439439
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::DataSource");
440440
remoteResourceIdentifier =
441-
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_DATASOURCE_ID)));
441+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_DATA_SOURCE_ID)));
442442
} else if (isKeyPresent(span, AWS_GUARDRAIL_ID)) {
443443
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::Guardrail");
444444
remoteResourceIdentifier =

awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
import static org.mockito.Mockito.when;
2424
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AGENT_ID;
2525
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BUCKET_NAME;
26-
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATASOURCE_ID;
26+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATA_SOURCE_ID;
2727
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_GUARDRAIL_ID;
28-
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGEBASE_ID;
28+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGE_BASE_ID;
2929
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_OPERATION;
3030
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_SERVICE;
3131
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_QUEUE_NAME;
@@ -717,25 +717,25 @@ public void testSdkClientSpanWithRemoteResourceAttributes() {
717717
mockAttribute(AWS_AGENT_ID, null);
718718

719719
// Validate behaviour of AWS_KNOWLEDGEBASE_ID attribute, then remove it.
720-
mockAttribute(AWS_KNOWLEDGEBASE_ID, "test_knowledgeBase_id");
720+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, "test_knowledgeBase_id");
721721
validateRemoteResourceAttributes("AWS::Bedrock::KnowledgeBase", "test_knowledgeBase_id");
722-
mockAttribute(AWS_KNOWLEDGEBASE_ID, null);
722+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, null);
723723

724724
// Validate behaviour of AWS_KNOWLEDGEBASE_ID attribute with special chars(^), then remove it.
725-
mockAttribute(AWS_KNOWLEDGEBASE_ID, "test_knowledgeBase_^id");
725+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, "test_knowledgeBase_^id");
726726
validateRemoteResourceAttributes("AWS::Bedrock::KnowledgeBase", "test_knowledgeBase_^^id");
727-
mockAttribute(AWS_KNOWLEDGEBASE_ID, null);
727+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, null);
728728

729729
// Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute, then remove it.
730-
mockAttribute(AWS_DATASOURCE_ID, "test_datasource_id");
730+
mockAttribute(AWS_DATA_SOURCE_ID, "test_datasource_id");
731731
validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_id");
732-
mockAttribute(AWS_DATASOURCE_ID, null);
732+
mockAttribute(AWS_DATA_SOURCE_ID, null);
733733

734734
// Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute with special chars(^), then remove
735735
// it.
736-
mockAttribute(AWS_DATASOURCE_ID, "test_datasource_^id");
736+
mockAttribute(AWS_DATA_SOURCE_ID, "test_datasource_^id");
737737
validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_^^id");
738-
mockAttribute(AWS_DATASOURCE_ID, null);
738+
mockAttribute(AWS_DATA_SOURCE_ID, null);
739739

740740
// Validate behaviour of AWS_GUARDRAIL_ID attribute, then remove it.
741741
mockAttribute(AWS_GUARDRAIL_ID, "test_guardrail_id");

0 commit comments

Comments
 (0)