influxdb-cxx | InfluxDB C++ client library | Video Game library
kandi X-RAY | influxdb-cxx Summary
kandi X-RAY | influxdb-cxx Summary
Fork of the unmaintained project.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of influxdb-cxx
influxdb-cxx Key Features
influxdb-cxx Examples and Code Snippets
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086?db=test");
// Write batches of 100 points
influxdb->batchOf(100);
for (;;) {
influxdb->write(influxdb::Point{"test"}.addField("value", 10));
}
auto influxdb = influxdb::I
project(example)
find_package(InfluxDB)
add_executable(example-influx main.cpp)
target_link_libraries(example-influx PRIVATE InfluxData::InfluxDB)
project(example)
add_subdirectory(influxdb-cxx)
add_executable(example-influx main.cpp)
target_link_
// Provide complete URI
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086?db=test");
influxdb->write(influxdb::Point{"test"}
.addField("value", 10)
.addTag("host", "localhost")
);
Community Discussions
Trending Discussions on influxdb-cxx
QUESTION
I use a c++ library influxdb-cxx which uses curl to insert data into the database. In my c++ program, I will write 4 measurements and each of them has dozens of pieces points to insert per second. I use UDP to send data
...ANSWER
Answered 2021-Aug-11 at 16:22I would not use InfluxDB to work with data from last 500ms. This software is not for solutions like that. InfluxDB has no priority to put all values in defined time. It is not a real time system. If you need something like that I would suggest PLC type device which are real time. But... If you want to use it that way so much I can suggest following tricky solutions:
- Ask for data which is not newer than, for example 400ms:
SELECT last(*) FROM "udp".."/controller/data" WHERE time >= now() - 10s and time<=now()-400ms
Assuming that after 400ms you have values in all fields. 3) Ask for data with safe delay, for example 500ms:
SELECT first(*) FROM "udp".."/controller/data" WHERE time >= now() - 500ms
Query above should give you first value before 500ms from now. Assuming that after little less than 500ms is needed to have all field values written.
- Ask for data using where cluase for all value fields in way it will always be true if there will be only data there:
SELECT * FROM "udp".."/controller/data" WHERE time >= now() - 5s and "angular">-9999999 and "speed_left_rear">-9999999 and "speed_right_rear">-9999999"> and "voltage">-9999999 limit 1
All above assuming that you cannot read values lower than -9999999. This way you should receive only series that has all values written and is not older than 5s. Values you would get are the newest that have the same timestamp with all values written.
and 2) solution may work or not work in some conditions with assumed delays (it depends on system workload etc.). 3) might be the best solution if you need values all with the same timestamp.
One more way is to make 4 independent queries where you query for last values:
SELECT last(angular) FROM "udp".."/controller/data" SELECT last(speed_left_rear) FROM "udp".."/controller/data" SELECT last(speed_right_rear) FROM "udp".."/controller/data" SELECT last(voltage) FROM "udp".."/controller/data"
- Or even ask for it in subqueries:
Select * from (SELECT last(angular) as "angular" FROM "udp".."/controller/data"),(SELECT last(speed_left_rear) as "speed_left_rear" FROM "udp".."/controller/data"),(SELECT last(speed_right_rear) as "speed_right_rear" FROM "udp".."/controller/data"),(SELECT last(voltage) as "voltage" FROM "udp".."/controller/data")
It will give you the latest values but they might not have the same timestamp.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install influxdb-cxx
C++17 compiler
CURL (required)
boost 1.57+ (optional – see Transports)
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page