influxdata / influxdata/influxdb-client-java

Escaping issue with tag values

未关闭
#718 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement
主要语言
Java
星标
477
派生
129
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 client.getWriteApiBlocking().writeMeasurements(...) 开始,使用仅包含一个反斜杠的 tag 值,后面再跟随另一个 tag,复现该失败。跟踪该 measurement 在发送请求之前是如何序列化的,然后验证生成的 record 能被 InfluxDB 接受,并为此情况添加覆盖测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api, databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。