generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 15
Add Bedrock, Bedrock Agent, Bedrock Runtime, and Bedrock Agent Runtime support #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or 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
jj22ee
reviewed
Sep 23, 2024
aws-distro-opentelemetry-node-autoinstrumentation/src/aws-metric-attribute-generator.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/test/patches/aws/services/bedrock.test.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/test/patches/aws/services/bedrock.test.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/test/patches/instrumentation-patch.test.ts
Show resolved
Hide resolved
jj22ee
reviewed
Sep 24, 2024
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/test/patches/instrumentation-patch.test.ts
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Outdated
Show resolved
Hide resolved
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/bedrock.ts
Outdated
Show resolved
Hide resolved
jj22ee
approved these changes
Sep 24, 2024
Contributor
jj22ee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
pxaws
approved these changes
Sep 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
As part of our next release, we would like to support Bedrock, Bedrock Agent, Bedrock Runtime, and Bedrock Agent Runtime attributes in our span attributes. As such, we need to add a patch to our implementation to support these services as
ServiceExtensions. This PR addsServiceExtensionsfor all the listed services and provides unit tests to ensure they are functioning appropriately, as well as manual test evidence showing the attributes appear as expected.This PR is based heavily on this one made in our aws-observability/aws-otel-python-instrumentation repo.
Description of Changes
General
devDependenciesfor unit testing.npm installto generate a newpackage-lock.jsonfile. This removed many references tolicenses; unsure if this is intended. Will follow up offline with those who might know why this happened.Bedrock
guardrailIdfrom API response, and add intoaws.bedrock.guardrail.idspan attribute.Bedrock Agent
agentIdfrom both API request and response, and add intoaws.bedrock.agent.idspan attribute.knowledgeBaseIdfrom API request, and add intoaws.bedrock.knowledge_base.id"span attribute.dataSourceIdfrom both API request and response,, and add intoaws.bedrock.data_source.idspan attribute.Bedrock Agent Runtime
agentIdfrom API request, and add intoaws.bedrock.agent.idspan attribute.knowledgeBaseIdfrom API request, and add intoaws.bedrock.knowledgebase.idspan attribute.According to the Python PR, there should only be one of these attributes available for each possible API call.
Bedrock Runtime
Populate
RemoteResourceTypeandRemoteResourceIdentifierThe
RemoteResourceTypeandRemoteResourceIdentifierattributes are populated as follows:Testing
For this PR, I modified our NodeJS sample application in our Application Signals test framework to add APIs that result in the following traces and metrics for each of the listed use cases.
Traces
Bedrock Agent with Agent ID present (using

ListAgentVersions):Bedrock Agent with Knowledge Base ID present (using

GetKnowledgeBase):Bedrock Agent with Data Source ID present (using

GetDataSource):Bedrock Agent Runtime with Knowledge Base ID present (using

Retrieve):Bedrock with Guardrail ID present (using

GetGuardrail):Bedrock Runtime with Gen AI attributes present (using

InvokeModel):Metrics
Bedrock Agent with Agent ID present (using

ListAgentVersions):Bedrock Agent with Knowledge Base ID present (using

GetKnowledgeBase):Bedrock Agent with Data Source ID present (using

GetDataSource):Bedrock Agent Runtime with Knowledge Base ID present (using

Retrieve):Bedrock with Guardrail ID present (using

GetGuardrail):Bedrock Runtime with Gen AI attributes present (using

InvokeModel):By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.