Skip to content

Commit 4506ad3

Browse files
authored
Report internal DdsRouter information with the DdsPipe's Monitor module (#431)
* Configure the monitoring of topics through the YAML Signed-off-by: tempate <danieldiaz@eprosima.com> * Replace MonitorTopicsConfiguration with MonitorConfiguration Signed-off-by: tempate <danieldiaz@eprosima.com> * Only compile the monitor module on demand Signed-off-by: tempate <danieldiaz@eprosima.com> * Refactor Signed-off-by: tempate <danieldiaz@eprosima.com> * Documentation Signed-off-by: tempate <danieldiaz@eprosima.com> * Minor improvements to the documentation Signed-off-by: tempate <danieldiaz@eprosima.com> * Minor fixes Signed-off-by: tempate <danieldiaz@eprosima.com> * Basic docker test Signed-off-by: tempate <danieldiaz@eprosima.com> * Initialize the Monitor in the right place Signed-off-by: tempate <danieldiaz@eprosima.com> * Apply DdsPipe suggestions Signed-off-by: tempate <danieldiaz@eprosima.com> * Apply suggestions Signed-off-by: tempate <danieldiaz@eprosima.com> * Register participants inside the Monitor Signed-off-by: tempate <danieldiaz@eprosima.com> * Rename frequency to msg_rx_rate Signed-off-by: tempate <danieldiaz@eprosima.com> * Replace monitorize with monitor Signed-off-by: tempate <danieldiaz@eprosima.com> * Apply suggestions Signed-off-by: tempate <danieldiaz@eprosima.com> * Apply suggestions Signed-off-by: tempate <danieldiaz@eprosima.com> * Apply suggestions Signed-off-by: tempate <danieldiaz@eprosima.com> --------- Signed-off-by: tempate <danieldiaz@eprosima.com>
1 parent 29de75f commit 4506ad3

5 files changed

Lines changed: 92 additions & 2 deletions

File tree

ddsrouter_core/include/ddsrouter_core/configuration/SpecsConfiguration.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <ddspipe_core/configuration/DdsPipeConfiguration.hpp>
2323
#include <ddspipe_core/configuration/DdsPipeLogConfiguration.hpp>
2424
#include <ddspipe_core/configuration/IConfiguration.hpp>
25+
#include <ddspipe_core/configuration/MonitorConfiguration.hpp>
2526
#include <ddspipe_core/types/dds/TopicQoS.hpp>
2627

2728
#include <ddsrouter_core/library/library_dll.h>
@@ -74,6 +75,9 @@ struct SpecsConfiguration : public ddspipe::core::IConfiguration
7475

7576
//! Configuration of the DDS Pipe's Log consumers.
7677
ddspipe::core::DdsPipeLogConfiguration log_configuration;
78+
79+
//! Configuration of the DDS Pipe's Monitor.
80+
ddspipe::core::MonitorConfiguration monitor_configuration{};
7781
};
7882

7983
} /* namespace core */

ddsrouter_yaml/src/cpp/YamlReader_configuration.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <ddspipe_yaml/YamlReader.hpp>
2626

2727
#include <ddspipe_core/configuration/DdsPipeConfiguration.hpp>
28+
#include <ddspipe_core/configuration/MonitorConfiguration.hpp>
2829
#include <ddsrouter_core/configuration/DdsRouterConfiguration.hpp>
2930

3031
#include <ddsrouter_yaml/YamlReaderConfiguration.hpp>
@@ -85,6 +86,13 @@ void YamlReader::fill(
8586
object.log_configuration = YamlReader::get<ddspipe::core::DdsPipeLogConfiguration>(yml, LOG_CONFIGURATION_TAG,
8687
version);
8788
}
89+
90+
/////
91+
// Get optional monitor tag
92+
if (YamlReader::is_tag_present(yml, MONITOR_TAG))
93+
{
94+
object.monitor_configuration = YamlReader::get<core::MonitorConfiguration>(yml, MONITOR_TAG, version);
95+
}
8896
}
8997

