Skip to content

Commit 2cee702

Browse files
zzhloginthpierce
authored andcommitted
Apply spotless.
1 parent 1512995 commit 2cee702

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ private AwsAttributeKeys() {}
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");
6363
static final AttributeKey<String> AWS_KNOWLEDGEBASE_ID =
64-
AttributeKey.stringKey("aws.bedrock.knowledgebase.id");
64+
AttributeKey.stringKey("aws.bedrock.knowledgebase.id");
6565
static final AttributeKey<String> AWS_DATASOURCE_ID =
66-
AttributeKey.stringKey("aws.bedrock.datasource.id");
66+
AttributeKey.stringKey("aws.bedrock.datasource.id");
6767
static final AttributeKey<String> AWS_GUARDRAIL_ID =
68-
AttributeKey.stringKey("aws.bedrock.guardrail.id");
68+
AttributeKey.stringKey("aws.bedrock.guardrail.id");
6969
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_PORT;
4242
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_ADDRESS;
4343
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_PORT;
44-
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BUCKET_NAME;
4544
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AGENT_ID;
45+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BUCKET_NAME;
4646
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATASOURCE_ID;
4747
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_GUARDRAIL_ID;
4848
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGEBASE_ID;
@@ -58,13 +58,13 @@
5858
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SPAN_KIND;
5959
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STREAM_NAME;
6060
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_TABLE_NAME;
61+
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.GEN_AI_REQUEST_MODEL;
6162
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.MAX_KEYWORD_LENGTH;
6263
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.SQL_DIALECT_PATTERN;
6364
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.UNKNOWN_OPERATION;
6465
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.UNKNOWN_REMOTE_OPERATION;
6566
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.UNKNOWN_REMOTE_SERVICE;
6667
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.UNKNOWN_SERVICE;
67-
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.GEN_AI_REQUEST_MODEL;
6868
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.isAwsSDKSpan;
6969
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.isDBSpan;
7070
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.isKeyPresent;
@@ -370,14 +370,16 @@ private static String normalizeRemoteServiceName(SpanData span, String serviceNa
370370
case "AmazonSQS": // AWS SDK v1
371371
case "Sqs": // AWS SDK v2
372372
return NORMALIZED_SQS_SERVICE_NAME;
373-
// For Bedrock, Bedrock Agent, and Bedrock Agent Runtime, we can align with AWS Cloud Control and use AWS::Bedrock for RemoteService.
373+
// For Bedrock, Bedrock Agent, and Bedrock Agent Runtime, we can align with AWS Cloud
374+
// Control and use AWS::Bedrock for RemoteService.
374375
case "Bedrock": // AWS SDK v2 & v1
375376
case "AWSBedrockAgentRuntime": // AWS SDK v1
376377
case "BedrockAgentRuntime": // AWS SDK v2
377378
case "AWSBedrockAgent": // AWS SDK v1
378379
case "BedrockAgent": // AWS SDK v2
379380
return NORMALIZED_BEDROCK_SERVICE_NAME;
380-
// For BedrockRuntime, we are using AWS::BedrockRuntime as the associated remote resource (Model) is not listed in Cloud Control.
381+
// For BedrockRuntime, we are using AWS::BedrockRuntime as the associated remote resource
382+
// (Model) is not listed in Cloud Control.
381383
case "AmazonBedrockRuntime": // AWS SDK v1
382384
case "BedrockRuntime": // AWS SDK v2
383385
return NORMALIZED_BEDROCK_RUNTIME_SERVICE_NAME;
@@ -443,8 +445,7 @@ private static void setRemoteResourceTypeAndIdentifier(SpanData span, Attributes
443445
} else if (isKeyPresent(span, GEN_AI_REQUEST_MODEL)) {
444446
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::Model");
445447
remoteResourceIdentifier =
446-
Optional.ofNullable(
447-
escapeDelimiters(span.getAttributes().get(GEN_AI_REQUEST_MODEL)));
448+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(GEN_AI_REQUEST_MODEL)));
448449
}
449450
} else if (isDBSpan(span)) {
450451
remoteResourceType = Optional.of(DB_CONNECTION_RESOURCE_TYPE);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ final class AwsSpanProcessingUtil {
5858
static final int MAX_KEYWORD_LENGTH = 27;
5959
// TODO: Use Semantic Conventions once upgrade once upgrade to v1.26.0
6060
static final AttributeKey<String> GEN_AI_REQUEST_MODEL =
61-
AttributeKey.stringKey("gen_ai.request.model");
61+
AttributeKey.stringKey("gen_ai.request.model");
6262
static final Pattern SQL_DIALECT_PATTERN =
6363
Pattern.compile("^(?:" + String.join("|", getDialectKeywords()) + ")\\b");
6464

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SPAN_KIND;
3939
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STREAM_NAME;
4040
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_TABLE_NAME;
41+
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.GEN_AI_REQUEST_MODEL;
4142
import static software.amazon.opentelemetry.javaagent.providers.MetricAttributeGenerator.DEPENDENCY_METRIC;
4243
import static software.amazon.opentelemetry.javaagent.providers.MetricAttributeGenerator.SERVICE_METRIC;
43-
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.GEN_AI_REQUEST_MODEL;
4444

4545
import io.opentelemetry.api.common.AttributeKey;
4646
import io.opentelemetry.api.common.Attributes;
@@ -731,7 +731,8 @@ public void testSdkClientSpanWithRemoteResourceAttributes() {
731731
validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_id");
732732
mockAttribute(AWS_DATASOURCE_ID, null);
733733

734-
// Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute with special chars(^), then remove it.
734+
// Validate behaviour of AWS_BEDROCK_DATASOURCE_ID attribute with special chars(^), then remove
735+
// it.
735736
mockAttribute(AWS_DATASOURCE_ID, "test_datasource_^id");
736737
validateRemoteResourceAttributes("AWS::Bedrock::DataSource", "test_datasource_^^id");
737738
mockAttribute(AWS_DATASOURCE_ID, null);
@@ -750,9 +751,9 @@ public void testSdkClientSpanWithRemoteResourceAttributes() {
750751
mockAttribute(GEN_AI_REQUEST_MODEL, "test.service_id");
751752
validateRemoteResourceAttributes("AWS::Bedrock::Model", "test.service_id");
752753
mockAttribute(GEN_AI_REQUEST_MODEL, null);
753-
mockAttribute(RPC_SYSTEM, "null");
754754

755-
// Validate behaviour of AWS_BEDROCK_RUNTIME_MODEL_ID attribute with special chars(^), then remove it.
755+
// Validate behaviour of AWS_BEDROCK_RUNTIME_MODEL_ID attribute with special chars(^), then
756+
// remove it.
756757
mockAttribute(GEN_AI_REQUEST_MODEL, "test.service_^id");
757758
validateRemoteResourceAttributes("AWS::Bedrock::Model", "test.service_^^id");
758759
mockAttribute(GEN_AI_REQUEST_MODEL, null);

0 commit comments

Comments
 (0)