influxdb-client-java icon indicating copy to clipboard operation
influxdb-client-java copied to clipboard

Escaping issue with tag values

Open oliverrahner opened this issue 1 year ago • 2 comments
trafficstars

This issue occurs in our case because a user has entered specific meta data fields as just \. According to the Influx docs, \ does not need to be escaped, but may be. In our case, however, the backslash is followed with a comma, because it is at the end of the tag value, followed by another tag value, leading to messed up interpretation of the whole record.

In my opinion, the safest way to handle this is to always escape backslashes.

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

  1. Create as List<> with at least one tag containing just a backslash \
  2. Write this list to InfluxDB using client.getWriteApiBlocking().writeMeasurements(WriteParameters.DEFAULT_WRITE_PRECISION, myList);

Expected behavior: Data would be inserted correctly.

Actual behavior: Influx returns: HTTP status code: 400; Message: unable to parse 'metrics,account.companyName=\,account.contactCity=\ [...]

Specifications:

  • Client Version: 6.7.0
  • InfluxDB Version: 3.7
  • JDK Version: 17
  • Platform: Linux/Docker/openjdk:17-alpine

oliverrahner avatar May 23 '24 11:05 oliverrahner