9098
template <>

docs/rst/notes/forthcoming_version.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
Forthcoming Version
77
###################
88

9-
This release will include the following **Configuration features**:
9+
The next release will include the following **Features**:
10+
11+
* Publish the :ref:`Logs <router_specs_logging>`.
12+
* :ref:`Monitor <user_manual_configuration_specs_monitor>`.
13+
14+
The next release will include the following **Configuration features**:
1015

1116
* New configuration option ``logging`` to configure the :ref:`Logs <router_specs_logging>`.

docs/rst/user_manual/configuration.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,62 @@ The type of the logs published is defined as follows:
493493
publish-type: false
494494
stdout: true
495495
496+
.. _user_manual_configuration_specs_monitor:
497+
498+
Monitor
499+
-------
500+
501+
``specs`` supports a ``monitor`` **optional** tag to publish internal data from the |ddsrouter|.
502+
If the monitor is enabled, it publishes (and logs under the ``MONITOR_DATA`` :ref:`log filter <router_specs_logging>`) the *DDS Router's* internal data on a ``domain``, under a ``topic-name``, once every ``period`` (in milliseconds).
503+
If the monitor is not enabled, the |ddsrouter| will not collect or publish any data.
504+
505+
.. note::
506+
507+
The data published is relative to each period.
508+
The |ddsrouter| will reset its tracked data after publishing it.
509+
510+
511+
In particular, the |ddsrouter| will track the number of messages lost, received, and the message reception rate [Hz] of each topic.
512+
The type of the data published is defined as follows:
513+
514+
**MonitoringTopics.idl**
515+
516+
.. code-block:: idl
517+
518+
struct DdsTopicData
519+
{
520+
string participant_id;
521+
unsigned long msgs_lost;
522+
unsigned long msgs_received;
523+
double msg_rx_rate;
524+
};
525+
526+
struct DdsTopic
527+
{
528+
string name;
529+
string type_name;
530+
boolean type_discovered;
531+
boolean type_mismatch;
532+
boolean qos_mismatch;
533+
sequence<DdsTopicData> data;
534+
};
535+
536+
struct MonitoringTopics
537+
{
538+
sequence<DdsTopic> topics;
539+
};
540+
541+
**Example of usage**
542+
543+
.. code-block:: yaml
544+
545+
monitor:
546+
topics:
547+
enable: true
548+
period: 1000
549+
domain: 10
550+
topic-name: "DdsRouterTopicData"
551+
496552
Participant Configuration
497553
=========================
498554

@@ -948,6 +1004,13 @@ A complete example of all the configurations described on this page can be found
9481004
publish-type: false
9491005
stdout: true
9501006
1007+
monitor:
1008+
topics:
1009+
enable: true
1010+
period: 1000
1011+
domain: 10
1012+
topic-name: "DdsRouterTopicStatistics"
1013+
9511014
# XML configurations to load
9521015
xml:
9531016

tools/ddsrouter_tool/src/cpp/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#include <cpp_utils/utils.hpp>
3030

3131
#include <ddspipe_core/logging/DdsLogConsumer.hpp>
32-
32+
#include <ddspipe_core/monitoring/Monitor.hpp>
33+
#include <ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp>
3334
#include <ddspipe_participants/xml/XmlHandler.hpp>
3435

3536
#include <ddsrouter_core/configuration/DdsRouterConfiguration.hpp>
@@ -232,6 +233,15 @@ int main(
232233
commandline_args.reload_time);
233234
}
234235

236+
// Monitor
237+
auto monitor_configuration = router_configuration.advanced_options.monitor_configuration;
238+
ddspipe::core::Monitor monitor{monitor_configuration};
239+
240+
if (monitor_configuration.producers[ddspipe::core::TOPICS_MONITOR_PRODUCER_ID].enabled)
241+
{
242+
monitor.monitor_topics();
243+
}
244+
235245
// Start Router
236246
router.start();
237247

0 commit comments

Comments
 (0)