Skip to content

Commit 7b087ec

Browse files
committed
fixes
Signed-off-by: Kush Trivedi <kushthedude@gmail.com>
1 parent 2e55fcc commit 7b087ec

File tree

4 files changed

+233
-13
lines changed

4 files changed

+233
-13
lines changed

2020-09-08-162919_test.json

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"RunType": "HTTP",
3+
"Labels": "test",
4+
"StartTime": "2020-09-08T16:29:19.35507+05:30",
5+
"RequestedQPS": "100",
6+
"RequestedDuration": "5s",
7+
"ActualQPS": 59.9799880886016,
8+
"ActualDuration": 5101701580,
9+
"NumThreads": 8,
10+
"Version": "1.6.8",
11+
"DurationHistogram": {
12+
"Count": 306,
13+
"Min": 0.114543168,
14+
"Max": 0.436206912,
15+
"Sum": 40.422087638,
16+
"Avg": 0.1320983256143791,
17+
"StdDev": 0.03333137761133907,
18+
"Data": [
19+
{
20+
"Start": 0.114543168,
21+
"End": 0.2,
22+
"Percent": 97.38562091503267,
23+
"Count": 298
24+
},
25+
{
26+
"Start": 0.2,
27+
"End": 0.3,
28+
"Percent": 99.34640522875817,
29+
"Count": 6
30+
},
31+
{
32+
"Start": 0.3,
33+
"End": 0.4,
34+
"Percent": 99.67320261437908,
35+
"Count": 1
36+
},
37+
{
38+
"Start": 0.4,
39+
"End": 0.436206912,
40+
"Percent": 100,
41+
"Count": 1
42+
}
43+
],
44+
"Percentiles": [
45+
{
46+
"Percentile": 50,
47+
"Value": 0.15827865104377106
48+
},
49+
{
50+
"Percentile": 75,
51+
"Value": 0.1802902592861953
52+
},
53+
{
54+
"Percentile": 90,
55+
"Value": 0.19349722423164983
56+
},
57+
{
58+
"Percentile": 99,
59+
"Value": 0.28233333333333327
60+
},
61+
{
62+
"Percentile": 99.9,
63+
"Value": 0.42512759692800084
64+
}
65+
]
66+
},
67+
"Exactly": 0,
68+
"Jitter": false,
69+
"RetCodes": {
70+
"200": 306
71+
},
72+
"Sizes": {
73+
"Count": 306,
74+
"Min": 14152,
75+
"Max": 15026,
76+
"Sum": 4356836,
77+
"Avg": 14238.02614379085,
78+
"StdDev": 52.37209101996212,
79+
"Data": [
80+
{
81+
"Start": 14152,
82+
"End": 15026,
83+
"Percent": 100,
84+
"Count": 306
85+
}
86+
],
87+
"Percentiles": null
88+
},
89+
"HeaderSizes": {
90+
"Count": 306,
91+
"Min": 0,
92+
"Max": 0,
93+
"Sum": 0,
94+
"Avg": 0,
95+
"StdDev": 0,
96+
"Data": [
97+
{
98+
"Start": 0,
99+
"End": 0,
100+
"Percent": 100,
101+
"Count": 306
102+
}
103+
],
104+
"Percentiles": null
105+
},
106+
"URL": "https://www.google.com",
107+
"SocketCount": 0,
108+
"AbortOn": 0
109+
}

cmd/main.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"encoding/json"
77

88
"github.com/layer5io/nighthawk-go/apinighthawk"
9-
"fortio.org/fortio/fhttp"
9+
// "fortio.org/fortio/fhttp"
1010
"fortio.org/fortio/periodic"
1111
"github.com/pkg/errors"
1212
log "github.com/sirupsen/logrus"
@@ -38,22 +38,24 @@ func main() {
3838
err = errors.Wrapf(err, msg)
3939
log.Fatal(err)
4040
}
41-
res1 := string(result)
41+
42+
fmt.Print(string(result))
43+
// res1 := string(result)
4244

4345
var result1 periodic.RunnerResults
44-
var bd []byte
46+
// var bd []byte
4547

