-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Conversation
@@ -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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@jwilder ok, I removed the check added to the |
👍 |
Copy an Batch tags to each point before marshalling
This is to fix influxdata/telegraf#18. The switch away from JSON to the line protocol broke passing the tags specified in BatchPoints.