Skip to content

Commit

Permalink
encode name and apiid into b64 for use by frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblakeley committed Oct 26, 2018
1 parent 97137b1 commit e50ecff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions analytics.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"encoding/base64"
"fmt"
"net"
"strings"
Expand Down Expand Up @@ -277,9 +278,10 @@ func (r *RedisAnalyticsHandler) recordWorker() {
if !strings.HasPrefix(record.RawPath, "/") {
record.RawPath = "/" + record.RawPath
}
//if tracking path prepend apiid for grouping in aggregate queries
//if tracking path prepend b64 of json containing apiid and api name for grouping in aggregate queries
if record.TrackPath {
record.Path = record.APIID + record.Path
in := `{"api_name":"` + record.APIName + `","apiid":"` + record.APIID + `"}`
record.Path = base64.StdEncoding.EncodeToString([]byte(in)) + record.Path
}

if encoded, err := msgpack.Marshal(record); err != nil {
Expand Down

0 comments on commit e50ecff

Please sign in to comment.