-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(broker/common) http_client is moved to common and new class http_…
…server REFS: MON-35539
- Loading branch information
1 parent
7469727
commit 638297b
Showing
34 changed files
with
1,425 additions
and
775 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,31 +1,32 @@ | ||
/* | ||
** Copyright 2022 Centreon | ||
** | ||
** 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. | ||
** | ||
** For more information : [email protected] | ||
*/ | ||
/** | ||
* Copyright 2024 Centreon (https://www.centreon.com/) | ||
* | ||
* 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. | ||
* | ||
* For more information : [email protected] | ||
* | ||
*/ | ||
|
||
#ifndef CCB_HTTP_TSDB_CONFIG_HH | ||
#define CCB_HTTP_TSDB_CONFIG_HH | ||
|
||
#include "column.hh" | ||
#include "com/centreon/broker/http_client/http_config.hh" | ||
#include "com/centreon/common/http/http_config.hh" | ||
|
||
namespace com::centreon::broker { | ||
|
||
namespace http_tsdb { | ||
class http_tsdb_config : public http_client::http_config { | ||
class http_tsdb_config : public common::http::http_config { | ||
std::string _http_target; | ||
std::string _user; | ||
std::string _pwd; | ||
|
@@ -34,14 +35,14 @@ class http_tsdb_config : public http_client::http_config { | |
std::vector<column> _metric_columns; | ||
|
||
public: | ||
http_tsdb_config(const http_client::http_config& http_conf, | ||
http_tsdb_config(const common::http::http_config& http_conf, | ||
const std::string& http_target, | ||
const std::string& user, | ||
const std::string& pwd, | ||
unsigned max_queries_per_transaction, | ||
const std::vector<column>& status_columns, | ||
const std::vector<column>& metric_columns) | ||
: http_client::http_config(http_conf), | ||
: common::http::http_config(http_conf), | ||
_http_target(http_target), | ||
_user(user), | ||
_pwd(pwd), | ||
|
@@ -50,9 +51,9 @@ class http_tsdb_config : public http_client::http_config { | |
_metric_columns(metric_columns) {} | ||
|
||
http_tsdb_config() : _max_queries_per_transaction(0) {} | ||
http_tsdb_config(const http_client::http_config& http_conf, | ||
http_tsdb_config(const common::http::http_config& http_conf, | ||
unsigned max_queries_per_transaction) | ||
: http_client::http_config(http_conf), | ||
: common::http::http_config(http_conf), | ||
_max_queries_per_transaction(max_queries_per_transaction) {} | ||
|
||
const std::string& get_http_target() const { return _http_target; } | ||
|
@@ -71,6 +72,6 @@ class http_tsdb_config : public http_client::http_config { | |
}; | ||
} // namespace http_tsdb | ||
|
||
} | ||
} // namespace com::centreon::broker | ||
|
||
#endif |
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 |
---|---|---|
@@ -1,38 +1,39 @@ | ||
/* | ||
** Copyright 2011-2017 Centreon | ||
** | ||
** 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. | ||
** | ||
** For more information : [email protected] | ||
*/ | ||
/** | ||
* Copyright 2024 Centreon (https://www.centreon.com/) | ||
* | ||
* 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. | ||
* | ||
* For more information : [email protected] | ||
* | ||
*/ | ||
|
||
#ifndef CCB_HTTP_TSDB_STREAM_HH | ||
#define CCB_HTTP_TSDB_STREAM_HH | ||
|
||
#include "com/centreon/broker/http_client/http_client.hh" | ||
#include "com/centreon/broker/io/stream.hh" | ||
#include "com/centreon/broker/persistent_cache.hh" | ||
#include "com/centreon/common/http/http_client.hh" | ||
#include "http_tsdb_config.hh" | ||
#include "internal.hh" | ||
#include "line_protocol_query.hh" | ||
|
||
namespace http_client = com::centreon::broker::http_client; | ||
namespace http = com::centreon::common::http; | ||
|
||
namespace com::centreon::broker { | ||
|
||
namespace http_tsdb { | ||
|
||
class request : public http_client::request_base { | ||
class request : public http::request_base { | ||
protected: | ||
unsigned _nb_metric; | ||
unsigned _nb_status; | ||
|
@@ -43,9 +44,8 @@ class request : public http_client::request_base { | |
request() : _nb_metric(0), _nb_status(0) {} | ||
request(boost::beast::http::verb method, | ||
const std::string& server_name, | ||
boost::beast::string_view target, | ||
unsigned version = 11) | ||
: http_client::request_base(method, server_name, target), | ||
boost::beast::string_view target) | ||
: http::request_base(method, server_name, target), | ||
_nb_metric(0), | ||
_nb_status(0) {} | ||
|
||
|
@@ -67,7 +67,7 @@ inline std::ostream& operator<<(std::ostream& str, const request& req) { | |
return str; | ||
} | ||
|
||
/** | ||
/* | ||
* @class stream stream.hh "com/centreon/broker/influxdb/stream.hh" | ||
* @brief tsdb stream. | ||
* This class is a base class | ||
|
@@ -82,15 +82,15 @@ class stream : public io::stream, public std::enable_shared_from_this<stream> { | |
// Database and http parameters | ||
std::shared_ptr<http_tsdb_config> _conf; | ||
|
||
http_client::client::pointer _http_client; | ||
http::client::pointer _http_client; | ||
|
||
// number of metric and status sent to tsdb and acknowledged by a 20x response | ||
unsigned _acknowledged; | ||
// the current request that buffers metric to send | ||
request::pointer _request; | ||
// the two beans stat_unit and stat_average are used to produce statistics | ||
// about request time | ||
/** | ||
/* | ||
* @brief stat cumul | ||
* this bean is used to cumulate request for example during one second | ||
*/ | ||
|
@@ -106,7 +106,7 @@ class stream : public io::stream, public std::enable_shared_from_this<stream> { | |
stat _metric_stat; | ||
stat _status_stat; | ||
|
||
/** | ||
/* | ||
* @brief this cless calc an average over a period | ||
* | ||
*/ | ||
|
@@ -129,8 +129,7 @@ class stream : public io::stream, public std::enable_shared_from_this<stream> { | |
const std::shared_ptr<asio::io_context>& io_context, | ||
const std::shared_ptr<spdlog::logger>& logger, | ||
const std::shared_ptr<http_tsdb_config>& conf, | ||
http_client::client::connection_creator conn_creator = | ||
http_client::http_connection::load); | ||
http::connection_creator conn_creator); | ||
|
||
virtual request::pointer create_request() const = 0; | ||
|
||
|
@@ -139,7 +138,7 @@ class stream : public io::stream, public std::enable_shared_from_this<stream> { | |
void send_handler(const boost::beast::error_code& err, | ||
const std::string& detail, | ||
const request::pointer& request, | ||
const http_client::response_ptr& response); | ||
const http::response_ptr& response); | ||
|
||
void add_to_stat(stat& to_maj, unsigned to_add); | ||
|
||
|
@@ -155,6 +154,6 @@ class stream : public io::stream, public std::enable_shared_from_this<stream> { | |
}; | ||
} // namespace http_tsdb | ||
|
||
} | ||
} // namespace com::centreon::broker | ||
|
||
#endif // !CCB_HTTP_TSDB_STREAM_HH |
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
/** | ||
* Copyright 2011-2017 Centreon | ||
* | ||
* 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. | ||
* | ||
* For more information : [email protected] | ||
*/ | ||
* Copyright 2024 Centreon (https://www.centreon.com/) | ||
* | ||
* 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. | ||
* | ||
* For more information : [email protected] | ||
* | ||
*/ | ||
|
||
#include "com/centreon/broker/http_tsdb/factory.hh" | ||
|
||
|
@@ -244,7 +245,7 @@ void factory::create_conf(const config::endpoint& cfg, | |
certificate_path = it->second; | ||
} | ||
|
||
http_client::http_config http_cfg( | ||
common::http::http_config http_cfg( | ||
res_it->endpoint(), addr, encryption, connect_timeout, send_timeout, | ||
receive_timeout, second_tcp_keep_alive_interval, std::chrono::seconds(1), | ||
0, default_http_keepalive_duration, max_connections, ssl_method, | ||
|
Oops, something went wrong.
638297b
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.
Robot Results
Failed Tests
Reverse-Connection
Reverse-Connection