InfluxDB缺少标记值(putinfuxdb nifi处理器)

2024-09-30 06:18:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我是InfluxDB中的新成员,问题在于我必须通过Nifi在InfluxDB中插入python dicts,我尝试了不同的方法,但总是收到相同的错误,提示标记丢失:

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"
} 

另一个例子:

^{pr2}$

另一个:

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"}

Tags: nameinfoidnumberfieldsdatetimetag
2条回答

如果您试图插入测量'sensor'的记录(根据InfluxDB术语)没有值或任何标记的值为空,则会出现此错误。在

我不知道,为什么你有几乎相似的标签和字段,你的测量。对于一个点,标记列是必需的数据,字段列是可选的。在

在inflix cli上执行以下命令:

show tag keys from sensor;

这将列出度量中的所有标记列。确保您在尝试插入新点时通过了所有这些。在

在第一个示例中,没有任何标记具有值。在第二个示例中,您正在编写一个没有字段的点;这也是不允许的。在

你的观点应该是:

{
    "measurement":"sensor",
    "time":1559630455,
    "tags":{"test_tag":"test"},
    "fields":{"some_field": 1}
}

相关问题 更多 >

    热门问题