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

feat(stepfunctions): support X-Ray tracing (#10371) #10374

Merged
merged 6 commits into from
Sep 18, 2020
Merged

feat(stepfunctions): support X-Ray tracing (#10371) #10374

merged 6 commits into from
Sep 18, 2020

Conversation

humanzz
Copy link
Contributor

@humanzz humanzz commented Sep 15, 2020

closes #10371


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@humanzz
Copy link
Contributor Author

humanzz commented Sep 15, 2020

This PR required bumping the cfn spec... Likely you'd want to separate the cfn spec bump into a different commit but I wasn't sure what the best process to follow is here.

Build logs below show some failures for cfn spec bump I think as I managed to build stepfunctions successfully so appreciate some input into how to best progress on this

Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are a lot of unrelated changes here. can we clean up the PR before I can take a look?

@humanzz - the spec bump is currently being addressed in a separate PR by the cdk team. I'd say the best path forward would be to merge that in once it's resolved. can we simplify this PR int he meantime to exclude the spec bump changes (regardless of the PR build status) and that way I can focus the review on the code related to the feature we are introducing here.

@humanzz
Copy link
Contributor Author

humanzz commented Sep 16, 2020

@shivlaks that's because the first commit is to bump CloudFormation spec to get the changes needed for this feature (the second commit).

I went over the commit logs and saw that in the most recent CloudFormation bump specs you guys tend to do it so I wonder if the right course of action here is to wait for you to do it and then rebase my changes?

To be more concrete, I think

  1. The bump spec needs to happen in a separate PR/commit
  2. This PR then needs to be updated to rebase on that

The question is: who will do the bump spec? Are you guys planning to do it soon?

@shivlaks
Copy link
Contributor

The question is: who will do the bump spec? Are you guys planning to do it soon?

@humanzz - there have been some issues with importing the spec and they are actively being worked on in #10201
stay tuned to that one for merging in the added functionality. in the meantime, see if you can exclude those from your PR to make it simpler to review the feature of adding x-ray support.

what do you think

@humanzz
Copy link
Contributor Author

humanzz commented Sep 16, 2020

@shivlaks so, the second commit contains the changes for XRay. I wonder if that can be reviewed independently - if I click on it, I see the review options but not sure if you get the same view.

Otherwise, given the dependency of the second commit on the first commit, I'm not sure how to best update this PR to exclude the first commit while still containing the necessary changes from it.

Also, #10201 is for v18.2.0 (while the first commit in this PR is for v18.2.0) and on viewing its diff am not noticing anything related to stepfunctions (but am not sure if that means if the change necessary is part of it or not)

What do you think?

@shivlaks
Copy link
Contributor

@humanzz - I can filter by module and review it, probably the simplest way forward.

@humanzz
Copy link
Contributor Author

humanzz commented Sep 16, 2020

@shivlaks thanks for that as this allows addressing changes I can control.
I'll keep an eye on #10201 and once merged I'll rebase my changes on top so the PR will be updated with a clean all-related diff.

@mergify mergify bot dismissed shivlaks’s stale review September 17, 2020 11:16

Pull request has been modified.

@humanzz
Copy link
Contributor Author

humanzz commented Sep 17, 2020

@shivlaks so the cfn spec bump required was merged. I rebased and updated the PR so it should all be good for reviewing now

Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@humanzz thanks for getting this PR together so quickly after the announcement of the feature!!!

had some minor suggestions and a question about whether we should enable this by default. Let me know what you think!

extract buildLoggingConfiguration and buildTracingConfiguration into private methods

use Role's addToPrincipalPolicy method instead of the deprecated addToPolicy
@mergify mergify bot dismissed shivlaks’s stale review September 18, 2020 05:11

Pull request has been modified.

Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good. some small suggestions before we can merge this. I think we'll be able to get this into the next release!

@@ -404,6 +387,49 @@ export class StateMachine extends StateMachineBase {
public metricTime(props?: cloudwatch.MetricOptions): cloudwatch.Metric {
return this.metric('ExecutionTime', props);
}

private buildLoggingConfiguration(props: StateMachineProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should specify the return type for the method

};
}

private buildTracingConfiguration(props: StateMachineProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should specify the return type for the method

return undefined;
}

this.addToRolePolicy(new iam.PolicyStatement({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also worth linking to documentation as to why these cannot be scoped to resource level - i.e. point to https://docs.aws.amazon.com/xray/latest/devguide/security_iam_id-based-policy-examples.html#xray-permissions-resources

Comment on lines 413 to 416
destinations: [{ cloudWatchLogsLogGroup: { logGroupArn: props.logs.destination.logGroupArn } }],
includeExecutionData: props.logs.includeExecutionData,
level: props.logs.level || 'ERROR',
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we format this so it's a little more readable

Comment on lines 287 to 288
loggingConfiguration: this.buildLoggingConfiguration(props),
tracingConfiguration: this.buildTracingConfiguration(props),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these really need to pass the entire props object?

I don't think the tracing configuration needs anything if checked here.
the logging configuration should really only need the LogOptions if logging has been specified

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was a matter of style to similar methods in other packages... but maybe the style is not that consistent. Changing it

@mergify mergify bot dismissed shivlaks’s stale review September 18, 2020 17:53

Pull request has been modified.

Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@humanzz awesome turnaround on the comments, thanks for contributing this feature!!!

@mergify
Copy link
Contributor

mergify bot commented Sep 18, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 96b9adf
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Sep 18, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit ad011c0 into aws:master Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[stepfunctions] support XRay tracing for StateMachine
3 participants