Skip to content

Commit

Permalink
Improve QoS incompatibility representation (#240)
Browse files Browse the repository at this point in the history
* Refs #22066: Add support to Extended Incompatible QoS monitorservice samples and refresh status view

Signed-off-by: Carlosespicur <carlosespicur@proton.me>

* Refs #22066: Fix coredump when closing monitor

Signed-off-by: Carlosespicur <carlosespicur@proton.me>

* Refs #22066: Fix error counters

Signed-off-by: Carlosespicur <carlosespicur@proton.me>

* Refs #22066: Remove flags, deprecated comments and uncrustify

Signed-off-by: Carlosespicur <carlosespicur@proton.me>

* Refs #22066: Avoid debug traces when compiling in Release Mode

Signed-off-by: Carlosespicur <carlosespicur@proton.me>

* Refs #22066: Add suggested changes

Signed-off-by: Carlosespicur <carlosespicur@proton.me>

---------

Signed-off-by: Carlosespicur <carlosespicur@proton.me>
  • Loading branch information
Carlosespicur authored Dec 10, 2024
1 parent d04bbdb commit 2da5bb3
Show file tree
Hide file tree
Showing 11 changed files with 376 additions and 74 deletions.
3 changes: 3 additions & 0 deletions include/fastdds_monitor/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class Controller : public QObject
{
std::map<backend::EntityId, uint32_t> errors;
std::map<backend::EntityId, uint32_t> warnings;
// Represents the subset of errors that a entity shares with other entities, and are deleted when the entity becomes inactive
// Fist key is the entity id, second key is the remote entity guid and value is the number of errors shared
std::map<backend::EntityId, std::map<std::string, uint32_t>> shared_errors;
int32_t total_errors = 0;
int32_t total_warnings = 0;
}
Expand Down
12 changes: 12 additions & 0 deletions include/fastdds_monitor/backend/SyncBackendConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ class SyncBackendConnection
std::string get_data_type_name(
backend::EntityId id);

//! Get the guid associated to a given entity from the Backend by calling \c get_info
std::string get_guid(
backend::EntityId id);

//! Get the status level of an entity from the Backend by calling \c get_status
StatusLevel get_status(
backend::EntityId id);
Expand Down Expand Up @@ -199,6 +203,14 @@ class SyncBackendConnection
EntityId source_entity_id,
SampleLostSample& sample);

bool get_status_data(
EntityId source_entity_id,
ExtendedIncompatibleQosSample& sample);

//! Convert a given entity guid to string format
std::string get_deserialized_guid(
const backend::GUID_s& data);

