-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HPCC-32717 Create basic Elastic sink component
Created new skeleton component and added to the build Signed-Off-By: Kenneth Rowland [email protected]
- Loading branch information
1 parent
318d964
commit d1c352f
Showing
4 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
################################################################################ | ||
# HPCC SYSTEMS software Copyright (C) 2024 HPCC Systems®. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
|
||
project(hpccmetrics_elasticsink) | ||
|
||
set ( srcs | ||
elasticSink.cpp | ||
) | ||
|
||
include_directories( | ||
${HPCC_SOURCE_DIR}/system/include | ||
${HPCC_SOURCE_DIR}/system/jlib | ||
${HPCC_SOURCE_DIR}/system/httplib | ||
) | ||
|
||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STRICT_CXX_FLAGS}") | ||
ADD_DEFINITIONS( -DELASTICSINK_EXPORTS ) | ||
HPCC_ADD_LIBRARY( hpccmetrics_elasticsink SHARED ${srcs} ) | ||
TARGET_LINK_LIBRARIES( hpccmetrics_elasticsink jlib) | ||
INSTALL ( TARGETS hpccmetrics_elasticsink RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*############################################################################## | ||
HPCC SYSTEMS software Copyright (C) 2021 HPCC Systems®. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
############################################################################## */ | ||
|
||
#include "elasticSink.hpp" | ||
#include <cstdio> | ||
#include "platform.h" | ||
|
||
|
||
|
||
using namespace hpccMetrics; | ||
|
||
extern "C" MetricSink* getSinkInstance(const char *name, const IPropertyTree *pSettingsTree) | ||
{ | ||
MetricSink *pSink = new ElasticMetricSink(name, pSettingsTree); | ||
return pSink; | ||
} | ||
|
||
|
||
ElasticMetricSink::ElasticMetricSink(const char *name, const IPropertyTree *pSettingsTree) : | ||
PeriodicMetricSink(name, "file", pSettingsTree), | ||
ignoreZeroMetrics(false) | ||
{ | ||
ignoreZeroMetrics = pSettingsTree->getPropBool("@ignoreZeroMetrics", true); | ||
} | ||
|
||
|
||
void ElasticMetricSink::prepareToStartCollecting() | ||
{ | ||
|
||
} | ||
|
||
|
||
void ElasticMetricSink::doCollection() | ||
{ | ||
|
||
} | ||
|
||
|
||
void ElasticMetricSink::collectingHasStopped() | ||
{ | ||
; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*############################################################################## | ||
HPCC SYSTEMS software Copyright (C) 2021 HPCC Systems®. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
############################################################################## */ | ||
|
||
|
||
#pragma once | ||
|
||
#include "jmetrics.hpp" | ||
#include "jptree.hpp" | ||
#include "jstring.hpp" | ||
|
||
//including cpp-httplib single header file REST client | ||
// doesn't work with format-nonliteral as an error | ||
// | ||
#if defined(__clang__) || defined(__GNUC__) | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
#endif | ||
|
||
#undef INVALID_SOCKET | ||
#include "httplib.h" | ||
|
||
#if defined(__clang__) || defined(__GNUC__) | ||
#pragma GCC diagnostic pop | ||
#endif | ||
|
||
#include "nlohmann/json.hpp" | ||
|
||
|
||
#ifdef ELASTICINK_EXPORTS | ||
#define ELASTICSINK_API DECL_EXPORT | ||
#else | ||
#define ELASTICSINK_API DECL_IMPORT | ||
#endif | ||
|
||
class ELASTICSINK_API ElasticMetricSink : public hpccMetrics::PeriodicMetricSink | ||
{ | ||
public: | ||
explicit ElasticMetricSink(const char *name, const IPropertyTree *pSettingsTree); | ||
~ElasticMetricSink() override = default; | ||
|
||
protected: | ||
void prepareToStartCollecting() override; | ||
void collectingHasStopped() override; | ||
void doCollection() override; | ||
|
||
protected: | ||
StringBuffer indexName; | ||
bool ignoreZeroMetrics; | ||
}; |