-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPCC-32717 Create basic Elastic sink component #19158
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32717 Jirabot Action Result: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenrowland seems reasonable shell. Spotted a few minor issues.
@@ -0,0 +1,59 @@ | |||
/*############################################################################## | |||
HPCC SYSTEMS software Copyright (C) 2021 HPCC Systems®. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,53 @@ | |||
/*############################################################################## | |||
HPCC SYSTEMS software Copyright (C) 2021 HPCC Systems®. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
#include <cstdio> | ||
#include "platform.h" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra new lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
// doesn't work with format-nonliteral as an error | ||
// | ||
#if defined(__clang__) || defined(__GNUC__) | ||
#pragma GCC diagnostic push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all of these necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not included, the following build errors are generated:
In file included from /home/krowland/hpcc/src/system/metrics/sinks/elastic/elasticSink.hpp:30,
from /home/krowland/hpcc/src/system/metrics/sinks/elastic/elasticSink.cpp:14:
/home/krowland/hpcc/src/system/httplib/httplib.h: In instantiation of ‘ssize_t httplib::Stream::write_format(const char*, const Args& ...) [with Args = {int, const char*}; ssize_t = long int]’:
/home/krowland/hpcc/src/system/httplib/httplib.h:3940:61: required from here
/home/krowland/hpcc/src/system/httplib/httplib.h:3635:21: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
3635 | auto sn = snprintf(buf.data(), buf.size() - 1, fmt, args...);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/krowland/hpcc/src/system/httplib/httplib.h:3652:19: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
3652 | snprintf(&glowable_buf[0], glowable_buf.size() - 1, fmt, args...));
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/krowland/hpcc/src/system/httplib/httplib.h: In instantiation of ‘ssize_t httplib::Stream::write_format(const char*, const Args& ...) [with Args = {const char*, const char*}; ssize_t = long int]’:
/home/krowland/hpcc/src/system/httplib/httplib.h:4805:76: required from here
/home/krowland/hpcc/src/system/httplib/httplib.h:3635:21: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
3635 | auto sn = snprintf(buf.data(), buf.size() - 1, fmt, args...);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/krowland/hpcc/src/system/httplib/httplib.h:3652:19: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
3652 | snprintf(&glowable_buf[0], glowable_buf.size() - 1, fmt, args...));
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is a similar error w/o the #undef for INVALID_SOCKET
03c70e8
to
3b20b29
Compare
@ghalliday please merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenrowland a few minor issues to clean up.
system/metrics/sinks/CMakeLists.txt
Outdated
@@ -1,5 +1,5 @@ | |||
############################################################################### | |||
# HPCC SYSTEMS software Copyright (C) 2021 HPCC Systems®. | |||
# HPCC SYSTEMS software Copyright (C) 20214HPCC Systems®. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: typo in the edit
|
||
|
||
ElasticMetricSink::ElasticMetricSink(const char *name, const IPropertyTree *pSettingsTree) : | ||
PeriodicMetricSink(name, "file", pSettingsTree), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"file" -> "elastic"
|
||
ElasticMetricSink::ElasticMetricSink(const char *name, const IPropertyTree *pSettingsTree) : | ||
PeriodicMetricSink(name, "file", pSettingsTree), | ||
ignoreZeroMetrics(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: less error prone to use a default initializer on the member definition instead.
#endif | ||
|
||
#undef INVALID_SOCKET | ||
#include "httplib.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these #includes needed in the header file?
The implementation should be private, and if the class implementation requires members, publish a factory method instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved #include "nlohmann/json.hpp" to the cpp file since it may not be used for a class member variable.
However, I left httplib since I currently plan on adding a protected member variable for a class defined in that header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I move forward on the next step, it looks like a protected member variable will not be the direction. The include was moved to the spp file.
~ElasticMetricSink() override = default; | ||
|
||
protected: | ||
void prepareToStartCollecting() override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The rest of the code base includes the virtual qualifier on override functions, even though it is not technically required.
@@ -0,0 +1,80 @@ | |||
/*############################################################################## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was added by mistake - please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, removed.
2f4bd62
to
0112aa8
Compare
#include "jptree.hpp" | ||
#include "jstring.hpp" | ||
|
||
#ifdef ELASTICINK_EXPORTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: should be ELASTICSINK_EXPORTS
This is causing the windows build error
Created new skeleton component and added to the build Signed-Off-By: Kenneth Rowland [email protected]
0112aa8
to
2535bc8
Compare
Created new skeleton component and added to the build
Signed-Off-By: Kenneth Rowland [email protected]
Type of change:
Checklist:
Smoketest:
Testing: