Skip to content

Commit

Permalink
Merge pull request #304 from MUzairS15/transform
Browse files Browse the repository at this point in the history
add support for labels
  • Loading branch information
Mohd Uzair authored Jun 15, 2023
2 parents c0a1862 + 6ca1326 commit 4344ab1
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 4344ab1

Please sign in to comment.