Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Update Device Defender demo to send custom metrics #1547
Update Device Defender demo to send custom metrics #1547
Changes from 16 commits
6469599
410251b
1631d97
bb56434
657aea2
d2e6d9f
f99c8fb
a74e9b0
4e9080d
a103ba8
382cd8b
c132c55
c4fd4fc
6e432ba
573462e
651d882
9a689a9
5f50723
e4f4116
469c03e
2293a33
d5a35a6
a1e8d1d
06512bb
e84f7d5
f8008de
834f591
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to use float here? The code that outputs these numbers utilizes %lu: https://elixir.bootlin.com/linux/v4.0/source/fs/proc/uptime.c#L27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use integer type then for the non-decimal part of the value.
Based on the source code link, we may have to ideally use
struct timespec
(to store higher precision of data) type but for simplicity of reporting only the seconds part of the time, we can use integer type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lineNumber
is not needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is being printed in the debug and error log messages while lines are read from
proc/meminfo
just like other functions read multiple linesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only other function that has
lineNumber
isGetEstablishedConnections
which uses it to skip the first line.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done only for the lines starting with
MemTotal
andMemAvailable
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That leads to duplication of the
sscanf
logic in the if-else-if branches that match for the field names. I have pushed the change though as I don't have a strong preference for either.