Conversation
nmussy
left a comment
There was a problem hiding this comment.
Could you use an enum here, it makes for stronger typing, a simpler implementation for your PR, better DX, better documentation, etc
| * If PassThrough, the topic passes trace headers received from the Amazon SNS publisher to its subscription. | ||
| * If set to Active, Amazon SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. | ||
| * | ||
| * @see https://docs.aws.amazon.com/sns/latest/dg/sns-active-tracing.html. |
There was a problem hiding this comment.
The period at the end breaks the URL
| * @see https://docs.aws.amazon.com/sns/latest/dg/sns-active-tracing.html. | |
| * @see https://docs.aws.amazon.com/sns/latest/dg/sns-active-tracing.html |
| * | ||
| * @default PassThrough | ||
| */ | ||
| readonly tracingConfig?: string; |
There was a problem hiding this comment.
An enumeration would be preferred here, since only two values are acceptable. Although I'm not sure why it's not properly documented in the CloudFormation docs, there should be a list of "Valid Values"
| if ( | ||
| props.tracingConfig && | ||
| !Token.isUnresolved(props.tracingConfig) && | ||
| props.tracingConfig !== 'PassThrough' && | ||
| props.tracingConfig !== 'Active' | ||
| ) { | ||
| throw new Error(`tracingConfig must be "PassThrough" or "Active", received: "${props.tracingConfig}".`); | ||
| } |
There was a problem hiding this comment.
The enumeration also allows your to remove this check
| test('throw with incorrect tracingConfig', () => { | ||
| const app = new cdk.App(); | ||
| const stack = new cdk.Stack(app); | ||
|
|
||
| expect( | ||
| () => new sns.Topic(stack, 'MyTopic', { | ||
| tracingConfig: 'Test', | ||
| }), | ||
| ).toThrow(/tracingConfig must be "PassThrough" or "Active", received: "Test"./); | ||
| }); |
There was a problem hiding this comment.
This test can also be removed
|
Did you forget to push your latest commits? |
Failed build after code fix. |
nmussy
left a comment
There was a problem hiding this comment.
Just some small stuff, LGTM otherwise 👍
| /** | ||
| * The mode that topic passes trace headers received from the Amazon SNS publisher to its subscription. | ||
| */ | ||
| PASSTHROUGH = 'PassThrough', |
There was a problem hiding this comment.
| PASSTHROUGH = 'PassThrough', | |
| PASS_THROUGH = 'PassThrough', |
| * | ||
| * @see https://docs.aws.amazon.com/sns/latest/dg/sns-active-tracing.html | ||
| * | ||
| * @default PassThrough |
There was a problem hiding this comment.
| * @default PassThrough | |
| * @default TracingConfig.PASS_THROUGH |
| If PassThrough, the topic passes trace headers received from the Amazon SNS publisher to its subscription. | ||
| If set to Active, Amazon SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. | ||
|
|
||
| The default TracingConfig is `PassThrough`. |
There was a problem hiding this comment.
| The default TracingConfig is `PassThrough`. | |
| The default TracingConfig is `TracingConfig.PASS_THROUGH`. |
nmussy
left a comment
There was a problem hiding this comment.
LGTM, thanks for the contribution 👍
b6dd635 to
a7b4e29
Compare
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
|
The pull request linter fails with the following errors: PRs must pass status checks before we can provide a meaningful review. If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
No worries, I'll have a look 👍 |
Issue # (if applicable)
Closes #29714
Reason for this change
Currently, to set the TracingConfig, it is necessary to configure it via L1.
So, add TracingConfig props to L2.
Description of changes
added TracingConfig props to topic.ts, sns.test.ts, integ.sns.ts, and README.md for AWS SNS.
Description of how you validated changes
I confirmed with unit test and integ test that it works as expected.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license