influxdata / influxdata/influxdb-client-java

Escaping issue with tag values

Aperta
#718 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Java
Stelle
477
Fork
129
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Parti da client.getWriteApiBlocking().writeMeasurements(...) e riproduci il fallimento con un valore di tag contenente solo una barra rovesciata, seguito da un altro tag. Traccia come viene serializzata quella misurazione prima dell’invio della richiesta, quindi verifica che il record risultante venga accettato da InfluxDB e aggiungi la copertura per questo caso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api, databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.