Skip to content

Commit

Permalink
Mon 16262 victoria metrics interprocess (#703)
Browse files Browse the repository at this point in the history
* MON-16262 use of boost::asio instead of asio

* MON-16262 http_client library

* MON-16262 http_client add some tests

* MON-16262 add http_tsdb library

* MON-16262 add victoria metrics stream

* MON-16262 http_client failure rewrite

* MON-16262 add some tests and some fix

* MON-16262 add https

* MON-16262 add authorization

* MON-16262 add comments, some clean and a test

* MON-16262-victoria-metrics-interprocess

* MON-16262 add tags and group

* MON-16262 add resource_id

* MON-16262 correction after rebase

* MON-16262 some improvements

* Mon 18167 add pb status pb metric to graphite release (#685)

* MON-18167 add pb_metric and pb_status to graphite

* MON-18167 add pb_metric and pb_status to influxdb

* MON-16167 only one influxdb version

* MON-16262 victoria uses previous cherry-pick (pb_status) features

* MON-16262 add tests and some improvements

* MON-16262 no checksum but a dirty flag

* MON-16262- fix after rabse

* fix(broker):in case ssl handshake fail, https_connection hang

* fix(victoria):bad host header value

* fix after rebase

* correction after review, add a node allocator
  • Loading branch information
jean-christophe81 authored Jul 21, 2023
1 parent 37ed7d6 commit ba37415
Show file tree
Hide file tree
Showing 142 changed files with 10,173 additions and 338 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ set(ALLOW_DUPLICATE_EXECUTABLE TRUE)

set(BUILD_ARGS "-w" "dupbuild=warn")

include_directories("inc")

#
# Get distributions name
#
Expand Down
2 changes: 1 addition & 1 deletion bbdo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ add_library(
"bbdo/bbdo_version.hh")
set_target_properties(bbdo_bbdo PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_precompile_headers(bbdo_bbdo PRIVATE precomp_inc/precomp.hpp)
add_dependencies(bbdo_bbdo target_bbdo)
add_dependencies(bbdo_bbdo target_bbdo target_extcmd)

add_library(
bbdo_storage STATIC
Expand Down
2 changes: 2 additions & 0 deletions bbdo/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ message Status {
uint32 rrd_len = 3;
uint64 time = 4;
uint32 state = 5;
uint64 host_id = 6;
uint64 service_id = 7;
}

message IndexMapping {
Expand Down
8 changes: 6 additions & 2 deletions broker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ option(WITH_DEBUG_ASIO "Add the Asio debugging flags." OFF)
if(WITH_DEBUG_ASIO)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -DASIO_ENABLE_BUFFER_DEBUGGING -DASIO_ENABLE_HANDLER_TRACKING"
"${CMAKE_CXX_FLAGS_DEBUG} -DBOOST_ASIO_ENABLE_BUFFER_DEBUGGING -DBOOST_ASIO_ENABLE_HANDLER_TRACKING"
)
endif()

Expand Down Expand Up @@ -138,7 +138,6 @@ include(cmake/tool.cmake)
# Check and/or find required components.
#
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
add_definitions("-DASIO_STANDALONE")

#
# Options.
Expand Down Expand Up @@ -308,6 +307,8 @@ set(LIBROKER_SOURCES
${SRC_DIR}/bbdo/stream.cc
${SRC_DIR}/broker_impl.cc
${SRC_DIR}/brokerrpc.cc
${SRC_DIR}/cache/global_cache.cc
${SRC_DIR}/cache/global_cache_data.cc
${SRC_DIR}/compression/factory.cc
${SRC_DIR}/compression/opener.cc
${SRC_DIR}/compression/stack_array.cc
Expand Down Expand Up @@ -522,6 +523,9 @@ add_broker_module(TLS ON)
add_broker_module(TLS2 OFF)
add_broker_module(DUMP OFF)
add_broker_module(GRPC ON)
add_broker_module(VICTORIA_METRICS ON)
add_subdirectory(http_client)
add_subdirectory(http_tsdb)

# Lua module.
option(WITH_MODULE_LUA "Build lua module." ON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class monitoring_stream : public io::stream {

void _write_forced_svc_check(const std::string& host,
const std::string& description);
void _explicitly_send_forced_svc_checks(const asio::error_code& ec);
void _explicitly_send_forced_svc_checks(const boost::system::error_code& ec);

void _prepare();
void _rebuild();
Expand Down
4 changes: 3 additions & 1 deletion broker/bam/precomp_inc/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
#include <boost/circular_buffer.hpp>
#include <boost/optional.hpp>

#include <asio.hpp>
#include <boost/asio.hpp>

namespace asio = boost::asio;

#include <spdlog/fmt/ostr.h>
#include <spdlog/spdlog.h>
Expand Down
26 changes: 15 additions & 11 deletions broker/bam/src/monitoring_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ int32_t monitoring_stream::stop() {
"done");
std::lock_guard<std::mutex> lck(_forced_svc_checks_m);
_forced_svc_checks_timer.expires_after(std::chrono::seconds(0));
_forced_svc_checks_timer.async_wait([this, &p](const asio::error_code& ec) {
_explicitly_send_forced_svc_checks(ec);
{
std::lock_guard<std::mutex> lck(_forced_svc_checks_m);
_forced_svc_checks_timer.cancel();
}
p.set_value();
});
_forced_svc_checks_timer.async_wait(
[this, &p](const boost::system::error_code& ec) {
_explicitly_send_forced_svc_checks(ec);
{
std::lock_guard<std::mutex> lck(_forced_svc_checks_m);
_forced_svc_checks_timer.cancel();
}
p.set_value();
});
}
p.get_future().wait();
/* Now, it is really cancelled. */
Expand Down Expand Up @@ -691,11 +692,14 @@ void monitoring_stream::_rebuild() {
* to avoid getting stuck. If at a moment, it fails to send queries, the
* function is rescheduled in 5s.
*
* @param ec asio::error_code to handle errors due to asio, not the files sent
* to centengine. Usually, "operation aborted" when cbd stops.
* @param ec boost::system::error_code to handle errors due to asio, not the
* files sent to centengine. Usually, "operation aborted" when cbd stops.
*/
void monitoring_stream::_explicitly_send_forced_svc_checks(
const asio::error_code& ec) {
const boost::system::error_code& ec) {
static int count = 0;
SPDLOG_LOGGER_DEBUG(log_v2::bam(),
"BAM: time to send forced service checks {}", count++);
if (!ec) {
if (_timer_forced_svc_checks.empty()) {
std::lock_guard<std::mutex> lck(_forced_svc_checks_m);
Expand Down
Loading

9 comments on commit ba37415

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
391 3 0 394 99.24

Failed Tests

Name Message ⏱️ Duration Suite
VICT_ONE_CHECK_METRIC No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 3.328 s Victoria
VICT_ONE_CHECK_STATUS No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 3.276 s Victoria
VICT_ONE_CHECK_METRIC_AFTER_FAILURE victoria should add metric in a request Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 69.239 s Victoria

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
350 0 0 350 100

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
390 4 0 394 98.98

Failed Tests

Name Message ⏱️ Duration Suite
BEUTAG7 Second step: Service (26, 507) should have servicegroup tags 3 and 5 68.452 s Tags
VICT_ONE_CHECK_METRIC No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 4.447 s Victoria
VICT_ONE_CHECK_STATUS No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 4.418 s Victoria
VICT_ONE_CHECK_METRIC_AFTER_FAILURE victoria should add metric in a request Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 70.926 s Victoria

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
390 4 0 394 98.98

Failed Tests

Name Message ⏱️ Duration Suite
BEUTAG7 Second step: Service (26, 507) should have servicegroup tags 3 and 5 74.819 s Tags
VICT_ONE_CHECK_METRIC No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 3.311 s Victoria
VICT_ONE_CHECK_STATUS No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 3.285 s Victoria
VICT_ONE_CHECK_METRIC_AFTER_FAILURE victoria should add metric in a request Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 69.518 s Victoria

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
350 0 0 350 100

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
391 3 0 394 99.24

Failed Tests

Name Message ⏱️ Duration Suite
VICT_ONE_CHECK_METRIC No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 5.216 s Victoria
VICT_ONE_CHECK_STATUS No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 4.269 s Victoria
VICT_ONE_CHECK_METRIC_AFTER_FAILURE victoria should add metric in a request Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 70.627 s Victoria

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
390 4 0 394 98.98

Failed Tests

Name Message ⏱️ Duration Suite
BEPBRI1 Central Broker not correctly stopped (coredump generated) 69.061 s Bbdo-Protobuf
VICT_ONE_CHECK_METRIC No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 3.318 s Victoria
VICT_ONE_CHECK_STATUS No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 3.318 s Victoria
VICT_ONE_CHECK_METRIC_AFTER_FAILURE victoria should add metric in a request Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 69.28 s Victoria

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
350 0 0 350 100

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
390 4 0 394 98.98

Failed Tests

Name Message ⏱️ Duration Suite
BEUTAG11 First step: Service (1, 3) should have servicecategory tags 3 and 5 71.547 s Tags
VICT_ONE_CHECK_METRIC No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 4.404 s Victoria
VICT_ONE_CHECK_STATUS No keyword with name 'Start Server' found. Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 4.209 s Victoria
VICT_ONE_CHECK_METRIC_AFTER_FAILURE victoria should add metric in a request Also teardown failed: Several failures occurred: 1) Central Broker not correctly stopped: 1 != 0 2) No keyword with name 'Stop Server' found. 70.654 s Victoria

Please sign in to comment.