Skip to content
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

(synthetics): add tracing #14086

Open
1 of 2 tasks
thomasklinger1234 opened this issue Apr 9, 2021 · 5 comments
Open
1 of 2 tasks

(synthetics): add tracing #14086

thomasklinger1234 opened this issue Apr 9, 2021 · 5 comments
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs feature-request A feature should be added or improved. p3

Comments

@thomasklinger1234
Copy link

thomasklinger1234 commented Apr 9, 2021

Enable active tracing (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-activetracing) for a canary.

Use Case

End-to-end tracing from Canary to API Gateway to Lambda.

Proposed Solution

Add a new property to synthetics.CanaryProps:

new synthetics.Canary(this, 'MyCanary', {
  ...,
  activeTracing: true,
})

By default, it will be false. When set to true, it will also append XRay permissions to the IAM role (e.g. the managed policy arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess).

Other

Similar PR: #11865.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@thomasklinger1234 thomasklinger1234 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 9, 2021
@github-actions github-actions bot added the @aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics label Apr 9, 2021
@NetaNir NetaNir added p2 and removed needs-triage This issue or PR still needs to be triaged. labels Apr 10, 2021
@peterwoodworth peterwoodworth added the feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs label Apr 20, 2021
@NetaNir NetaNir removed their assignment Jun 21, 2021
@github-actions
Copy link

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 21, 2022
@wilhen01
Copy link
Contributor

Bump. This would be nice to have.

@github-actions github-actions bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 22, 2022
@verma-rajatk
Copy link

Any updates or a work around on how to do it?

@wilhen01
Copy link
Contributor

wilhen01 commented Apr 25, 2023

@verma-rajatk you can use the Level 1 constructs to enable x-ray tracing on a Canary:

const canary = new Canary(this, 'Canary', canaryProps);
// enable x-ray tracing for Canary
const cfnCanary = canary.node.defaultChild as CfnCanary;
cfnCanary.runConfig = {
  ...cfnCanary.runConfig,
  activeTracing: true,
};

Can't remember if you need to add any extra permissions to allow that to work, you might need to tweak the role it runs under as well.

@pahud pahud added p3 and removed p2 labels Jun 11, 2024
mergify bot pushed a commit that referenced this issue Jul 31, 2024
…anary class (#30556)

### Issue # (if applicable)

Closes #9300, #14086, #28152

### Reason for this change
In order to make the properties in the [runConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_synthetics.CfnCanary.RunConfigProperty.html) of the L1 Construct configurable in the L2 Construct.

* [activeTracing](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_synthetics.CfnCanary.RunConfigProperty.html#activetracing)
* [memoryInMb](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_synthetics.CfnCanary.RunConfigProperty.html#memoryinmb)
* [timeoutInSeconds](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_synthetics.CfnCanary.RunConfigProperty.html#timeoutinseconds)

At the moment, the L2 [Canary](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_synthetics.Canary.html) Class only supports [environmentVariables](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_synthetics.CfnCanary.RunConfigProperty.html#environmentvariables) in the `runConfig`.



### Description of changes
Add missing properties.

* `activeTracing`
* `memory`
* `timeout`

Note:  The following is stated in #9300, but when tested, it was possible to set only `memoryInMb` (`memory`).

> The difficulty is that timeoutInSeconds is required if runConfig is set, so one cannot only specify memoryInMb.

Test code is here.

```ts
class TestStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    new synthetics.Canary(this, 'Canary', {
      canaryName: 'next',
      runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
      test: synthetics.Test.custom({
        handler: 'index.handler',
        code: synthetics.Code.fromInline(`
          exports.handler = async () => {
            console.log(\'hello world\');
          };`),
      }),
      cleanup: synthetics.Cleanup.LAMBDA,
      memory: Size.mebibytes(2048),
    });
  }
}
```



### Description of how you validated changes
Add unit tests and integ tests.



### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@mazyu36
Copy link
Contributor

mazyu36 commented Aug 3, 2024

Hi.
This issue has been addressed in #30556 and released in v2.151.0.
I apologize that it wasn't automatically closed, possibly due to an error in my settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs feature-request A feature should be added or improved. p3
Projects
None yet
Development

No branches or pull requests

7 participants