Skip to content

Device Defender custom metrics support #401

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 68 commits into from
May 6, 2022

Conversation

TwistedTwigleg
Copy link
Contributor

@TwistedTwigleg TwistedTwigleg commented Mar 15, 2022

Description of changes:

Adds support for registering custom metrics to the Device Defender service. Exposes functions to hook into Device Defender number, number-list, string-list, and ip-list metric gathering. Adds new functions to Aws::Iotdevicedefenderv1 to register these custom metrics either by passing a function pointer or a std::function. Adds predefined custom metric functions that will get CPU usage (in percent), memory usage (in kilobytes) and process count.

This PR also adds a device defender sample to show how to use and register custom metrics and custom metrics tests to the existing Device Defender tests.

aws-c-iot PR that accompanies this PR: awslabs/aws-c-iot#67


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

@TwistedTwigleg
Copy link
Contributor Author

TwistedTwigleg commented Mar 15, 2022

Note: This PR relies on the changes in awslabs/aws-c-iot#67 in order to compile successfully, since it adds some new functions for custom metrics using doubles.

@TwistedTwigleg TwistedTwigleg marked this pull request as ready for review March 15, 2022 23:30
@TwistedTwigleg
Copy link
Contributor Author

I pushed the first part of the changes based on the code review, but I have not fully implemented it just yet. Currently custom metrics for strings and IP lists are not working, causing segmentation faults when they are written to JSON. I think it is the strings are going out of reference.
Regardless, I wanted to push my work so I didn't lose anything but it's not quite ready yet.

…her than reference and that was causing the crash
@TwistedTwigleg
Copy link
Contributor Author

Thanks for the reviews! Merging into main...

@TwistedTwigleg TwistedTwigleg merged commit 3902fd0 into main May 6, 2022
@TwistedTwigleg TwistedTwigleg deleted the DeviceDefenderCustomMetricsSupport branch May 6, 2022 11:49
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.

3 participants