diff --git a/CHANGELOG.md b/CHANGELOG.md index d0f39b695eb..874dbd87be3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -143,6 +143,7 @@ With this release the systemd configuration files for InfluxDB will use the syst - [#7125](https://github.com/influxdata/influxdb/pull/7125): Ensure gzip writer is closed in influx_inspect export - [#7127](https://github.com/influxdata/influxdb/pull/7127): Concurrent series limit - [#7119](https://github.com/influxdata/influxdb/pull/7119): Fix CREATE DATABASE when dealing with default values. +- [#7177](https://github.com/influxdata/influxdb/issues/7177): Fix base64 encoding issue with /debug/vars tags. ## v0.13.0 [2016-05-12] diff --git a/models/points.go b/models/points.go index b9f76d4464b..ba014890a1c 100644 --- a/models/points.go +++ b/models/points.go @@ -3,6 +3,7 @@ package models // import "github.com/influxdata/influxdb/models" import ( "bytes" "encoding/binary" + "encoding/json" "errors" "fmt" "hash/fnv" @@ -1396,6 +1397,22 @@ type Tag struct { Value []byte } +// MarshalJSON implements the json.Marshaler interface. +// +// When Tags are marshalled to a JSON representation it is helpful if they're +// represented as readable strings, rather than the base64 encoded strings which +// are emitted when encoding a []byte. +func (t Tag) MarshalJSON() ([]byte, error) { + var out = struct { + Key string `json:"key"` + Value string `json:"value"` + }{ + Key: string(t.Key), + Value: string(t.Value), + } + return json.Marshal(out) +} + // Tags represents a sorted list of tags. type Tags []Tag