influxdata / influxdata/influxdb-client-java
Escaping issue with tag values
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 477
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at client.getWriteApiBlocking().writeMeasurements(...) and reproduce the failure with a tag value containing only a backslash, followed by another tag. Trace how that measurement is serialized before the request is sent, then verify that the resulting record is accepted by InfluxDB and add coverage for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100