Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Cryptic error a tag contains a newline #632

Closed
salty-horse opened this issue Aug 21, 2018 · 0 comments
Closed

Cryptic error a tag contains a newline #632

salty-horse opened this issue Aug 21, 2018 · 0 comments

Comments

@salty-horse
Copy link

Using influxdb package version 5.2.0.

When calling write_points with a tag string that contains a newline, the client fails on an error that doesn't mention the tag:

from influxdb import InfluxDBClient
json_body = [
    {
        "measurement": "cpu_load_short",
        "tags": {
            "host": "server01",
            "region": "us-west\n" # Note the newline here
        },
        "time": "2009-11-10T23:00:00Z",
        "fields": {
            "value": 0.64
        }
    }
]
client = InfluxDBClient('localhost', 8086, 'root', 'root', 'example')
client.create_database('example')
client.write_points(json_body)

InfluxDBClientError: 400: {"error":"unable to parse 'cpu_load_short,host=server01,region=us-west': missing fields\nunable to parse 'value=0.64 1257894000000000000': invalid field format"}

Note that the error doesn't mention the newline at all.

If a newline is legal in a tag name, it may be serializing the command to influx incorrectly. If a newline isn't legal, the error should be clearer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants