Skip to content

Commit

Permalink
add support for labels
Browse files Browse the repository at this point in the history
Signed-off-by: MUzairS15 <[email protected]>
  • Loading branch information
MUzairS15 committed Jun 15, 2023
1 parent c0a1862 commit 6ca1326
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/client/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nighthawk
import (
"errors"
"fmt"
"strings"
"time"

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

out, err := protojson.Marshal(resFortio)
out, err := protojson.MarshalOptions{
EmitUnpopulated: true,
}.Marshal(resFortio)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 6ca1326

Please sign in to comment.