aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.52k stars 3.86k forks source link

(synthetics): add tracing #14086

Open thomasklinger1234 opened 3 years ago

thomasklinger1234 commented 3 years ago

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: https://github.com/aws/aws-cdk/pull/11865.


This is a :rocket: Feature Request

github-actions[bot] commented 2 years ago

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.

wilhen01 commented 2 years ago

Bump. This would be nice to have.

verma-rajatk commented 1 year ago

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

wilhen01 commented 1 year ago

@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.

mazyu36 commented 1 month ago

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.