Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/debug/vars endpoint returns base64 encoded strings #7177

Closed
e-dard opened this issue Aug 19, 2016 · 12 comments · Fixed by #7187
Closed

/debug/vars endpoint returns base64 encoded strings #7177

e-dard opened this issue Aug 19, 2016 · 12 comments · Fixed by #7187
Assignees
Milestone

Comments

@e-dard
Copy link
Contributor

e-dard commented Aug 19, 2016

#6964 introduced a new statistics implementation that uses []byte for tag keys and values. []byte is base64 encoded by Go's JSON encoder.

/debug/vars now looks like:

{
  "database:_internal": {
    "name": "database",
    "tags": [
      {
        "key": "ZGF0YWJhc2U=",
        "value": "X2ludGVybmFs"
      }
    ],
    "values": {
      "numMeasurements": 12,
      "numSeries": 79
    }
  }
}

The short-term fix is to add a custom json.Marshaler implementation to models.Tags, but I think we should also figure out if we really need to be going through all the extra work involved in using a sorted models.Tags.

From a cursory glance of the statistics stuff it seems we could just have a map[string]string to represent the tags associated with a Statistics object.

@e-dard
Copy link
Contributor Author

e-dard commented Aug 19, 2016

@sparrc @jsternberg

@jwilder
Copy link
Contributor

jwilder commented Aug 19, 2016

Have you verified this occurs in 1.0 branch? I think sorted tags stuff is only in master.

@e-dard
Copy link
Contributor Author

e-dard commented Aug 19, 2016

I have not. I will check and then bump change log to 1.1 if it's not a 1.0
problem.

On Friday, 19 August 2016, Jason Wilder notifications@github.com wrote:

Have you verified this occurs in 1.0 branch? I think sorted tags stuff is
only in master.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#7177 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAeo6QOV0iM2z8ejYFz8Dbf08MQ_TSLeks5qhcBGgaJpZM4JoW1s
.

Edd Robinson
InfluxDB Engineer
▼▴

InfluxData.com http://influxdata.com/

Github http://www.github.com/e-dard / LinkedIn
https://www.linkedin.com/in/eddrobinson / Personal http://eddrobinson.io

@sparrc
Copy link
Contributor

sparrc commented Aug 19, 2016

@jsternberg what is the reason behind the tags being a slice of maps of Key/Value pairs? Previously Telegraf could marshal influxdb points out of the /debug/vars endpoint that look more-or-less like JSON influxdb points:

type point struct {
    Name   string                 `json:"name"`
    Tags   map[string]string      `json:"tags"`
    Values map[string]interface{} `json:"values"`
}

Is it possible to revert Tags to being a simple map?

e-dard added a commit that referenced this issue Aug 19, 2016
@jwilder
Copy link
Contributor

jwilder commented Aug 19, 2016

@sparrc Could this be related to #7138?

@sparrc
Copy link
Contributor

sparrc commented Aug 19, 2016

it does appear to be related to that, although I'm not sure I fully understand how that has made it's way into the /debug/vars output. Are we now going to return the above type from the query language as well (tags as a list of key/val pairs)? And if not, maybe we should be marshaling the /debug/vars JSON into the more user-friendly format

@jwilder
Copy link
Contributor

jwilder commented Aug 19, 2016

No. It was only supposed to change how the tags were stored internally.

@jwilder
Copy link
Contributor

jwilder commented Aug 19, 2016

From a cursory glance of the statistics stuff it seems we could just have a map[string]string to represent the tags associated with a Statistics object.

@e-dard I agree. That might be the simplest thing to do to fix this. I think the switch to slice of key/values in the output was unintended.

@e-dard
Copy link
Contributor Author

e-dard commented Aug 19, 2016

@jwilder the real question here is "do tags need to be sorted in /debug/vars output?"

I think the answer to that is no, in which case we're not only doing extra work converting between strings and []bytes, we're also do more work by keeping tags sorted.

@e-dard
Copy link
Contributor Author

e-dard commented Aug 19, 2016

@jwilder OK. I can update #7179 to just use map[string]string for tags in statistics.

@jwilder
Copy link
Contributor

jwilder commented Aug 19, 2016

In the output of /debug/vars, no. They used to be a map. Tags do need to be sorted for other reasons though.

@jwilder jwilder added this to the 1.1.0 milestone Aug 19, 2016
@e-dard
Copy link
Contributor Author

e-dard commented Aug 19, 2016

Yeah I'm only referring to /debug/vars 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants