Query: Batch Write and Tags
Timmwardion opened this issue · 1 comments
I seem to be having some challenges with tags and I wanted to check that my understanding is correct. Basically I'd like to use tags to push some metadata regarding sensor readings to influx (seems simple right?)
Challenge is that when writing in batch mode tags seem to be persistent . That is the ideal way to go is to:
Setup client
Setup tags
Loop->Do the measurements and push to batch via fields
Clear Fields
Batch clears when buffer is full.
However I want to do this:
Setup client
Do the measurements and add some things to tags and others to fields push both to batch
Clear fields and tags
Batch clears when buffer is full.
However - if I add tags in the loop (so to speak) clearTags seems to clear ALL the tags and the upload fails, if I don't clear tags after each loop they just aggregate and the upload fails.
@Timmwardion, exactly, tags are good for metadata and moreover, they are indexed and can be part of a query condition.
In this client, tags cannot be overwritten, they are just added and if a tag needs to be changed, it needs to be cleared.
However, if you need to change a tag regularly, maybe it should be a field.
You can also leverage the default tags feature, where specified tags are added to each point automatically.
You can get an error, when there is a duplicate tag. However, tags are not mandatory. You will get an error if there is no field.
If you are referring to an error, don't be shy to post the error here.