-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into contract_tests_feat_parity
- Loading branch information
Showing
24 changed files
with
1,834 additions
and
300 deletions.
There are no files selected for viewing
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
3 changes: 2 additions & 1 deletion
3
aws-distro-opentelemetry-node-autoinstrumentation/.eslintignore
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
build | ||
node_modules | ||
.eslintrc.js | ||
version.ts | ||
version.ts | ||
src/third-party |
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
43 changes: 43 additions & 0 deletions
43
aws-distro-opentelemetry-node-autoinstrumentation/src/patches/aws/services/secretsmanager.ts
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,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 (typeof secretId === 'string' && secretId.startsWith('arn:aws:secretsmanager:')) { | ||
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 secretArn = response.data.ARN; | ||
|
||
if (secretArn) { | ||
span.setAttribute(AWS_ATTRIBUTE_KEYS.AWS_SECRETSMANAGER_SECRET_ARN, secretArn); | ||
} | ||
} | ||
} |
Oops, something went wrong.