Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
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

Description

@salty-horse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions