Skip to content

Added support for more than 100 metrics #31

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

Merged
merged 3 commits into from
Apr 18, 2020

Conversation

ridha
Copy link
Contributor

@ridha ridha commented Apr 14, 2020

Issue #: #10

Description of changes:

Added support for more than 100 metrics

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Member

@jaredcnance jaredcnance left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! One comment.

if should_serialize:
event_batches.append(json.dumps(body))
metric_pointers = []
body["_aws"]["CloudWatchMetrics"][0]["Metrics"] = metric_pointers
Copy link
Member

Choose a reason for hiding this comment

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

do we ever reset the body? If I'm reading this correctly, all JSON payloads will contain all the metric values just not the pointers? For example, in the node implementation, we recreate a new body every time we flush: https://github.com/awslabs/aws-embedded-metrics-node/blob/730bbaeb341ee3952a404c04fc1de59a6ec65cf5/src/serializers/LogSerializer.ts#L71

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, JSON payload will contain the metric values. As per my understanding, We need to reset Metrics ( body["_aws"]["CloudWatchMetrics"][0]["Metrics"] ) and use the same value for other fields - Dimensions, Namespace, etc. Please correct me if am wrong.

Thanks,
Abdul

Copy link
Member

Choose a reason for hiding this comment

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

We need to reset the body as well to prevent the payload from continuing to grow with metrics that aren't referenced. You're removing it from the pointers which is good, but not from the body which get added into ln54.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing it out. Fixed.

Copy link
Member

@jaredcnance jaredcnance left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for doing this. Will bump the version, let it bake and release on Monday if everything looks good.

@jaredcnance jaredcnance merged commit 2660af4 into awslabs:master Apr 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.

2 participants