-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support bedrock and bedrock runtime resources Java SDK V2(open-teleme…
…try#5) This PR add AWS Bedrock and BedrockRuntime support for AWS Java SDK V2 with the following change: A. **Bedrock**: Extract `guardrailId` from API response, and add into `"aws.bedrock.guardrail.id"` span attribute. B. **Bedrock Agent**: Extract `agentId` from both API request and response, and add into `"aws.bedrock.agent.id"` span attribute. Extract `knowledgeBaseId` from API request, and add into `"aws.bedrock.knowledgebase.id"` span attribute. Extract `dataSourceId` from both API request and response,, and add into `"aws.bedrock.datasource.id"` span attribute. The instrumentation is on API operation level, we make sure only one attribute is extracted per API call, there will be no overlap/conflict to identify the resouce. C. **Bedrock Agent Runtime**: Extract `agentId` from API request, and add into `"aws.bedrock.agent.id"` span attribute. Extract `knowledgeBaseId` from API request, and add into `"aws.bedrock.knowledgebase.id"` span attribute. D. **Bedrock Runtime**: Extract the following attributes and add into span according to [ Gen AI semantic-conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/gen-ai.md): ``` gen_ai.request.model gen_ai.system ```
- Loading branch information
Showing
5 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsExperimentalAttributes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.awssdk.v2_2; | ||
|
||
import static io.opentelemetry.api.common.AttributeKey.stringKey; | ||
|
||
import io.opentelemetry.api.common.AttributeKey; | ||
|
||
final class AwsExperimentalAttributes { | ||
static final AttributeKey<String> AWS_BUCKET_NAME = stringKey("aws.bucket.name"); | ||
static final AttributeKey<String> AWS_QUEUE_URL = stringKey("aws.queue.url"); | ||
static final AttributeKey<String> AWS_QUEUE_NAME = stringKey("aws.queue.name"); | ||
static final AttributeKey<String> AWS_STREAM_NAME = stringKey("aws.stream.name"); | ||
static final AttributeKey<String> AWS_TABLE_NAME = stringKey("aws.table.name"); | ||
static final AttributeKey<String> AWS_BEDROCK_GUARDRAIL_ID = | ||
stringKey("aws.bedrock.guardrail.id"); | ||
static final AttributeKey<String> AWS_BEDROCK_AGENT_ID = stringKey("aws.bedrock.agent.id"); | ||
static final AttributeKey<String> AWS_BEDROCK_DATASOURCE_ID = | ||
stringKey("aws.bedrock.data_source.id"); | ||
static final AttributeKey<String> AWS_BEDROCK_KNOWLEDGEBASE_ID = | ||
stringKey("aws.bedrock.knowledge_base.id"); | ||
|
||
// TODO: Merge in gen_ai attributes in opentelemetry-semconv-incubating once upgrade to v1.26.0 | ||
static final AttributeKey<String> GEN_AI_MODEL = stringKey("gen_ai.request.model"); | ||
static final AttributeKey<String> GEN_AI_SYSTEM = stringKey("gen_ai.system"); | ||
|
||
private AwsExperimentalAttributes() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters