influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

write_lp HTTP API

Open pauldix opened this issue 2 years ago • 0 comments

The v3 write API should be a POST to /api/v3/write_lp. There is a shell of this already in #24552. The parameters it should take are db, precision, accept_partial. Precision and token are optional. A bearer token can be provided via the Authorization header.

If precision is not supplied, when the line protocol is parsed, the server should guess at the precision of each line assuming that the passed in timestamp should be roughly around now. Thus it could accept second, millisecond, microsecond, and nanosecond and have the time be around now.

The accept_partial parameter specifies that the server should write any lines that are valid and return errors for any lines that are invalid. This defaults to true. If false, any invalid line will cause the entire request to error with no lines written. In either case, if there are any invalid lines, the server should return a 400.

The behavior behind this endpoint(some of this logic will reside in the buffer):

  • Validate the db name contains only numbers, letters, underscores and hyphens. Must start with either a number or letter.
  • Optionally take precision, with a default of auto
  • Optionally take a bearer token (don't have to wire up auth as part of this issue)
  • Create a database in the buffer if it doesn't exist
  • Limit the number of databases to 5 (this is a hard limit, not user configurable)
  • Limit the total number of tables across all databases to 2,000
  • Limit the number of columns on any table to 500 (hard limit, not user configurable)
  • Return an error JSON with any invalid lines

Invalid lines should not be written to the WAL (if a WAL is configured).

pauldix avatar Jan 08 '24 01:01 pauldix