//! Get info from an entity from the Backend
std::vector<EntityId> get_entities(
EntityKind entity_type,
Expand Down
4 changes: 4 additions & 0 deletions include/fastdds_monitor/backend/backend_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <fastdds_statistics_backend/types/app_names.h>
#include <fastdds_statistics_backend/types/JSONTags.h>
#include <fastdds_statistics_backend/types/types.hpp>
#include <fastdds_statistics_backend/topic_types/types.hpp>

namespace backend {

Expand All @@ -40,6 +41,7 @@ using StatusLevel = eprosima::statistics_backend::StatusLevel;
using StatisticKind = eprosima::statistics_backend::StatisticKind;
using EntityInfo = eprosima::statistics_backend::Info;
using Timestamp = eprosima::statistics_backend::Timestamp;
using GUID_s = eprosima::fastdds::statistics::detail::GUID_s;

// Status types from backend
using ConnectionListSample = eprosima::statistics_backend::ConnectionListSample;
Expand All @@ -50,6 +52,8 @@ using LivelinessChangedSample = eprosima::statistics_backend::LivelinessChangedS
using LivelinessLostSample = eprosima::statistics_backend::LivelinessLostSample;
using ProxySample = eprosima::statistics_backend::ProxySample;
using SampleLostSample = eprosima::statistics_backend::SampleLostSample;
using ExtendedIncompatibleQoSStatusSeq = eprosima::fastdds::statistics::ExtendedIncompatibleQoSStatusSeq_s;
using ExtendedIncompatibleQoSStatus = eprosima::fastdds::statistics::ExtendedIncompatibleQoSStatus_s;
//using StatusesSizeSample = eprosima::statistics_backend::StatusesSizeSample;

//! Reference the ID_ALL in the project
Expand Down
3 changes: 3 additions & 0 deletions include/fastdds_monitor/backend/backend_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ std::string entity_status_description(
std::string policy_documentation_description(
const uint32_t& id);

std::string guid_s_to_string(
const backend::GUID_s& guid);

} //namespace backend

#endif // _EPROSIMA_FASTDDS_MONITOR_BACKEND_BACKENDUTILS_H
60 changes: 58 additions & 2 deletions include/fastdds_monitor/model/tree/StatusTreeItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#define _EPROSIMA_FASTDDS_MONITOR_MODEL_TREE_StatusTreeItem_H

#include <QVariant>
#include <QObject>
#include <fastdds_monitor/backend/backend_types.h>

namespace models {
Expand All @@ -54,8 +55,10 @@ namespace models {
* Parenting and deletion are dealt from the StatusTreeModel. Deleting a StatusTreeItem
* will call the delete for each child node.
*/
class StatusTreeItem
class StatusTreeItem : public QObject
{
Q_OBJECT

friend class StatusTreeModel;

public:
Expand All @@ -72,7 +75,8 @@ class StatusTreeItem
const backend::EntityId& id,
const std::string& name,
const backend::StatusLevel& status_level,
const std::string& description);
const std::string& description,
const std::string& guid);

//! Create an item with the status parameters
explicit StatusTreeItem(
Expand All @@ -83,6 +87,17 @@ class StatusTreeItem
const std::string& value,
const std::string& description);

//! Create an item with the status parameters and guid and configures whether the item should be deleted if it has no children
explicit StatusTreeItem(
const backend::EntityId& id,
const backend::StatusKind& kind,
const std::string& name,
const backend::StatusLevel& status_level,
const std::string& value,
const std::string& description,
const std::string& guid,
bool delete_if_no_children);

//! Destroy the item. It will destroy every child.
~StatusTreeItem();

Expand All @@ -107,6 +122,12 @@ class StatusTreeItem
//! Return the number of children nodes.
int childCount() const;

//! Return the number of descendant nodes
int descendantCount() const;

//! Return the number of leaf nodes of the subtree rooted at this node
int leafCount() const;

int row() const;

//! Return true if the node is a leaf node (no children).
Expand All @@ -129,10 +150,25 @@ class StatusTreeItem

std::string name_str();

std::string guid_str();

std::string value_str();

std::string description_str();

//! Getter for delete_if_no_children_ attribute
bool get_delete_if_no_children();

//! Setter for delete_if_no_children_ attribute
void set_delete_if_no_children(
bool delete_if_no_children);

//! Check if it has children, and if not, delete it if configured to do so
void delete_if_no_children();

//! Remove item from tree and delete it
void remove();

//! Increases the issues counter of a top level entity item
int recalculate_entity_counter();

Expand All @@ -156,17 +192,37 @@ class StatusTreeItem
backend::EntityId id_;
backend::StatusKind kind_;
std::string name_;
std::string guid_;
backend::StatusLevel status_level_;
std::string value_;
std::string description_;
bool is_active_;
bool delete_if_no_children_;
QVariant id_variant_;
QVariant kind_variant_;
QVariant name_variant_;
QVariant status_level_variant_;
QVariant value_variant_;
QVariant description_variant_;
QVariant is_active_variant_;

///////////////////////
// Signals and slots //
///////////////////////

public slots:

void onItemRemoved(
std::string guid);

signals:

// Notify when the node is removed from the tree
// NOTE: Currently, the signal is only used to communicate item changes between top-level items and leaf items to update the Tree View when an endpoint becomes inactive.
// Signal-slot connections between different types of nodes could lead to unexpected behaviors.
void itemRemoved(
std::string guid);

};

} // namespace models
Expand Down
23 changes: 22 additions & 1 deletion include/fastdds_monitor/model/tree/StatusTreeModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,15 @@ class StatusTreeModel : public QAbstractItemModel
const backend::EntityId& id,
const std::string& data,
const backend::StatusLevel& status,
const std::string& description);
const std::string& description,
const std::string& guid);

void set_source_model(
StatusTreeModel* source_model);

//! Disconnect every item connected to a StatusTreeModel signal
void disconnect_all_item_signals();

/*!
* Filters the model if it is defined as proxy
*/
Expand All @@ -205,6 +209,23 @@ class StatusTreeModel : public QAbstractItemModel
bool is_empty_;

backend::EntityId current_filter_;

///////////////////////
// Signals and Slots //
///////////////////////

public slots:

void onItemRemoved(
std::string guid);

signals:

// Notify when the node is removed from the tree
// NOTE: Currently, the signal is only used to communicate item changes between top-level items and leaf items to update the Status Tree View when an endpoint becomes inactive.
// Signal-slot connections between different types of nodes could lead to unexpected behaviors.
void itemRemoved(
std::string guid);
};

} // namespace models
Expand Down
Loading

0 comments on commit 2da5bb3

Please sign in to comment.