From 6ca13267522891a43e8eeba5057aebe7361cbd3e Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Thu, 15 Jun 2023 23:22:55 +0530 Subject: [PATCH] add support for labels Signed-off-by: MUzairS15 --- pkg/client/transform.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/client/transform.go b/pkg/client/transform.go index d975fe1e..c48b9e9c 100644 --- a/pkg/client/transform.go +++ b/pkg/client/transform.go @@ -3,6 +3,7 @@ package nighthawk import ( "errors" "fmt" + "strings" "time" nighthawk_client "github.com/layer5io/nighthawk-go/pkg/proto" @@ -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() @@ -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 }