-
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
[0.9.0-rc31] Unable to write point #2679
Comments
@JauntyWard can you send us an example of the code you're using? |
@toddboom Sure, below is an example of my code. Thanks. type bucket struct {
Name string
Timestamp string
Tags map[string]string
Fields map[string]interface{}
}
func writeInfluxDB(buckets []bucket, influxConnection *client.Client, config influxDBConfig) {
var (
points = make([]client.Point, len(buckets))
pointsIndex = 0
)
for k := range buckets {
bucket := buckets[k]
points[pointsIndex] = client.Point{
Measurement: bucket.Name,
Tags: bucket.Tags,
Fields: bucket.Fields,
Time: time.Now(),
}
pointsIndex++
}
pointsBatch := client.BatchPoints{
Points: points,
Database: config.influxDatabase,
RetentionPolicy: "default",
}
_, err := influxConnection.Write(pointsBatch)
if err != nil {
fmt.Println(err)
}
} |
I don't know if this is related, but I cannot write points on Writing this does not work:
But this works:
|
@aviau there's a syntax error in your examples, the correct spelling is measurement, not measurment. It's wrong in both snippets, but the lack of a measurement name should render a point invalid, as the database has no way of determining to which series the point belongs. I cannot explain why the second JSON block would be accepted as a valid point. |
For me, both of the examples from @aviau with measurement spelled correctly (or indeed spelled incorrectly) yields a result of "400: {"error":"json: cannot unmarshal object into Go value of type []client.Point"}" If, however, I am to use the following JSON:
The result is "500: {"error":"bucket name required"}". However if I change measurement to name. It writes successfully. |
Wierd. Using ''name'' works. |
Given the write path changes between RC31 and RC32 I think we can close this issue. Please re-test with the impending RC33. |
Using the Go Influx API and Influx 0.9 rc31 I am unable to write points to the database. When using code adapted from the API documentation, the following error occurs on the write:
What am I doing wrong?
The text was updated successfully, but these errors were encountered: