Skip to content

Commit 4344ab1

Browse files
author
Mohd Uzair
authored
Merge pull request #304 from MUzairS15/transform
add support for labels
2 parents c0a1862 + 6ca1326 commit 4344ab1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/client/transform.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package nighthawk
33
import (
44
"errors"
55
"fmt"
6+
"strings"
67
"time"
78

89
nighthawk_client "github.com/layer5io/nighthawk-go/pkg/proto"
@@ -20,7 +21,7 @@ func Transform(res *nighthawk_client.ExecutionResponse) ([]byte, error) {
2021
if workers = len(res.Output.Results); workers != 1 {
2122
workers--
2223
}
23-
// TODO resFortio.Label
24+
resFortio.Labels = strings.Join(res.Output.GetOptions().GetLabels(), " ")
2425
resFortio.Version = res.Output.GetVersion().GetVersion().String()
2526
resFortio.StartTime = res.Output.GetTimestamp()
2627
resFortio.RequestedQPS = uint32(workers) * res.Output.Options.RequestsPerSecond.GetValue()
@@ -63,7 +64,9 @@ func Transform(res *nighthawk_client.ExecutionResponse) ([]byte, error) {
6364
resFortio.HeaderSizes = renderFortioDurationHistogram(statistic)
6465
}
6566

66-
out, err := protojson.Marshal(resFortio)
67+
out, err := protojson.MarshalOptions{
68+
EmitUnpopulated: true,
69+
}.Marshal(resFortio)
6770
if err != nil {
6871
return nil, err
6972
}

0 commit comments

Comments
 (0)