-
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.
MON-111637 Centreon next 23.10 (Jira release #19888#) (#1410)
- Loading branch information
Showing
75 changed files
with
4,520 additions
and
1,844 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
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 |
---|---|---|
|
@@ -29,7 +29,7 @@ on: | |
jobs: | ||
routing: | ||
name: Check before analysis | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
development_stage: ${{ steps.routing-mode.outputs.development_stage }} | ||
|
||
|
@@ -61,7 +61,7 @@ jobs: | |
password: ${{ secrets.docker_registry_passwd }} | ||
|
||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
|
||
- name: Compiling Cpp sources | ||
run: | | ||
|
@@ -141,7 +141,7 @@ jobs: | |
name: Sandbox scan | ||
needs: [routing, build] | ||
if: needs.routing.outputs.development_stage != 'Development' | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Promote latest scan | ||
|
@@ -162,13 +162,13 @@ jobs: | |
delete-on-promote: false | ||
|
||
- name: Get build binary | ||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | ||
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary.tar.gz" | ||
key: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary" | ||
|
||
- name: Sandbox scan | ||
uses: veracode/[email protected] | ||
uses: veracode/veracode-uploadandscan-action@f7e1fbf02c5c899fba9f12e3f537b62f2f1230e1 # master using 0.2.6 | ||
continue-on-error: ${{ vars.VERACODE_CONTINUE_ON_ERROR == 'true' }} | ||
with: | ||
appname: "${{ inputs.module_name }}" | ||
|
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,2 +1,2 @@ | ||
MAJOR=23.10 | ||
MINOR=7 | ||
MINOR=8 |
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,20 +1,20 @@ | ||
/* | ||
** 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 2022-2024 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] | ||
*/ | ||
|
||
syntax = "proto3"; | ||
|
||
|
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,24 +1,25 @@ | ||
/* | ||
** Copyright 2020-2021 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 2020-2024 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] | ||
*/ | ||
|
||
#ifndef CCB_STATS_CENTER_HH | ||
#define CCB_STATS_CENTER_HH | ||
|
||
#include <absl/synchronization/mutex.h> | ||
#include "broker.pb.h" | ||
#include "com/centreon/broker/namespace.hh" | ||
|
||
|
@@ -50,48 +51,57 @@ namespace stats { | |
* value value. | ||
*/ | ||
class center { | ||
static center* _instance; | ||
BrokerStats _stats; | ||
mutable std::mutex _stats_m; | ||
static std::shared_ptr<center> _instance; | ||
BrokerStats _stats ABSL_GUARDED_BY(_stats_m); | ||
mutable absl::Mutex _stats_m; | ||
int _json_stats_file_creation; | ||
|
||
public: | ||
center(); | ||
~center(); | ||
|
||
public: | ||
static center& instance(); | ||
static std::shared_ptr<center> instance_ptr(); | ||
static void load(); | ||
static void unload(); | ||
std::string to_string(); | ||
std::string to_string() ABSL_LOCKS_EXCLUDED(_stats_m); | ||
|
||
EngineStats* register_engine(); | ||
ConflictManagerStats* register_conflict_manager(); | ||
void unregister_muxer(const std::string& name); | ||
EngineStats* register_engine() ABSL_LOCKS_EXCLUDED(_stats_m); | ||
ConflictManagerStats* register_conflict_manager() | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
void unregister_muxer(const std::string& name) ABSL_LOCKS_EXCLUDED(_stats_m); | ||
void update_muxer(std::string name, | ||
std::string queue_file, | ||
uint32_t size, | ||
uint32_t unack); | ||
uint32_t unack) ABSL_LOCKS_EXCLUDED(_stats_m); | ||
void init_queue_file(std::string muxer, | ||
std::string queue_file, | ||
uint32_t max_file_size); | ||
uint32_t max_file_size) ABSL_LOCKS_EXCLUDED(_stats_m); | ||
|
||
bool muxer_stats(const std::string& name, MuxerStats* response); | ||
MuxerStats* muxer_stats(const std::string& name); | ||
void clear_muxer_queue_file(const std::string& name); | ||
bool muxer_stats(const std::string& name, MuxerStats* response) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
MuxerStats* muxer_stats(const std::string& name) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
void clear_muxer_queue_file(const std::string& name) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
|
||
bool get_sql_connection_stats(uint32_t index, SqlConnectionStats* response); | ||
bool get_sql_connection_stats(uint32_t index, SqlConnectionStats* response) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
void get_conflict_manager_stats(ConflictManagerStats* response); | ||
void get_sql_manager_stats(SqlManagerStats* response, int32_t id = -1); | ||
void get_sql_manager_stats(SqlManagerStats* response, int32_t id = -1) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
SqlConnectionStats* connection(size_t idx); | ||
SqlConnectionStats* add_connection(); | ||
void remove_connection(SqlConnectionStats* stats); | ||
SqlConnectionStats* add_connection() ABSL_LOCKS_EXCLUDED(_stats_m); | ||
void remove_connection(SqlConnectionStats* stats) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
|
||
int get_json_stats_file_creation(void); | ||
void get_sql_connection_size(GenericSize* response); | ||
void get_processing_stats(ProcessingStats* response); | ||
void get_sql_connection_size(GenericSize* response) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
void get_processing_stats(ProcessingStats* response) | ||
ABSL_LOCKS_EXCLUDED(_stats_m); | ||
const BrokerStats& stats() const; | ||
void lock(); | ||
void unlock(); | ||
void lock() ABSL_EXCLUSIVE_LOCK_FUNCTION(_stats); | ||
void unlock() ABSL_UNLOCK_FUNCTION(_stats); | ||
|
||
/** | ||
* @brief Set the value pointed by ptr to the value value. | ||
|
@@ -101,25 +111,11 @@ class center { | |
* @param value The value of type T to set. | ||
*/ | ||
template <typename T> | ||
void update(T* ptr, T value) { | ||
std::lock_guard<std::mutex> lck(_stats_m); | ||
void update(T* ptr, T value) ABSL_LOCKS_EXCLUDED(_stats_m) { | ||
absl::MutexLock lck(&_stats_m); | ||
*ptr = std::move(value); | ||
} | ||
|
||
/** | ||
* @brief Almost the same function as in the previous case, but with a | ||
* Timestamp object. And we can directly set a time_t value. | ||
* | ||
* @param ptr A pointer to object of type Timestamp. | ||
* @param value The value of type time_t to set. | ||
*/ | ||
// void update(google::protobuf::Timestamp* ptr, time_t value) { | ||
// _strand.post([ptr, value] { | ||
// ptr->Clear(); | ||
// ptr->set_seconds(value); | ||
// }); | ||
//} | ||
|
||
/** | ||
* @brief Sometimes with protobuf, we can not access to a mutable pointer. | ||
* For example with int32 values. We have instead a setter member function. | ||
|
@@ -132,19 +128,19 @@ class center { | |
* @param value The value to set. | ||
*/ | ||
template <typename U, typename T> | ||
void update(void (U::*f)(T), U* ptr, T value) { | ||
std::lock_guard<std::mutex> lck(_stats_m); | ||
void update(void (U::*f)(T), U* ptr, T value) ABSL_LOCKS_EXCLUDED(_stats_m) { | ||
absl::MutexLock lck(&_stats_m); | ||
(ptr->*f)(value); | ||
} | ||
|
||
void execute(std::function<void()>&& f) { | ||
std::lock_guard<std::mutex> lck(_stats_m); | ||
void execute(std::function<void()>&& f) ABSL_LOCKS_EXCLUDED(_stats_m) { | ||
absl::MutexLock lck(&_stats_m); | ||
f(); | ||
} | ||
|
||
template <typename U, typename T> | ||
const T& get(T (U::*f)() const, const U* ptr) { | ||
std::lock_guard<std::mutex> lck(_stats_m); | ||
const T& get(T (U::*f)() const, const U* ptr) ABSL_LOCKS_EXCLUDED(_stats_m) { | ||
absl::MutexLock lck(&_stats_m); | ||
return (ptr->*f)(); | ||
} | ||
}; | ||
|
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
Oops, something went wrong.