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.

tags with value 0 or False not pushed to InfluxDB #769

@michelfripiat

Description

@michelfripiat

When I want to push tags with value equaling to 0 or False, the tag is not accepted.
After investigation, the line to blame is here:

[",{}={}".format(k, _escape_tag(v)) if v else ''

I patched it and here is how I solved it:
Before:
tag_string = ''.join( [",{}={}".format(k, _escape_tag(v)) if v else '' for k, v in sorted(global_tags.items())] )
After:
tag_string = ''.join( [",{}={}".format(k, _escape_tag(v)) if v not in [None, ''] else '' for k, v in sorted(global_tags.items())] )

Furthermore, it would be nice to also send a tags even if the value is None. Here is my proposition:
tag_string = ''.join( [",{}={}".format(k, _escape_tag(v)) if v not in [None, ''] else ",{}={}".format(k, 'None') for k, v in sorted(global_tags.items())] )

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