diff --git a/2020-09-08-162919_test.json b/2020-09-08-162919_test.json new file mode 100644 index 00000000..6e636f39 --- /dev/null +++ b/2020-09-08-162919_test.json @@ -0,0 +1,109 @@ +{ + "RunType": "HTTP", + "Labels": "test", + "StartTime": "2020-09-08T16:29:19.35507+05:30", + "RequestedQPS": "100", + "RequestedDuration": "5s", + "ActualQPS": 59.9799880886016, + "ActualDuration": 5101701580, + "NumThreads": 8, + "Version": "1.6.8", + "DurationHistogram": { + "Count": 306, + "Min": 0.114543168, + "Max": 0.436206912, + "Sum": 40.422087638, + "Avg": 0.1320983256143791, + "StdDev": 0.03333137761133907, + "Data": [ + { + "Start": 0.114543168, + "End": 0.2, + "Percent": 97.38562091503267, + "Count": 298 + }, + { + "Start": 0.2, + "End": 0.3, + "Percent": 99.34640522875817, + "Count": 6 + }, + { + "Start": 0.3, + "End": 0.4, + "Percent": 99.67320261437908, + "Count": 1 + }, + { + "Start": 0.4, + "End": 0.436206912, + "Percent": 100, + "Count": 1 + } + ], + "Percentiles": [ + { + "Percentile": 50, + "Value": 0.15827865104377106 + }, + { + "Percentile": 75, + "Value": 0.1802902592861953 + }, + { + "Percentile": 90, + "Value": 0.19349722423164983 + }, + { + "Percentile": 99, + "Value": 0.28233333333333327 + }, + { + "Percentile": 99.9, + "Value": 0.42512759692800084 + } + ] + }, + "Exactly": 0, + "Jitter": false, + "RetCodes": { + "200": 306 + }, + "Sizes": { + "Count": 306, + "Min": 14152, + "Max": 15026, + "Sum": 4356836, + "Avg": 14238.02614379085, + "StdDev": 52.37209101996212, + "Data": [ + { + "Start": 14152, + "End": 15026, + "Percent": 100, + "Count": 306 + } + ], + "Percentiles": null + }, + "HeaderSizes": { + "Count": 306, + "Min": 0, + "Max": 0, + "Sum": 0, + "Avg": 0, + "StdDev": 0, + "Data": [ + { + "Start": 0, + "End": 0, + "Percent": 100, + "Count": 306 + } + ], + "Percentiles": null + }, + "URL": "https://www.google.com", + "SocketCount": 0, + "AbortOn": 0 +} \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go index fbe16342..23eb34f5 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -6,7 +6,7 @@ import ( "encoding/json" "github.com/layer5io/nighthawk-go/apinighthawk" - "fortio.org/fortio/fhttp" + // "fortio.org/fortio/fhttp" "fortio.org/fortio/periodic" "github.com/pkg/errors" log "github.com/sirupsen/logrus" @@ -38,22 +38,24 @@ func main() { err = errors.Wrapf(err, msg) log.Fatal(err) } - res1 := string(result) + + fmt.Print(string(result)) + // res1 := string(result) var result1 periodic.RunnerResults - var bd []byte + // var bd []byte - hres, _ := res1.(*fhttp.HTTPRunnerResults) - bd, err = json.Marshal(hres) - result1 = hres.Result() + // hres, _ := res1.(*fhttp.HTTPRunnerResults) + // bd, err = json.Marshal(hres) + // result1 = hres.Result() - // err = json.Unmarshal([]byte(result), &result1) + err = json.Unmarshal([]byte(result), &result1) - // if err != nil { - // err = errors.Wrap(err, "Error while unmarshaling Nighthawk results to the FortioHTTPRunner") - // // logrus.Error(err) - // log.Fatal(err) - // } + if err != nil { + err = errors.Wrap(err, "Error while unmarshaling Nighthawk results to the FortioHTTPRunner") + // logrus.Error(err) + log.Fatal(err) + } resultsMap := map[string]interface{}{} err = json.Unmarshal(result, &resultsMap) @@ -66,5 +68,5 @@ func main() { log.Debugf("Mapped version of the test: %+#v", resultsMap) - fmt.Print(string(result)) + } diff --git a/sample_data/._sample_data.json b/sample_data/._sample_data.json new file mode 100644 index 00000000..8c6916a5 Binary files /dev/null and b/sample_data/._sample_data.json differ diff --git a/sample_data/sample_data_fortio.json b/sample_data/sample_data_fortio.json new file mode 100644 index 00000000..6e636f39 --- /dev/null +++ b/sample_data/sample_data_fortio.json @@ -0,0 +1,109 @@ +{ + "RunType": "HTTP", + "Labels": "test", + "StartTime": "2020-09-08T16:29:19.35507+05:30", + "RequestedQPS": "100", + "RequestedDuration": "5s", + "ActualQPS": 59.9799880886016, + "ActualDuration": 5101701580, + "NumThreads": 8, + "Version": "1.6.8", + "DurationHistogram": { + "Count": 306, + "Min": 0.114543168, + "Max": 0.436206912, + "Sum": 40.422087638, + "Avg": 0.1320983256143791, + "StdDev": 0.03333137761133907, + "Data": [ + { + "Start": 0.114543168, + "End": 0.2, + "Percent": 97.38562091503267, + "Count": 298 + }, + { + "Start": 0.2, + "End": 0.3, + "Percent": 99.34640522875817, + "Count": 6 + }, + { + "Start": 0.3, + "End": 0.4, + "Percent": 99.67320261437908, + "Count": 1 + }, + { + "Start": 0.4, + "End": 0.436206912, + "Percent": 100, + "Count": 1 + } + ], + "Percentiles": [ + { + "Percentile": 50, + "Value": 0.15827865104377106 + }, + { + "Percentile": 75, + "Value": 0.1802902592861953 + }, + { + "Percentile": 90, + "Value": 0.19349722423164983 + }, + { + "Percentile": 99, + "Value": 0.28233333333333327 + }, + { + "Percentile": 99.9, + "Value": 0.42512759692800084 + } + ] + }, + "Exactly": 0, + "Jitter": false, + "RetCodes": { + "200": 306 + }, + "Sizes": { + "Count": 306, + "Min": 14152, + "Max": 15026, + "Sum": 4356836, + "Avg": 14238.02614379085, + "StdDev": 52.37209101996212, + "Data": [ + { + "Start": 14152, + "End": 15026, + "Percent": 100, + "Count": 306 + } + ], + "Percentiles": null + }, + "HeaderSizes": { + "Count": 306, + "Min": 0, + "Max": 0, + "Sum": 0, + "Avg": 0, + "StdDev": 0, + "Data": [ + { + "Start": 0, + "End": 0, + "Percent": 100, + "Count": 306 + } + ], + "Percentiles": null + }, + "URL": "https://www.google.com", + "SocketCount": 0, + "AbortOn": 0 +} \ No newline at end of file