简体   繁体   English

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

[英]InfluxDB missing tag value (putInfluxDB nifi processor)

i'm new in InfluxDB, the problem consists in that i have to insert python dicts in InfluxDB via Nifi and i have tried different ways and i allways got the same error telling that tag is missing: 我是InfluxDB的新手,问题在于我必须通过Nifi在InfluxDB中插入python dicts,我尝试了不同的方法,我总是得到同样的错误,告诉标签丢失:

在此输入图像描述

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

Another example: 另一个例子:

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

Another: 另一个:

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

My last try follows this avro schema: 我的最后一次尝试遵循这个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" }
        ]
      } 
    }
  ]
}

And i got the same error using tags and fields simultaneously: 我同时使用标签和字段得到了同样的错误:

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

If the record(point as per InfluxDB terminology) that you are trying to insert into measurement 'sensor' do not have value or has null value for any tags, you will get this error. 如果您尝试插入测量“传感器”的记录(按照InfluxDB术语指向)没有值或任何标记的值为空,则会出现此错误。

I am not sure, why you have almost similar tags and fields for your measurement. 我不确定,为什么你的测量标签和字段几乎相似。 For a point, tag columns are mandatory data and field columns are optional. 对于一个点,标记列是必需数据,字段列是可选的。

Execute following command on influx cli: 在涌入cli上执行以下命令:

show tag keys from sensor;

This will list all tagged columns from your measurement. 这将列出测量中的所有标记列。 Make sure you are passing all those while trying to insert new point. 确保在尝试插入新点时传递所有这些。

In your first example, none of your tags have values. 在第一个示例中,没有任何标记具有值。 In your second example, you are writing a point that has no fields; 在你的第二个例子中,你正在写一个没有字段的点; which is not allowed either. 这也是不允许的。

Your point should look like: 你的观点应该是这样的:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM