From 41fb325372034c7a42bf0157cdc08894d8371247 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 2 Jul 2020 13:29:45 +0100 Subject: send $line base64 encoded over the wire --- internal/mapr/client/aggregate.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'internal/mapr/client/aggregate.go') diff --git a/internal/mapr/client/aggregate.go b/internal/mapr/client/aggregate.go index 1272a19..fd3a899 100644 --- a/internal/mapr/client/aggregate.go +++ b/internal/mapr/client/aggregate.go @@ -1,6 +1,7 @@ package client import ( + "encoding/base64" "strconv" "strings" @@ -35,7 +36,7 @@ func (a *Aggregate) Aggregate(parts []string) { groupKey := parts[0] samples, err := strconv.Atoi(parts[1]) if err != nil { - logger.FatalExit(parts, err) + logger.FatalExit("Unable to parse sample count", parts[1], err, parts) } fields := a.makeFields(parts[2:]) set := a.group.GetSet(groupKey) @@ -74,6 +75,15 @@ func (a *Aggregate) makeFields(parts []string) map[string]string { if len(kv) != 2 { continue } + if kv[0] == "$line" { + decoded, err := base64.StdEncoding.DecodeString(kv[1]) + if err != nil { + logger.Error("Unable to decode $line", kv[1], err) + continue + } + fields[kv[0]] = string(decoded) + continue + } fields[kv[0]] = kv[1] } -- cgit v1.2.3