generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: [.NET and JS Feature Parity] Support for new AWS Resources in JS SDK #121
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
mxiamxia
merged 55 commits into
aws-observability:main
from
liustve:aws_resource_support
Dec 16, 2024
Merged
Changes from 13 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
7e70a46
Merge pull request #1 from aws-observability/main
liustve f168ced
initial start for sns and secretsmanager
liustve 85747f2
secretsmanager attributes added
liustve 7ab675f
added step functions and lambda
liustve d684596
added instrumentation patching unit tests + linting fix
liustve e95134b
metric attribute generator tests
liustve 2249fa0
lint fix
liustve d22fd56
Merge branch 'main' into aws_resource_support
liustve d95b754
prettier fix
liustve d5077e0
Merge branch 'aws_resource_support' of https://github.com/liustve/aws…
liustve be8ba40
lint fix
liustve 581db39
lint fix
liustve 9aca704
added guardrail arn to bedrock
liustve d8bffd5
fixed cloudformation primary id attribute
liustve 2e130d5
Merge branch 'main' of https://github.com/liustve/aws-otel-js-instrum…
liustve d9b811e
Merge branch 'main' into aws_resource_support
liustve e387583
removed lambda function name/arn attributes and tests
liustve f2cd6a2
Merge branch 'aws_resource_support' of https://github.com/liustve/aws…
liustve 9a9a7d6
lint fix
liustve 7a9f4cf
removed lambda and sns and added them to instrumentation patch as ext…
liustve 229ab21
lint fix
liustve 57ed9b4
removed lambda and sns tests, addressed PR comments
liustve 756de5b
resolving package dependency conflicts
liustve a17cd30
Merge branch 'aws-observability:main' into aws_resource_support
liustve 4687a2a
adding dependencies
liustve 478b1d8
Merge branch 'aws_resource_support' of https://github.com/liustve/aws…
liustve 76a2acb
changed stepfunctions to SFN
liustve 9c2ba36
lint fix
liustve c3e4e6b
mapped SFN to StepFunctions
liustve 1e3ff4f
added '===' and removed redundant normalized sns mapping
liustve 9d8f39a
rerun
liustve e3c3a3e
only setting cfn attribute for aws resources
liustve 9236434
linting fix
liustve 46afde1
Merge branch 'aws_resource_support' of https://github.com/liustve/aws…
liustve 63a61ad
Merge branch 'aws-observability:main' into main
liustve dedaebe
added bedrock agent id cfa and sqs queue url
liustve 2ca20b9
setting mysql2 version to 3.11.4
liustve 5bb0d04
Merge branch 'main' into aws_resource_support
liustve 9a111dd
misplaced cfn attribute
liustve 818e0d8
merge conflict
liustve a22c3f0
Merge branch 'aws_resource_support' of https://github.com/liustve/aws…
liustve a5b97b6
added knowledge base id to span
liustve 99db1d8
rerun
liustve f094a39
formatting
liustve 1a79678
Merge branch 'main' of https://github.com/liustve/aws-otel-js-instrum…
liustve 27468e5
Merge branch 'aws-observability:main' into main
liustve bbdb0df
Merge branch 'aws-observability:main' into aws_resource_support
liustve d66cd10
fixed cfa logic and getdatasource test
liustve 164c863
fixed cfa logic and getdatasource test
liustve b2633af
lint fix
liustve cfe0bd3
Merge branch 'main' into aws_resource_support
liustve 0f51034
Merge branch 'main' into aws_resource_support
liustve 03aa3b5
Merge branch 'aws-observability:main' into main
liustve 35785a1
merge main
liustve 461e0bb
merge conflict fix
liustve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
57 changes: 57 additions & 0 deletions
57
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/lambda.ts
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { Attributes, Span, SpanKind, Tracer } from '@opentelemetry/api'; | ||
| import { | ||
| AwsSdkInstrumentationConfig, | ||
| NormalizedRequest, | ||
| NormalizedResponse, | ||
| } from '@opentelemetry/instrumentation-aws-sdk'; | ||
| import { AWS_ATTRIBUTE_KEYS } from '../../../aws-attribute-keys'; | ||
| import { RequestMetadata, ServiceExtension } from '../../../third-party/otel/aws/services/ServiceExtension'; | ||
|
|
||
| export class LambdaServiceExtension implements ServiceExtension { | ||
| requestPreSpanHook(request: NormalizedRequest, _config: AwsSdkInstrumentationConfig): RequestMetadata { | ||
| const requestFunctionName = request.commandInput?.FunctionName; | ||
| const resourceMappingId = request.commandInput?.UUID; | ||
|
|
||
| const spanKind: SpanKind = SpanKind.CLIENT; | ||
| let spanName: string | undefined; | ||
|
|
||
| const spanAttributes: Attributes = {}; | ||
|
|
||
| let functionName = requestFunctionName; | ||
|
|
||
| if (requestFunctionName) { | ||
| if (requestFunctionName.startsWith('arn:aws:lambda:')) { | ||
| const split = requestFunctionName.split(':'); | ||
| functionName = split[split.length - 1]; | ||
| } | ||
|
|
||
| spanAttributes[AWS_ATTRIBUTE_KEYS.AWS_LAMBDA_FUNCTION_NAME] = functionName; | ||
liustve marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| if (resourceMappingId) { | ||
| spanAttributes[AWS_ATTRIBUTE_KEYS.AWS_LAMBDA_RESOURCE_MAPPING_ID] = resourceMappingId; | ||
| } | ||
|
|
||
| const isIncoming = false; | ||
|
|
||
| return { | ||
| isIncoming, | ||
| spanAttributes, | ||
| spanKind, | ||
| spanName, | ||
| }; | ||
| } | ||
|
|
||
| responseHook(response: NormalizedResponse, span: Span, tracer: Tracer, config: AwsSdkInstrumentationConfig): void { | ||
| if (response.data.Configuration) { | ||
| const functionArn = response.data.Configuration.FunctionArn; | ||
|
|
||
| if (functionArn) { | ||
| span.setAttribute(AWS_ATTRIBUTE_KEYS.AWS_LAMBDA_FUNCTION_ARN, functionArn); | ||
| } | ||
| } | ||
| } | ||
| } | ||
43 changes: 43 additions & 0 deletions
43
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/secretsmanager.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { Attributes, Span, SpanKind, Tracer } from '@opentelemetry/api'; | ||
| import { | ||
| AwsSdkInstrumentationConfig, | ||
| NormalizedRequest, | ||
| NormalizedResponse, | ||
| } from '@opentelemetry/instrumentation-aws-sdk'; | ||
| import { AWS_ATTRIBUTE_KEYS } from '../../../aws-attribute-keys'; | ||
| import { RequestMetadata, ServiceExtension } from '../../../third-party/otel/aws/services/ServiceExtension'; | ||
|
|
||
| export class SecretsManagerServiceExtension implements ServiceExtension { | ||
| requestPreSpanHook(request: NormalizedRequest, _config: AwsSdkInstrumentationConfig): RequestMetadata { | ||
| const secretId = request.commandInput?.SecretId; | ||
|
|
||
| const spanKind: SpanKind = SpanKind.CLIENT; | ||
| let spanName: string | undefined; | ||
|
|
||
| const spanAttributes: Attributes = {}; | ||
|
|
||
| if (secretId && secretId.startsWith('arn:aws:secretsmanager:')) { | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| spanAttributes[AWS_ATTRIBUTE_KEYS.AWS_SECRETSMANAGER_SECRET_ARN] = secretId; | ||
| } | ||
|
|
||
| const isIncoming = false; | ||
|
|
||
| return { | ||
| isIncoming, | ||
| spanAttributes, | ||
| spanKind, | ||
| spanName, | ||
| }; | ||
| } | ||
|
|
||
| responseHook(response: NormalizedResponse, span: Span, tracer: Tracer, config: AwsSdkInstrumentationConfig): void { | ||
| const secret_arn = response.data.ARN; | ||
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (secret_arn) { | ||
| span.setAttribute(AWS_ATTRIBUTE_KEYS.AWS_SECRETSMANAGER_SECRET_ARN, secret_arn); | ||
| } | ||
| } | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/sns.ts
jj22ee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { Attributes, SpanKind } from '@opentelemetry/api'; | ||
| import { AwsSdkInstrumentationConfig, NormalizedRequest } from '@opentelemetry/instrumentation-aws-sdk'; | ||
| import { AWS_ATTRIBUTE_KEYS } from '../../../aws-attribute-keys'; | ||
| import { RequestMetadata, ServiceExtension } from '../../../third-party/otel/aws/services/ServiceExtension'; | ||
|
|
||
| export class SNSServiceExtension implements ServiceExtension { | ||
| requestPreSpanHook(request: NormalizedRequest, _config: AwsSdkInstrumentationConfig): RequestMetadata { | ||
| const topicArn = request.commandInput?.TopicArn; | ||
|
|
||
| const spanKind: SpanKind = SpanKind.CLIENT; | ||
| let spanName: string | undefined; | ||
|
|
||
| const spanAttributes: Attributes = {}; | ||
|
|
||
| if (topicArn) { | ||
| spanAttributes[AWS_ATTRIBUTE_KEYS.AWS_SNS_TOPIC_ARN] = topicArn; | ||
| } | ||
|
|
||
| const isIncoming = false; | ||
|
|
||
| return { | ||
| isIncoming, | ||
| spanAttributes, | ||
| spanKind, | ||
| spanName, | ||
| }; | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/step-functions.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { Attributes, SpanKind } from '@opentelemetry/api'; | ||
| import { AwsSdkInstrumentationConfig, NormalizedRequest } from '@opentelemetry/instrumentation-aws-sdk'; | ||
| import { AWS_ATTRIBUTE_KEYS } from '../../../aws-attribute-keys'; | ||
| import { RequestMetadata, ServiceExtension } from '../../../third-party/otel/aws/services/ServiceExtension'; | ||
|
|
||
| export class StepFunctionsServiceExtension implements ServiceExtension { | ||
| requestPreSpanHook(request: NormalizedRequest, _config: AwsSdkInstrumentationConfig): RequestMetadata { | ||
| const stateMachineArn = request.commandInput?.stateMachineArn; | ||
| const activityArn = request.commandInput?.activityArn; | ||
|
|
||
| const spanKind: SpanKind = SpanKind.CLIENT; | ||
| let spanName: string | undefined; | ||
|
|
||
| const spanAttributes: Attributes = {}; | ||
|
|
||
| if (stateMachineArn) { | ||
| spanAttributes[AWS_ATTRIBUTE_KEYS.AWS_STEPFUNCTIONS_STATEMACHINE_ARN] = stateMachineArn; | ||
| } | ||
|
|
||
| if (activityArn) { | ||
| spanAttributes[AWS_ATTRIBUTE_KEYS.AWS_STEPFUNCTIONS_ACTIVITY_ARN] = activityArn; | ||
| } | ||
|
|
||
| const isIncoming = false; | ||
|
|
||
| return { | ||
| isIncoming, | ||
| spanAttributes, | ||
| spanKind, | ||
| spanName, | ||
| }; | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.