Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

metrics: nest json results in unique subsections#785

Merged
GabyCT merged 4 commits intokata-containers:masterfrom
grahamwhaley:20180927_nest_json
Oct 2, 2018
Merged

metrics: nest json results in unique subsections#785
GabyCT merged 4 commits intokata-containers:masterfrom
grahamwhaley:20180927_nest_json

Conversation

@grahamwhaley
Copy link
Copy Markdown
Contributor

To avoid any JSON name space/value type clashes, we nest each different tests
results into a section named by the test name.

This also then needs any code or examples that reference that data to be updated.

Graham Whaley added 4 commits September 28, 2018 16:52
Separate the test result data out from the generic system level
data by placing all result data into a subsection named by
${TEST_NAME} setting. This also isolates each set of test data
from other tests, which should prevent any future name/type clashes.

Internally the fix is mildly hacky, in that we record the array index
where the system data ends, and later use that index to inject the
new section into the final generation loop. This was the easiest way,
as the library does not support generation of nested fragments
directly through its API. The alternatives would be to either
support nesting (complex), or add a separate API/array to store
system info separate from test info. Right now, this was the easiest
fix.

Fixes: kata-containers#778

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
Now we are nesting JSON results inside a section with the name
of the tests, we need to update the checkmetrics `jq` pattern
matches to match.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
Now we nest the test results into uniquely named sub-structs
of the JSON, we need to un-nest it in the report processing in
order to get at the data.

We specifically un-nest, rather than just educate the scripts about
the sub-section names, as then the inner processing loops can stay
fairly generic across all the test results. It just makes the inner
code a bit less complex.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
Loading plyr to do the DUT tables was spitting out a warning
which ended up in the report. Silence it...

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
@grahamwhaley
Copy link
Copy Markdown
Contributor Author

This is related to how we store our data into elasticsearch over on kata-containers/ci#60

Note, marked as DNM right now, because as soon as this lands the metrics CI configs will need updating to take into account the new data format - so we will potentially have a few metrics glitches.

As I'm landing this on a Friday evening (yay, that old 🌰 @jodh-intel ;-) ), I thought I'd go for DNM until it gets a bit of review, and then we can do the fast-hand land/fix in a sync'd manner to reduce the fallout.

@GabyCT - have a look. The final results (such as the genreport output) do not change, just the internal structure of the final JSON files. Nobody should notice - apart from anybody 'looking' in the data, which is mostly you and I ;-)

@jodh-intel
Copy link
Copy Markdown

jodh-intel commented Sep 28, 2018

lgtm

It might be interesting if you could paste an example of the "before" and "after" formats here inside ```json blocks :)

Approved with PullApprove

@grahamwhaley
Copy link
Copy Markdown
Contributor Author

Will do Monday with some real data. Basically, it goes from...

generic system stuff here....
,
"Results" : {
 blah specific to the test in question
}

to

generic system stuff here....
,
"test-name" : {
  "Results" : {
   blah specific to the test in question
  }
}

@GabyCT
Copy link
Copy Markdown
Contributor

GabyCT commented Sep 28, 2018

@grahamwhaley , let me take a look :)

Copy link
Copy Markdown
Contributor

@GabyCT GabyCT left a comment

Choose a reason for hiding this comment

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

tested this PR and is looking good

@GabyCT
Copy link
Copy Markdown
Contributor

GabyCT commented Sep 28, 2018

@jodh-intel , here it is json example

Before this PR

...
        "Config": [
                        {
                "containers": 20,
                "ksm": 0,
                "auto": "",
                "waittime": 5,
                "image": "busybox",
                "command": "sh"
        }
        ],
        "Results": [
                        {
                "average": {
                        "Result": 139772.58,
                        "Units" : "KB"
                },
                "qemus": {
                        "Result": 135491.70,
                        "Units" : "KB"
                },
                "shims": {
                        "Result": 4105.15,
                        "Units" : "KB"
                },
                "proxys": {
                        "Result": 175.73,
                        "Units" : "KB"
                }
        }
...

After this PR

...
"memory-footprint" : {
        "Config": [
                        {
                "containers": 20,
                "ksm": 0,
                "auto": "",
                "waittime": 5,
                "image": "busybox",
                "command": "sh"
        }
        ],
        "Results": [
                        {
                "average": {
                        "Result": 153275.35,
                        "Units" : "KB"
                },
                "qemus": {
                        "Result": 145836.85,
                        "Units" : "KB"
                },
                "shims": {
                        "Result": 7039.75,
                        "Units" : "KB"
                },
                "proxys": {
                        "Result": 398.75,
                        "Units" : "KB"
                }
        }
        ],
...

I did not paste the full json but just the part that @grahamwhaley is adding, I hope it helps to give you an idea :)

@jodh-intel
Copy link
Copy Markdown

Thanks @grahamwhaley and @GabyCT.

@grahamwhaley
Copy link
Copy Markdown
Contributor Author

dropping the DNM. The nesting works (I see it in elastic), and I believe is necessary.

@grahamwhaley
Copy link
Copy Markdown
Contributor Author

even though I don't believe the tests will run this code.... I'm going to fire them so we get a nice clear BIG GREEN BUTTON ;-)

@grahamwhaley
Copy link
Copy Markdown
Contributor Author

/test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants