m-mizutani / libfluent Goto Github PK
View Code? Open in Web Editor NEWLibrary to send log as fluentd forwarding message
License: Other
Library to send log as fluentd forwarding message
License: Other
๐
Several current tests are unstable because they need interactions with an other process that is not enough controlled. Then, sometimes tests fail and it's difficult to fix.
Create a program with libfluent that is different test program ( bin/fluent-test
) and it will be managed by a Python script.
$ git diff
diff --git a/src/fluent/message.hpp b/src/fluent/message.hpp
index a71c6a3..a184c5d 100644
--- a/src/fluent/message.hpp
+++ b/src/fluent/message.hpp
@@ -149,7 +149,7 @@ namespace fluent {
std::vector<Object*> array_;
public:
Array() {}
- ~Array() {}
+ ~Array();
Map *retain_map();
Array *retain_array();
void push(const std::string &val);
diff --git a/src/message.cc b/src/message.cc
index 4d1b705..c3e04d8 100644
--- a/src/message.cc
+++ b/src/message.cc
@@ -265,6 +265,12 @@ namespace fluent {
return map;
}
+ Message::Array::~Array() {
+ for (auto it = this->array_.begin(); it != this->array_.end(); it++) {
+ delete *it;
+ }
+ }
+
void Message::Array::push(const std::string &val) {
Object *v = new String(val);
this->array_.push_back(v);
I'm trying to use libfluent in our own project. Lines 51 and 59 of your CMakeLists.txt cause issues with this.
We are including msgpack-c
and libfluent
using add_subdirectory
calls. We have no desire to build libfluent separately and install.
Line 51 causes:
CMake Error: install(EXPORT "fluentConfig" ...) includes target "fluent-shared" which requires target "msgpackc" that is not in the export set.
If line 51 is commented out, line 59 causes:
CMake Error: INSTALL(EXPORT) given unknown export "fluentConfig"
If I comment both of them out then everything works quite well.
I'm not familiar enough with cmake to know a proper workaround for this, but as we intend to use this library as a submodule and contribute any changes upstream if we have any, I'd like to not have to maintain a custom version.
Do you have any input regarding my issue?
While compling libfluent with different compiler settings I got two warnings.
`
13-Feb-2018 15:42:09 | /data/Libraries/libfluent/src/emitter.cc: In member function 'virtual void fluent::FileEmitter::worker()': |
---|---|
13-Feb-2018 15:42:09 | /data/Libraries/libfluent/src/emitter.cc:234:9: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized] |
` |
`
13-Feb-2018 15:42:16 | /data/Libraries/libfluent/tools/fluent-bench.cc: In function 'int main(int, char**)': |
---|---|
13-Feb-2018 15:42:16 | /data/Libraries/libfluent/tools/fluent-bench.cc:68:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] |
13-Feb-2018 15:42:16 | int diff = (mps > msg_count) ? mps - msg_count : msg_count - mps; |
13-Feb-2018 15:42:16 | ^ |
13-Feb-2018 15:42:16 | /data/Libraries/libfluent/tools/fluent-bench.cc:75:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] |
13-Feb-2018 15:42:16 | if (mps < msg_count) { |
13-Feb-2018 15:42:16 | ^ |
13-Feb-2018 15:42:16 | /data/Libraries/libfluent/tools/fluent-bench.cc:77:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] |
13-Feb-2018 15:42:16 | } else if (mps > msg_count) { |
` | |
The following changes fixes the issues. |
diff --git a/Libraries/libfluent/src/emitter.cc b/Libraries/libfluent/src/emitter.cc
index 28fb5fb..e533b81 100644
--- a/Libraries/libfluent/src/emitter.cc
+++ b/Libraries/libfluent/src/emitter.cc
@@ -212,7 +212,7 @@ namespace fluent {
Message *root;
while (nullptr != (root = this->queue_.bulk_pop())) {
for(Message *msg = root; msg; msg = msg->next()) {
- int rc;
+ int rc = 0;
switch(this->format_) {
case MsgPack: {
msgpack::sbuffer buf;
diff --git a/Libraries/libfluent/tools/fluent-bench.cc b/Libraries/libfluent/tools/fluent-bench.cc
index dcc98c8..6ab8ef6 100644
--- a/Libraries/libfluent/tools/fluent-bench.cc
+++ b/Libraries/libfluent/tools/fluent-bench.cc
@@ -46,7 +46,7 @@ int main(int argc, char *argv[]) {
int wait = 1000000 / mps;
time_t last_ts = time(nullptr);
- size_t msg_count = 0;
+ int msg_count = 0;
std::cout << "wait: " << wait << "usec" << std::endl;
Best regards,
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.