memgraph/tests/integration/telemetry/client.cpp
Matej Ferencevic 44821a918c Initial implementation of telemetry
Summary:
Add telemetry to main memgraph binary

Add resource usage collector

Add telemetry flag

Change telemetry collector logic

Fix utils compilation

Add timestamp

Add first version of interactive test

Started working on test runner

Implement all tests

Flake8 on runner.py

Integrate test with Apollo

Add TODO

Reviewers: buda, teon.banek

Reviewed By: buda, teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1419
2018-06-20 14:49:07 +02:00

31 lines
1023 B
C++

#include <gflags/gflags.h>
#include "telemetry/telemetry.hpp"
DEFINE_string(endpoint, "http://127.0.0.1:9000/",
"Endpoint that should be used for the test.");
DEFINE_int64(interval, 1, "Interval used for reporting telemetry in seconds.");
DEFINE_int64(duration, 10, "Duration of the test in seconds.");
DEFINE_string(storage_directory, "",
"Path to the storage directory where to save telemetry data.");
int main(int argc, char **argv) {
gflags::SetVersionString("telemetry");
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
telemetry::Init();
telemetry::Telemetry telemetry(FLAGS_endpoint, FLAGS_storage_directory,
std::chrono::seconds(FLAGS_interval), 1);
uint64_t counter = 0;
telemetry.AddCollector("db", [&counter]() -> nlohmann::json {
++counter;
return {{"vertices", counter}, {"edges", counter}};
});
std::this_thread::sleep_for(std::chrono::seconds(FLAGS_duration));
return 0;
}