You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In BoostSupport.cxx queryImpl(), the response to the query (const auto response = transport->query(querty);) returns a JSON string and then loaded into a ptree.
so, all field data is represented as a string in the ptree.
The decision was made to make all strings found in fields into tags. The original tags if any are marked as such in the incoming data so they should be preserved that way in the reconstructed point. String data in fields are still fields and should not be added as tags.
so.....
at line 58 insert:
Point point{series.second.getstd::string("name", "")};
// add the tags if they exist
for (auto &tag : series.second.get_child("tags"))
{
std::string tagName = tag.first;
std::string tagValue = tag.second.data();
point.addTag(tagName, tagValue);
}
// add the field data
When adding fileds, don't assume a double - Influx is flexible - data could be int or float or string as well. The code could try to determine the type by doing some range/format checking(int/long/float/double/string) and doing the conversion here. I would suggest leaving it as a string representation and letting the user do the required conversion.
Change line 76 from:
point.addField(column, boost::lexical_cast(value));
to:
point.addField(column, value); *** See ticket 115
Don't assume string data is automatically a tag.
Remove line 80: point.addTag(column, value);
in it's place add a warning to cout saying field could not be added:
std::cout << Error adding field to point - Column: " << column << " Value: " << value << std::endl;
The text was updated successfully, but these errors were encountered:
In BoostSupport.cxx queryImpl(), the response to the query (const auto response = transport->query(querty);) returns a JSON string and then loaded into a ptree.
so, all field data is represented as a string in the ptree.
The decision was made to make all strings found in fields into tags. The original tags if any are marked as such in the incoming data so they should be preserved that way in the reconstructed point. String data in fields are still fields and should not be added as tags.
so.....
at line 58 insert:
Point point{series.second.getstd::string("name", "")};
// add the tags if they exist
for (auto &tag : series.second.get_child("tags"))
{
std::string tagName = tag.first;
std::string tagValue = tag.second.data();
point.addTag(tagName, tagValue);
}
// add the field data
When adding fileds, don't assume a double - Influx is flexible - data could be int or float or string as well. The code could try to determine the type by doing some range/format checking(int/long/float/double/string) and doing the conversion here. I would suggest leaving it as a string representation and letting the user do the required conversion.
Change line 76 from:
point.addField(column, boost::lexical_cast(value));
to:
point.addField(column, value); *** See ticket 115
Don't assume string data is automatically a tag.
Remove line 80: point.addTag(column, value);
in it's place add a warning to cout saying field could not be added:
std::cout << Error adding field to point - Column: " << column << " Value: " << value << std::endl;
The text was updated successfully, but these errors were encountered: