Skip to content

implement CloudWatch metrics - #69

Merged
tobywf merged 5 commits into
aws-cloudformation:masterfrom
jaymccon:cw_metrics
Dec 4, 2019
Merged

tobywf merged 5 commits into
aws-cloudformation:masterfrom
jaymccon:cw_metrics

Conversation

@jaymccon

@jaymccon jaymccon commented Dec 1, 2019

Copy link
Copy Markdown
Contributor

Issue #, if available: Fixes #22

Description of changes:

Wires up metrics to publish to cwl in platfom acc and provider acc (if configured).

refactored metrics.py to handler multiple boto3 clients per publishing event and address a few gaps with the java plugin.

Tested end to end, metrics showing up as expected in provider account.

Resource.__call__ is becoming unwieldy, could use a refactor, but didn't want to muddy this pr with more refactors, so will address in a future pr.

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

@tobywf tobywf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'm not 100%, but need to get the timestamp timezone stuff right, so requesting changes for now.

Comment thread src/cloudformation_cli_python_lib/resource.py Outdated
Comment thread src/cloudformation_cli_python_lib/resource.py Outdated
MetricPublisher(
event.awsAccountId, event.resourceType, provider_sess
)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this looks like a case to me where breaking from the Java interface could be beneficial? we could backport changes or simply say it's different; the metrics stuff is old and the log delivery was patched in hastily from what i can see. for example, seems like the only difference between the publishers is the session. that means the proxy could take the awsAccountId and resourceType, and maybe add_metrics_publisher would just be called with credentials to add another one?

it's up to you. either one of us could do this in a separate PR, too. more of a brainstorm, since it's perfectly functional as is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let's get this merged to get the functionality available and can improve in future pr's

@jaymccon

jaymccon commented Dec 4, 2019 •

Copy link
Copy Markdown
Contributor Author

Aside from travis failing on python 3.8, it looks like rebasing on the current master has caused some issues when I test end to end, investigating.

Update: e2e tests just needed handlers.py to be updated to pass the type name to Resource. end to end tests pass, so this should be safe to merge.

@jaymccon
jaymccon requested a review from tobywf December 4, 2019 21:26

@tobywf tobywf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

friendly reminder to not rebase PRs but merge in master instead as it breaks almost all links and reviewing tools and makes spotting any merge issues a lot harder. i guess if it builds it's probably okay

@tobywf
tobywf merged commit f195602 into aws-cloudformation:master Dec 4, 2019
@tobywf tobywf mentioned this pull request Dec 5, 2019
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.

update metrics namespace

3 participants