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

Copy an Batch tags to each point before marshalling #3131

Merged
merged 1 commit into from
Jun 25, 2015

Conversation

evanphx
Copy link
Contributor

@evanphx evanphx commented Jun 24, 2015

This is to fix influxdata/telegraf#18. The switch away from JSON to the line protocol broke passing the tags specified in BatchPoints.

@@ -124,11 +124,15 @@ func (c *Client) Write(bp BatchPoints) (*Response, error) {

var b bytes.Buffer
for _, p := range bp.Points {
if p.Raw != "" {
if p.Raw != "" && len(bp.Tags) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly sure what Raw is but I think Raw and BatchPoints.Tags can't really be used together unless we parse the Raw value and add the tags to it. If you set Raw and have BatchPoints.Tags, I believe the write will fail because the Raw value will not be marshaled... only the BatchPoints.Tags.

Is that intended by this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no, it wasn't. I figured Raw was there if the Point had previously been marshaled here and the other data was also available. If it's the case that Raw might be the only thing set, we could either ignore BatchPoint.Tags or parse and re-emit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove that line?

Seems a different fix for Raw lines is needed and I'm not sure that the client should really have a Raw field to begin with.

@evanphx
Copy link
Contributor Author

evanphx commented Jun 25, 2015

@jwilder ok, I removed the check added to the p.Raw check.

@jwilder
Copy link
Contributor

jwilder commented Jun 25, 2015

👍

jwilder added a commit that referenced this pull request Jun 25, 2015
Copy an Batch tags to each point before marshalling
@jwilder jwilder merged commit bf89b17 into influxdata:master Jun 25, 2015
jwilder added a commit that referenced this pull request Jun 25, 2015
@jwilder jwilder mentioned this pull request Jun 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tags no longer passed in due to change in Client
2 participants