Skip to content

Commit c7d0c49

Browse files
committed
Refine keys name.
1 parent a9ab2d8 commit c7d0c49

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
@@ -57,10 +57,10 @@ private AwsAttributeKeys() {}
5757
static final AttributeKey<String> AWS_STREAM_NAME = AttributeKey.stringKey("aws.stream.name");
5858
static final AttributeKey<String> AWS_TABLE_NAME = AttributeKey.stringKey("aws.table.name");
5959
static final AttributeKey<String> AWS_AGENT_ID = AttributeKey.stringKey("aws.bedrock.agent.id");
60-
static final AttributeKey<String> AWS_KNOWLEDGEBASE_ID =
61-
AttributeKey.stringKey("aws.bedrock.knowledgebase.id");
62-
static final AttributeKey<String> AWS_DATASOURCE_ID =
63-
AttributeKey.stringKey("aws.bedrock.datasource.id");
60+
static final AttributeKey<String> AWS_KNOWLEDGE_BASE_ID =
61+
AttributeKey.stringKey("aws.bedrock.knowledge_base.id");
62+
static final AttributeKey<String> AWS_DATA_SOURCE_ID =
63+
AttributeKey.stringKey("aws.bedrock.data_source.id");
6464
static final AttributeKey<String> AWS_GUARDRAIL_ID =
6565
AttributeKey.stringKey("aws.bedrock.guardrail.id");
6666
}

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
@@ -42,9 +42,9 @@
4242
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_PORT;
4343
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AGENT_ID;
4444
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BUCKET_NAME;
45-
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATASOURCE_ID;
45+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATA_SOURCE_ID;
4646
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_GUARDRAIL_ID;
47-
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGEBASE_ID;
47+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGE_BASE_ID;
4848
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_OPERATION;
4949
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_SERVICE;
5050
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_QUEUE_NAME;
@@ -428,14 +428,14 @@ private static void setRemoteResourceTypeAndIdentifier(SpanData span, Attributes
428428
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::Agent");
429429
remoteResourceIdentifier =
430430
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_AGENT_ID)));
431-
} else if (isKeyPresent(span, AWS_KNOWLEDGEBASE_ID)) {
431+
} else if (isKeyPresent(span, AWS_KNOWLEDGE_BASE_ID)) {
432432
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::KnowledgeBase");
433433
remoteResourceIdentifier =
434-
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_KNOWLEDGEBASE_ID)));
435-
} else if (isKeyPresent(span, AWS_DATASOURCE_ID)) {
434+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_KNOWLEDGE_BASE_ID)));
435+
} else if (isKeyPresent(span, AWS_DATA_SOURCE_ID)) {
436436
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::DataSource");
437437
remoteResourceIdentifier =
438-
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_DATASOURCE_ID)));
438+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_DATA_SOURCE_ID)));
439439
} else if (isKeyPresent(span, AWS_GUARDRAIL_ID)) {
440440
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::Guardrail");
441441
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;
@@ -716,25 +716,25 @@ public void testSdkClientSpanWithRemoteResourceAttributes() {
716716
mockAttribute(AWS_AGENT_ID, null);
717717

718718
// Validate behaviour of AWS_KNOWLEDGEBASE_ID attribute, then remove it.
719-
mockAttribute(AWS_KNOWLEDGEBASE_ID, "test_knowledgeBase_id");
719+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, "test_knowledgeBase_id");
720720
validateRemoteResourceAttributes("AWS::Bedrock::KnowledgeBase", "test_knowledgeBase_id");
721-
mockAttribute(AWS_KNOWLEDGEBASE_ID, null);
721+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, null);
722722

723723
// Validate behaviour of AWS_KNOWLEDGEBASE_ID attribute with special chars(^), then remove it.
724-
mockAttribute(AWS_KNOWLEDGEBASE_ID, "test_knowledgeBase_^id");
724+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, "test_knowledgeBase_^id");
725725
validateRemoteResourceAttributes("AWS::Bedrock::KnowledgeBase", "test_knowledgeBase_^^id");
726-
mockAttribute(AWS_KNOWLEDGEBASE_ID, null);
726+
mockAttribute(AWS_KNOWLEDGE_BASE_ID, null);
727727

728728
// Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute, then remove it.
729-
mockAttribute(AWS_DATASOURCE_ID, "test_datasource_id");
729+
mockAttribute(AWS_DATA_SOURCE_ID, "test_datasource_id");
730730
validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_id");
731-
mockAttribute(AWS_DATASOURCE_ID, null);
731+
mockAttribute(AWS_DATA_SOURCE_ID, null);
732732

733733
// Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute with special chars(^), then remove
734734
// it.
735-
mockAttribute(AWS_DATASOURCE_ID, "test_datasource_^id");
735+
mockAttribute(AWS_DATA_SOURCE_ID, "test_datasource_^id");
736736
validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_^^id");
737-
mockAttribute(AWS_DATASOURCE_ID, null);
737+
mockAttribute(AWS_DATA_SOURCE_ID, null);
738738

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

0 commit comments

Comments
 (0)