gpt4 book ai didi

python - InfluxDB 缺少标签值(putInfluxDB nifi 处理器)

转载 作者:行者123 更新时间:2023-11-28 16:58:03 26 4
gpt4 key购买 nike

我是 InfluxDB 的新手,问题在于我必须通过 Nifi 在 InfluxDB 中插入 python 字典,我尝试了不同的方法,但我总是遇到同样的错误,告诉我标签丢失了:

enter image description here

org.influxdb.InfluxDBException: {
"error": "unable to parse '[
{
"measurement": "sensor",
"time": 1559560006,
"tags": [
"sensor",
"id",
"date",
"info",
"aleatory_number",
"aleatory_number_square_root"
],
"fields": {
"id": 8,
"date": 1559559961002,
"info": "info sensor8",
"aleatory_number": 1778687859,
"aleatory_number_square_root": 42174.492
}
}
]': missing tag value"
}

另一个例子:

{
"error":"unable to parse
'[{
"measurement":"sensor",
"time":1559630455,
"tags":{"test_tag":"test"},
"fields":{}
}]'
: missing tag value"
}

另一个:

org.influxdb.InfluxDBException: 
{
"error":"unable to parse
'[{
"measurement":"sensor",
"time":1559631341,
"tags":{},
"fields":{}
}]'
: missing tag value"}

我最后一次尝试遵循这个 avro 模式:

{
"type": "record",
"name": "preprocessed_value",
"fields": [
{ "name": "measurement", "type": "string" },
{ "name": "time", "type": "long" },
{ "name": "tags", "type": { "type":"map", "values" : "string"} },
{
"name" : "fields" ,
"type" : {
"name" : "PythonDict",
"type" : "record",
"fields": [
{ "name": "id", "type": "int" },
{ "name": "date", "type": "long" },
{ "name": "info", "type": "string" },
{ "name": "aleatory_number", "type": "long" },
{ "name": "aleatory_number_square_root", "type": "float" }
]
}
}
]
}

我同时使用标签和字段时遇到了同样的错误:

org.influxdb.InfluxDBException: {"error":"unable to parse 
'[{
"measurement":"sensor",
"time":1559720142,
"tags":{"test_tag":"test"},
"fields":{
"id":3,
"date":1559718332366,
"info":"info sensor3",
"aleatory_number":141969819,
"aleatory_number_square_root":11915.108
}
}]': missing tag value"}

最佳答案

如果您尝试插入测量“传感器”的记录(根据 InfluxDB 术语的点)没有值或任何标签的值为空,您将收到此错误。

我不确定,为什么您的测量具有几乎相似的标签和字段。对于一个点,标签列是必填数据,字段列是可选的。

在 influx cli 上执行以下命令:

show tag keys from sensor;

这将列出您的测量中所有标记的列。确保在尝试插入新点时传递所有这些。

关于python - InfluxDB 缺少标签值(putInfluxDB nifi 处理器),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56426288/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com