Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Kush Trivedi <[email protected]>
  • Loading branch information
kushthedude committed Sep 18, 2020
1 parent 2e55fcc commit 7b087ec
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 13 deletions.
109 changes: 109 additions & 0 deletions 2020-09-08-162919_test.json
Original file line number Diff line number Diff line change
@@ -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
}
28 changes: 15 additions & 13 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -66,5 +68,5 @@ func main() {

log.Debugf("Mapped version of the test: %+#v", resultsMap)

fmt.Print(string(result))

}
Binary file added sample_data/._sample_data.json
Binary file not shown.
109 changes: 109 additions & 0 deletions sample_data/sample_data_fortio.json
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 7b087ec

Please sign in to comment.