46-
hres, _ := res1.(*fhttp.HTTPRunnerResults)
47-
bd, err = json.Marshal(hres)
48-
result1 = hres.Result()
48+
// hres, _ := res1.(*fhttp.HTTPRunnerResults)
49+
// bd, err = json.Marshal(hres)
50+
// result1 = hres.Result()
4951

50-
// err = json.Unmarshal([]byte(result), &result1)
52+
err = json.Unmarshal([]byte(result), &result1)
5153

52-
// if err != nil {
53-
// err = errors.Wrap(err, "Error while unmarshaling Nighthawk results to the FortioHTTPRunner")
54-
// // logrus.Error(err)
55-
// log.Fatal(err)
56-
// }
54+
if err != nil {
55+
err = errors.Wrap(err, "Error while unmarshaling Nighthawk results to the FortioHTTPRunner")
56+
// logrus.Error(err)
57+
log.Fatal(err)
58+
}
5759

5860
resultsMap := map[string]interface{}{}
5961
err = json.Unmarshal(result, &resultsMap)
@@ -66,5 +68,5 @@ func main() {
6668

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

69-
fmt.Print(string(result))
71+
7072
}

sample_data/._sample_data.json

4 KB
Binary file not shown.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"RunType": "HTTP",
3+
"Labels": "test",
4+
"StartTime": "2020-09-08T16:29:19.35507+05:30",
5+
"RequestedQPS": "100",
6+
"RequestedDuration": "5s",
7+
"ActualQPS": 59.9799880886016,
8+
"ActualDuration": 5101701580,
9+
"NumThreads": 8,
10+
"Version": "1.6.8",
11+
"DurationHistogram": {
12+
"Count": 306,
13+
"Min": 0.114543168,
14+
"Max": 0.436206912,
15+
"Sum": 40.422087638,
16+
"Avg": 0.1320983256143791,
17+
"StdDev": 0.03333137761133907,
18+
"Data": [
19+
{
20+
"Start": 0.114543168,
21+
"End": 0.2,
22+
"Percent": 97.38562091503267,
23+
"Count": 298
24+
},
25+
{
26+
"Start": 0.2,
27+
"End": 0.3,
28+
"Percent": 99.34640522875817,
29+
"Count": 6
30+
},
31+
{
32+
"Start": 0.3,
33+
"End": 0.4,
34+
"Percent": 99.67320261437908,
35+
"Count": 1
36+
},
37+
{
38+
"Start": 0.4,
39+
"End": 0.436206912,
40+
"Percent": 100,
41+
"Count": 1
42+
}
43+
],
44+
"Percentiles": [
45+
{
46+
"Percentile": 50,
47+
"Value": 0.15827865104377106
48+
},
49+
{
50+
"Percentile": 75,
51+
"Value": 0.1802902592861953
52+
},
53+
{
54+
"Percentile": 90,
55+
"Value": 0.19349722423164983
56+
},
57+
{
58+
"Percentile": 99,
59+
"Value": 0.28233333333333327
60+
},
61+
{
62+
"Percentile": 99.9,
63+
"Value": 0.42512759692800084
64+
}
65+
]
66+
},
67+
"Exactly": 0,
68+
"Jitter": false,
69+
"RetCodes": {
70+
"200": 306
71+
},
72+
"Sizes": {
73+
"Count": 306,
74+
"Min": 14152,
75+
"Max": 15026,
76+
"Sum": 4356836,
77+
"Avg": 14238.02614379085,
78+
"StdDev": 52.37209101996212,
79+
"Data": [
80+
{
81+
"Start": 14152,
82+
"End": 15026,
83+
"Percent": 100,
84+
"Count": 306
85+
}
86+
],
87+
"Percentiles": null
88+
},
89+
"HeaderSizes": {
90+
"Count": 306,
91+
"Min": 0,
92+
"Max": 0,
93+
"Sum": 0,
94+
"Avg": 0,
95+
"StdDev": 0,
96+
"Data": [
97+
{
98+
"Start": 0,
99+
"End": 0,
100+
"Percent": 100,
101+
"Count": 306
102+
}
103+
],
104+
"Percentiles": null
105+
},
106+
"URL": "https://www.google.com",
107+
"SocketCount": 0,
108+
"AbortOn": 0
109+
}

0 commit comments

Comments
 (0)