influxdata / docs-v2

InfluxData Documentation that covers InfluxDB Cloud, InfluxDB OSS 2.x, InfluxDB OSS 1.x, InfluxDB Enterprise, Telegraf, Chronograf, Kapacitor, and Flux.
https://docs.influxdata.com
MIT License
73 stars 272 forks source link

Docs on what are valid field and tag key names #2366

Open nathanielc opened 3 years ago

nathanielc commented 3 years ago

We do not have (or at least I could not find) any docs on what characters we allow as field and tag keys.

The answer depends on a combination of both line protocol and Flux as those are the systems used to write and read the data.

Flux allows for any valid printable utf-8 sequence for a field or tag key. The syntax is r["any string with dots. or other utf-8 chars" ]. For line protocol I believe it is the same but I would double check with @rogpeppe.

It would be helpful to have a single place where this is discussed directly so users do not have to do the investigation themselves of the detailed specs for both line protocol and Flux. For example here are the relevant bits for Flux https://docs.influxdata.com/influxdb/cloud/reference/flux/language/expressions/#member-expressions

rogpeppe commented 3 years ago

See https://docs.google.com/document/d/1GCGgg6EcW8bPyVhLsS9L6kvEyC8S5_T0tbcomfF3FxI/edit#heading=h.eoqai6zdn7v3 for some details of restrictions. I've suggested a less restrictive definition of "printable" there, including only non-printable ASCII in the definition but allowing any value non-ASCII unicode character. This is less pure but much more efficient to check :)

One line-protocol restriction you haven't mentioned there: you can't have a backslash as the last character of a field key, tag key or tag value.