Skip to content

Commit

Permalink
Mon 15428 convert kpi event to pb (#441)
Browse files Browse the repository at this point in the history
REFS:MON-15428
* MON-15428 use of KpiEvent in place of kpi_event

* MON-15428 fmt 9.1 and PR comments
  • Loading branch information
jean-christophe81 authored Dec 20, 2022
1 parent aea26d0 commit a5420d6
Show file tree
Hide file tree
Showing 121 changed files with 921 additions and 664 deletions.
2 changes: 1 addition & 1 deletion .github/actions/runner-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inputs:
required: false

env:
REGISTRY: registry-docker.centreon.com/docker-global
REGISTRY: docker.centreon.com

runs:
using: "composite"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- develop

env:
REGISTRY: registry-docker.centreon.com/docker-global
REGISTRY: docker.centreon.com

jobs:
create-version:
Expand Down
196 changes: 0 additions & 196 deletions .github/workflows/centreon-gorgone.yml

This file was deleted.

8 changes: 1 addition & 7 deletions .github/workflows/docker-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- 'ci/docker/**'

env:
REGISTRY: registry-docker.centreon.com/docker-global
REGISTRY: docker.centreon.com

jobs:
create-version:
Expand Down Expand Up @@ -52,12 +52,6 @@ jobs:
distrib: alma8
- project: collect
distrib: debian-bullseye
- project: gorgone
distrib: centos7
- project: gorgone
distrib: alma8
- project: gorgone
distrib: debian-bullseye
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/robot-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- cron: '0 0 * * *'

env:
REGISTRY: registry-docker.centreon.com/docker-global
REGISTRY: docker.centreon.com

jobs:
robot-test:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ endif()

set(protobuf_MODULE_COMPATIBLE True)

add_definitions(${spdlog_DEFINITIONS})
add_definitions(${CONAN_DEFINES_SPDLOG})

include_directories(${CMAKE_SOURCE_DIR} ${CONAN_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/clib/inc)
Expand Down
11 changes: 11 additions & 0 deletions bbdo/bam.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,15 @@ message BaEvent {
State status = 6;
}

message KpiEvent {
uint32 ba_id = 1;
uint64 start_time = 2;
int64 end_time = 3;
uint32 kpi_id = 4;
int32 impact_level = 5;
bool in_downtime = 6;
string output = 7;
string perfdata = 8;
State status = 9;
}

3 changes: 2 additions & 1 deletion bbdo/events.hh
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ enum data_element {
de_inherited_downtime,
de_pb_inherited_downtime = 18,
de_pb_ba_status = 19,
de_pb_ba_event = 20
de_pb_ba_event = 20,
de_pb_kpi_event = 21
};
}
constexpr uint32_t make_type(io::data_category cat, uint32_t elem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef BAM_CCB_CONFIGURATION_BOOL_EXPRESSION_HH
#define BAM_CCB_CONFIGURATION_BOOL_EXPRESSION_HH

#include "bbdo/bam/kpi_event.hh"
#include "com/centreon/broker/namespace.hh"

CCB_BEGIN()
Expand Down
8 changes: 4 additions & 4 deletions broker/bam/inc/com/centreon/broker/bam/configuration/kpi.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef CCB_BAM_CONFIGURATION_KPI_HH
#define CCB_BAM_CONFIGURATION_KPI_HH

#include "bbdo/bam/kpi_event.hh"
#include "com/centreon/broker/bam/internal.hh"
#include "com/centreon/broker/namespace.hh"

CCB_BEGIN()
Expand Down Expand Up @@ -51,7 +51,7 @@ class kpi {
double _impact_warning;
double _impact_critical;
double _impact_unknown;
bam::kpi_event _event;
KpiEvent _event;

public:
kpi(uint32_t id = 0,
Expand Down Expand Up @@ -96,7 +96,7 @@ class kpi {
double get_impact_warning() const;
double get_impact_critical() const;
double get_impact_unknown() const;
bam::kpi_event const& get_opened_event() const;
const KpiEvent& get_opened_event() const;

void set_id(uint32_t id);
void set_state_type(short state_type);
Expand All @@ -114,7 +114,7 @@ class kpi {
void set_impact_warning(double impact);
void set_impact_critical(double impact);
void set_impact_unknown(double impact);
void set_opened_event(bam::kpi_event const& kpi_event);
void set_opened_event(const KpiEvent& kpi_event);
};
} // namespace configuration
} // namespace bam
Expand Down
1 change: 0 additions & 1 deletion broker/bam/inc/com/centreon/broker/bam/events.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "com/centreon/broker/bam/dimension_timeperiod_exception.hh"
#include "com/centreon/broker/bam/dimension_timeperiod_exclusion.hh"
#include "com/centreon/broker/bam/dimension_truncate_table_signal.hh"
#include "com/centreon/broker/bam/kpi_event.hh"
#include "com/centreon/broker/bam/kpi_status.hh"
#include "com/centreon/broker/bam/rebuild.hh"

Expand Down
3 changes: 3 additions & 0 deletions broker/bam/inc/com/centreon/broker/bam/internal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ using pb_ba_status =
using pb_ba_event =
io::protobuf<BaEvent, make_type(io::bam, bam::de_pb_ba_event)>;

using pb_kpi_event =
io::protobuf<KpiEvent, make_type(io::bam, bam::de_pb_kpi_event)>;

} // namespace bam

CCB_END()
Expand Down
11 changes: 7 additions & 4 deletions broker/bam/inc/com/centreon/broker/bam/kpi.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
#ifndef CCB_BAM_KPI_HH
#define CCB_BAM_KPI_HH

#include "bbdo/bam/kpi_event.hh"
#include "com/centreon/broker/bam/computable.hh"
#include "com/centreon/broker/bam/internal.hh"
#include "com/centreon/broker/io/stream.hh"
#include "com/centreon/broker/namespace.hh"
#include "com/centreon/broker/timestamp.hh"

CCB_BEGIN()

Expand All @@ -42,8 +43,10 @@ class kpi : public computable {
protected:
const uint32_t _id;
const uint32_t _ba_id;
std::shared_ptr<kpi_event> _event;
std::vector<std::shared_ptr<kpi_event>> _initial_events;
absl::optional<KpiEvent> _event;
std::vector<KpiEvent> _initial_events;

void _event_init();

public:
kpi(uint32_t kpi_id, uint32_t ba_id);
Expand All @@ -55,7 +58,7 @@ class kpi : public computable {
timestamp get_last_state_change() const;
virtual void impact_hard(impact_values& hard_impact) = 0;
virtual void impact_soft(impact_values& soft_impact) = 0;
virtual void set_initial_event(kpi_event const& e);
virtual void set_initial_event(const KpiEvent& e);
virtual void visit(io::stream* visitor) = 0;
virtual bool in_downtime() const;
virtual bool ok_state() const = 0;
Expand Down
1 change: 0 additions & 1 deletion broker/bam/inc/com/centreon/broker/bam/kpi_ba.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef CCB_BAM_KPI_BA_HH
#define CCB_BAM_KPI_BA_HH

#include "bbdo/bam/kpi_event.hh"
#include "bbdo/bam/state.hh"
#include "com/centreon/broker/bam/impact_values.hh"
#include "com/centreon/broker/bam/internal.hh"
Expand Down
Loading

0 comments on commit a5420d6

Please sign in to comment.