cjgdev / riemannpp Goto Github PK
View Code? Open in Web Editor NEWRiemann C++ Client
Home Page: http://riemann.io/
License: MIT License
Riemann C++ Client
Home Page: http://riemann.io/
License: MIT License
The following code will result in a SIGSEGV:
riemann::event e;
riemann::message msg(std::move(e)); // Responsible
riemannpp version 0.1.0
protobuf-c 1.3.1
libprotoc 3.6.1
riemann-0.3.1
when I uses ( riemannpp send -s ok -S "client service" -D "simple cli command" ) this command it is working fine but it does not reflect in riemann log file or dashboard
The following code will result in a SIGSEGV:
rpp::event e;
e.attribute_add(rpp::attribute("x-client", "riemannpp")); // Responsible for causing the fault
rpp::client client(type, "localhost", 5555);
client << std::move(e); // SIGSEGV
#include <riemannpp/riemannpp.hpp>
#include
namespace rpp = riemannpp;
using namespace std;
int main() {
try {
rpp::client client(rpp::client_type::tcp, "localhost", 5555);
rpp::event e;
e << make_tuple(rpp::event_field::host, "localhost")
<< make_tuple(rpp::event_field::service, "demo-client")
<< make_tuple(rpp::event_field::state, "ok");
client << e;
} catch (rpp::internal_exception &e) {
std::cerr << "Error: " << e.error() << " - " << e.reason() << "." << std::endl;
exit (EXIT_FAILURE);
}
return (EXIT_SUCCESS);
}
can any one me how can i run this program by using rienamm c++ client
After running some work in progress code which uses a riemannpp::client to send a large volume of messages to a riemann server through valgrind, I found a memory leak where riemann messages are never freed.
The riemannpp::client::send function calls the riemann-client's riemann_client_send_message function and releases ownership of message object. The riemann_client_send_message function does not free the message before returning, leading to lost memory. The message is passed to riemannpp::client::send as an rvalue so the API user cannot handle freeing the memory.
at client.cpp:80 :
client::send(message&& m) {
int result = riemann_client_send_message(d_client, m.release()); // Responsible for the memory leak
I switched to using riemannpp::client::send_oneshot which calls the riemann-client riemann_client_send_message_oneshot function which eliminates the memory leak. From the riemann-c-client API doc:
The second function, riemann_client_send_message_oneshot() will also free the message before returning. Be aware that the message will be freed even if the send did not succeed!
The riemannpp::client::send function should take an lvalue reference to the message to better match the behavior of the riemann-client's riemann_client_send_message function it wraps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.