{"action":"created","issue":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/2696","labels_url":"https://api.github.com/repos/influxdb/influxdb/issues/2696/labels{/name}","comments_url":"https://api.github.com/repos/influxdb/influxdb/issues/2696/comments","events_url":"https://api.github.com/repos/influxdb/influxdb/issues/2696/events","html_url":"https://github.com/influxdb/influxdb/pull/2696","id":82536624,"number":2696,"title":"Line protocol write API","user":{"login":"jwilder","id":219935,"avatar_url":"https://avatars.githubusercontent.com/u/219935?v=3","gravatar_id":"","url":"https://api.github.com/users/jwilder","html_url":"https://github.com/jwilder","followers_url":"https://api.github.com/users/jwilder/followers","following_url":"https://api.github.com/users/jwilder/following{/other_user}","gists_url":"https://api.github.com/users/jwilder/gists{/gist_id}","starred_url":"https://api.github.com/users/jwilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwilder/subscriptions","organizations_url":"https://api.github.com/users/jwilder/orgs","repos_url":"https://api.github.com/users/jwilder/repos","events_url":"https://api.github.com/users/jwilder/events{/privacy}","received_events_url":"https://api.github.com/users/jwilder/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-05-29T18:33:42Z","updated_at":"2015-05-29T21:31:12Z","closed_at":"2015-05-29T20:38:13Z","pull_request":{"url":"https://api.github.com/repos/influxdb/influxdb/pulls/2696","html_url":"https://github.com/influxdb/influxdb/pull/2696","diff_url":"https://github.com/influxdb/influxdb/pull/2696.diff","patch_url":"https://github.com/influxdb/influxdb/pull/2696.patch"},"body":"This PR adds a new write HTTP endpoint (`/write_points`) that uses a text based line protocol instead of JSON.  The protocol is a list of points separated by newlines `\\n`.  \r\n\r\nEach point is composed of three blocks separated by whitespace.  The first block is the measurement name and tags separated by commas.  The second block is fields separated by commas. The last block is optional and is the timestamp for the point as a unix epoch in nanoseconds. \r\n\r\n```\r\nmeasurement[,tag=value,tag2=value2...] field=value[,field2=value2...] [unixnano]\r\n```\r\n\r\nEach point must have a measurement name.  Tags are optional.  Measurement, tag and values can not have any spaces.  If the value contains a comma, it needs to be escaped with `\\,`.\r\n\r\nEach point must have at least one value.  The format of a field is `name=value`.  Fields can be one of four types: integer, float, boolean or string.  Integers are all numeric and cannot have a decimal point `.`.  Floats are all numeric and must have a decimal point.  Booleans are the values `true` and `false`.  Strings must be surrounded by double-quores `\"`.  If the value contains a quote, it must be escaped `\\\"`.  There can be no spaces between consecutive field values.\r\n\r\nFor example,\r\n```\r\ncpu,host=serverA,region=us-west value=1.0 10000000000\r\ncpu,host=serverB,region=us-west value=3.3 10000000000\r\ncpu,host=serverB,region=us-east user=123415235,event=\"overloaded\" 20000000000\r\nmem,host=serverB,regstion=us-east swapping=true 2000000000\r\n```\r\n\r\nPoints written in this format should be sent to the `/write_points` endpoint.  The request should be a `POST` with the points in the body of the request.  The content can also be `gzip` encoded.\r\n\r\nThe following URL params may also be sent:\r\n* `db`: _required_ The database to write points\r\n* `rp`: _optional_ The retention policy to write points.  If not specified, the default retention policy will be used.\r\n* `precision`: _optional_ The precision of the time stamps (`n`, `u`, `ms`, `s`,`m`,`h`).  If not specified, `n` is used.\r\n* `consistency`: _optional_ The write consistency level required for the write to succeed.  Can be one of `one`, `any`, `all`,`quorum`.  Defaults to `all`.\r\n* `u`: _optional_ The username for authentication\r\n* `p`: _optional_ The password for authentication \r\n \r\nA successful response to the request will return a `204`.  If a parameter or point is not valid, a `400` will be returned.  \r\n\r\n----\r\n### PR Notes:\r\n\r\nThe parser has been tuned to minimize allocations and extra work during parsing.  For example, the raw byte slice read in is held onto as much as possible until there is a need to modify it.  Similarly, values are not unmarshaled into Go types until necessary.  It also tries to validate the input using a single pass over the data as much as possible.   Tags need to be sorted so it is preferable to send them in already sorted to avoid sorting on the server.  The sort has been tuned as well so that it performs consistently over a large range of inputs.\r\n\r\nMy local benchmarks have parsing performing around 750k-2m/points/sec depending on the shape of the point data.  "},"comment":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/comments/106940920","html_url":"https://github.com/influxdb/influxdb/pull/2696#issuecomment-106940920","issue_url":"https://api.github.com/repos/influxdb/influxdb/issues/2696","id":106940920,"user":{"login":"pauldix","id":4331,"avatar_url":"https://avatars.githubusercontent.com/u/4331?v=3","gravatar_id":"","url":"https://api.github.com/users/pauldix","html_url":"https://github.com/pauldix","followers_url":"https://api.github.com/users/pauldix/followers","following_url":"https://api.github.com/users/pauldix/following{/other_user}","gists_url":"https://api.github.com/users/pauldix/gists{/gist_id}","starred_url":"https://api.github.com/users/pauldix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pauldix/subscriptions","organizations_url":"https://api.github.com/users/pauldix/orgs","repos_url":"https://api.github.com/users/pauldix/repos","events_url":"https://api.github.com/users/pauldix/events{/privacy}","received_events_url":"https://api.github.com/users/pauldix/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T21:31:12Z","updated_at":"2015-05-29T21:31:12Z","body":"@gunnaraasen Those rules don't quite make sense for the line format mainly because this is so strict we know where the tag keys vs tag values are. The query language is much more flexible so it has more limitations.\r\n\r\nRequiring double quotes around the identifiers (meaurement names, tag keys, and field keys) would be unnecessary for the line protocol for writing and would bloat the message."}}