eProsima / Fast-DDS-monitor

eProsima Fast DDS Monitor is a graphical desktop application aimed at monitoring DDS environments deployed using the eProsima Fast DDS library. Looking for commercial support? Contact info@eprosima.com
https://eprosima.com
GNU General Public License v3.0
40 stars 10 forks source link

Fast-DDS Monitor has no statistics (when using Data Sharing) #160

Closed Heyangq closed 2 years ago

Heyangq commented 2 years ago

3b9530049d07153880619e102bbe976 The program runs and finds publishers and subscribers, but there are no statistics!!!!

Heyangq commented 2 years ago

FastDDS-Statistics is already installed . Mind that Fast DDS built with a specific CMake flag -DFASTDDS_STATISTICS=ON . However, there are still no statistics .

OS: Ubuntu 18.04 No ROS Hope to receive a reply, thank you !

jparisu commented 2 years ago

Hi @Heyangq

We would need more information about your scenario: how the Publisher and Subscriber are executed, which other CMake options are used, Fast DDS version, etc.

My guess with the available information is that you did not activate the Statistics Topics, so the DDS Entities are not publishing Statistics Data, and thus the Monitor is not able to see it. You need to activate those topics that you want to monitor by code, by XML or using a ENV VAR: Check the following documentation to know how to do this: https://fast-dds.docs.eprosima.com/en/latest/fastdds/statistics/dds_layer/domainParticipant.html

Heyangq commented 2 years ago

嗨@Heyangq

我们需要有关你的方案的详细信息:如何执行发布服务器和订阅服务器,使用哪些其他 CMake 选项、快速 DDS 版本等。

根据可用信息,我的猜测是您没有激活统计信息主题,因此 DDS 实体未发布统计数据,因此监视器无法看到它。您需要激活要通过代码、XML 或使用 ENV VAR 监视的主题:查看以下文档以了解如何执行此操作:https://fast-dds.docs.eprosima.com/en/latest/fastdds/statistics/dds_layer/domainParticipant.html

I found the answer to this question because I used the discovery server

How can I get the data statistics in the discovery server

Heyangq commented 2 years ago

嗨@Heyangq

我们需要有关你的方案的详细信息:如何执行发布服务器和订阅服务器,使用哪些其他 CMake 选项、快速 DDS 版本等。

根据可用信息,我的猜测是您没有激活统计信息主题,因此 DDS 实体未发布统计数据,因此监视器无法看到它。您需要激活要通过代码、XML 或使用 ENV VAR 监视的主题:查看以下文档以了解如何执行此操作:https://fast-dds.docs.eprosima.com/en/latest/fastdds/statistics/dds_layer/domainParticipant.html

I want to get the data frequency of publishers and subscribers connected to the discovery server

What should I do?

jparisu commented 2 years ago

The Fast DDS Monitor support connections to Discovery Servers. Use button File -> Initialize Discovery Server Monitor and there you can set the GUID and address of your server. Check following documentation for more information: https://fast-dds-monitor.readthedocs.io/en/latest/rst/getting_started/monitor.html#discovery-server-monitor

Heyangq commented 2 years ago

The Fast DDS Monitor support connections to Discovery Servers. Use button and there you can set the GUID and address of your server. Check following documentation for more information: https://fast-dds-monitor.readthedocs.io/en/latest/rst/getting_started/monitor.html#discovery-server-monitor`File -> Initialize Discovery Server Monitor`

Thank you for your reply. I found the publishers and subscribers in the discovery server But it still has no statistics

The code section on initialization is as follows:

DomainParticipantQos participantQos;
participantQos.name(type_name+"Publisher");

participantQos.wire_protocol().builtin.discovery_config.discoveryProtocol =
    eprosima::fastrtps::rtps::DiscoveryProtocol_t::CLIENT;

eprosima::fastrtps::rtps::RemoteServerAttributes remote_server_att;
remote_server_att.ReadguidPrefix(local_server_prefix.c_str());
eprosima::fastrtps::rtps::Locator_t locator;
eprosima::fastrtps::rtps::IPLocator::setIPv4(locator, IPv4_IP[0], IPv4_IP[1], IPv4_IP[2], IPv4_IP[3]);
locator.port = local_port;
remote_server_att.metatrafficUnicastLocatorList.push_back(locator);

participantQos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(remote_server_att);

participantQos.wire_protocol().builtin.discovery_config.discoveryServer_client_syncperiod = client_syncperiod*1e-3;

participant_ = DomainParticipantFactory::get_instance()->create_participant(domain_value, 
                                                                            participantQos);
if(!participant_)
    return false;

eprosima::fastdds::statistics::dds::DomainParticipant* statistics_participant =
    eprosima::fastdds::statistics::dds::DomainParticipant::narrow(participant_);

type_.register_type(participant_);

PublisherQos pQos = PUBLISHER_QOS_DEFAULT;
std::vector< std::string > partition_names;
for(std::string name: partition_names1)
{
    partition_names.push_back(name);
}
pQos.partition().set_max_size(partition_max_sizes);
pQos.partition().setNames(partition_names);
publisher_ = participant_->create_publisher(pQos, nullptr);
if(!publisher_)
    return false;

// TopicQos tQos;
// tQos.reliability().kind = RELIABLE_RELIABILITY_QOS;
// tQos.history().depth = 100;
topic_ = participant_->create_topic(type_name+"Topic", 
                                    type_name, 
                                    TOPIC_QOS_DEFAULT);
if(!topic_)
    return false;

DataWriterQos wQos = DATAWRITER_QOS_DEFAULT;
wQos.reliability().kind = datawriter_qos_reliability_kind;
wQos.reliability().max_blocking_time = datawriter_qos_reliability_blockingtime;
wQos.history().depth = datawriter_qos_history_depth;
wQos.liveliness().kind = datawriter_qos_liveliness_kind;
wQos.liveliness().lease_duration = 
                    eprosima::fastrtps::Duration_t(datawriter_qos_liveliness_lease_duration*1e-3);
wQos.liveliness().announcement_period = 
                    eprosima::fastrtps::Duration_t(datawriter_qos_liveliness_announcement_period*1e-3);
wQos.lifespan().duration = 
                    eprosima::fastrtps::Duration_t(datawriter_qos_lifespan_duration*1e-3);
wQos.deadline().period = 
                    eprosima::fastrtps::Duration_t(datawriter_qos_deadline_period*1e-3);
wQos.resource_limits().max_samples = datawriter_qos_resource_limits_max_samples;
wQos.resource_limits().max_instances = datawriter_qos_resource_limits_max_instances;
wQos.resource_limits().max_samples_per_instance = datawriter_qos_resource_limits_max_samples_per_instance;
wQos.resource_limits().allocated_samples = datawriter_qos_resource_limits_allocated_samples;
wQos.resource_limits().extra_samples = datawriter_qos_resource_limits_extra_samples;
writer_ = publisher_->create_datawriter(topic_, wQos, &listener_);
// writer_ = publisher_->create_datawriter(topic_, DATAWRITER_QOS_DEFAULT, &listener_);
if(!writer_)
    return false;
if (statistics_participant->enable_statistics_datawriter(eprosima::fastdds::statistics::DATA_COUNT_TOPIC,
    eprosima::fastdds::statistics::dds::STATISTICS_DATAWRITER_QOS) != ReturnCode_t::RETCODE_OK)
{
    std::cout << "XXXXX" << std::endl;
    return false;
}
Heyangq commented 2 years ago

111

Heyangq commented 2 years ago

I'm sure that when I don't use the discovery server, it has statistics . Mind that Fast DDS built with a specific CMake flag -DFASTDDS_STATISTICS=ON .

Is the discovery server unable to perform data statistics ?

jparisu commented 2 years ago

Please, check the following in order for us to find the problem:

  1. Press View -> Show metatraffic entities and then you shoud be able to see the Statistics Data Writers from your Participants. Please, check that DataWriters exist for the topics you want to monitor.

  2. Is your Data Type plain? If you are not familiar with DataTypes and whether they are treated as plain or not, please send us your .idl file where your data is described. However, this information could be seen in the PubSubTypes.h autogenerated from Fast DDS Gen under a method call is_plain().

  3. Are you using Shared Memory Transport? If you are not familiar with it, this is used by default if no CMake options nor QoS are set explicitly disabling it, and only if both Participants are running in the same machine. Would be possible to execute your scenario between 2 different machines? So to check if that behaves differently.

Heyangq commented 2 years ago

请检查以下内容,以便我们找到问题:

  1. 按下,然后您应该能够看到参与者的统计数据编写器。请检查要监视的主题是否存在 DataWriters。View -> Show metatraffic entities
  2. 您的数据类型是?如果您不熟悉 DataTypes 以及它们是否被视为普通,请将您的数据描述文件发送给我们。但是,此信息可以在方法调用下从Fast DDS Gen自动生成的PubSubTypes.h中看到。plain``.idl``is_plain()
  3. 您正在使用 ?如果您不熟悉它,则默认情况下,如果未显式设置 CMake 选项或 QoS 来禁用它,并且仅当两个参与者在同一台计算机中运行时,才会使用它。是否可以在 2 台不同的计算机之间执行你的方案?因此,请检查其行为是否不同。Shared Memory Transport

Datatype is generated by fast DDS Gen

Datawriters detected 555

Heyangq commented 2 years ago

After publishers and subscribers join the discovery server, data interaction can be realized

However, the statistical information of the data is not shown

I want to get the frequency of data interaction

Heyangq commented 2 years ago

Please, check the following in order for us to find the problem:

  1. Press View -> Show metatraffic entities and then you shoud be able to see the Statistics Data Writers from your Participants. Please, check that DataWriters exist for the topics you want to monitor.
  2. Is your Data Type plain? If you are not familiar with DataTypes and whether they are treated as plain or not, please send us your .idl file where your data is described. However, this information could be seen in the PubSubTypes.h autogenerated from Fast DDS Gen under a method call is_plain().
  3. Are you using Shared Memory Transport? If you are not familiar with it, this is used by default if no CMake options nor QoS are set explicitly disabling it, and only if both Participants are running in the same machine. Would be possible to execute your scenario between 2 different machines? So to check if that behaves differently.

My datawriter can search, but there is no datareader information. Is this the reason why there is no statistical data?

666

Heyangq commented 2 years ago

Please, check the following in order for us to find the problem:

  1. Press View -> Show metatraffic entities and then you shoud be able to see the Statistics Data Writers from your Participants. Please, check that DataWriters exist for the topics you want to monitor.
  2. Is your Data Type plain? If you are not familiar with DataTypes and whether they are treated as plain or not, please send us your .idl file where your data is described. However, this information could be seen in the PubSubTypes.h autogenerated from Fast DDS Gen under a method call is_plain().
  3. Are you using Shared Memory Transport? If you are not familiar with it, this is used by default if no CMake options nor QoS are set explicitly disabling it, and only if both Participants are running in the same machine. Would be possible to execute your scenario between 2 different machines? So to check if that behaves differently.

Thank you very much for your help. I found the problem. When you open it on different hosts, there will be statistics of data

It is most likely that shared memory is used in the same host. How can I shield this mode?

Heyangq commented 2 years ago

I hope to get the frequency of data publishing and subscription, but when I send data at 100Hz, his statistics update is extremely slow. I hope to get a solution to this problem 777

jparisu commented 2 years ago

Hi @Heyangq

My datawriter can search, but there is no datareader information. Is this the reason why there is no statistical data?

This is not a problem. Every Participant with Statistics activated have only DataWriter statistics so it sends the instrumentation data to the Monitor. DataReaders are only in the monitor, that is the one reading them.

Thank you very much for your help. I found the problem. When you open it on different hosts, there will be statistics of data It is most likely that shared memory is used in the same host. How can I shield this mode?

( @jsantiago-eProsima , this may be of your interest) We have been testing some scenarios and it seems that there is a problem when using Data Sharing (Shared Memory with bounded data types). I suggest you to wait until we have a fix for it. However, there are different possibilities to deactivate Shared Memory, but be aware that this will be less efficient when communicating entities in the same host:

I hope to get the frequency of data publishing and subscription, but when I send data at 100Hz, his statistics update is extremely slow. I hope to get a solution to this problem

The Data Count is calculated by adding each data that is sent. The peak that you see in the chart is the moment when the Monitor receives the first DataCount from the DataWriter, and it joins all the datas that has been sent and not notified to the Monitor. It looks like the chart is full of zeros, but this may be because the y-axis is too high. Changing the chart axis (or waiting till this peak dissapears on the left) will let you see the actual data that is being monitorized. Play with different time windows and different StatisticsKinds (MEAN, SUM, etc.) in order to correctly see your data.

Heyangq commented 2 years ago

Hi @Heyangq

My datawriter can search, but there is no datareader information. Is this the reason why there is no statistical data?

This is not a problem. Every Participant with Statistics activated have only DataWriter statistics so it sends the instrumentation data to the Monitor. DataReaders are only in the monitor, that is the one reading them.

Thank you very much for your help. I found the problem. When you open it on different hosts, there will be statistics of data It is most likely that shared memory is used in the same host. How can I shield this mode?

( @jsantiago-eProsima , this may be of your interest) We have been testing some scenarios and it seems that there is a problem when using Data Sharing (Shared Memory with bounded data types). I suggest you to wait until we have a fix for it. However, there are different possibilities to deactivate Shared Memory, but be aware that this will be less efficient when communicating entities in the same host:

I hope to get the frequency of data publishing and subscription, but when I send data at 100Hz, his statistics update is extremely slow. I hope to get a solution to this problem

The Data Count is calculated by adding each data that is sent. The peak that you see in the chart is the moment when the Monitor receives the first DataCount from the DataWriter, and it joins all the datas that has been sent and not notified to the Monitor. It looks like the chart is full of zeros, but this may be because the y-axis is too high. Changing the chart axis (or waiting till this peak dissapears on the left) will let you see the actual data that is being monitorized. Play with different time windows and different StatisticsKinds (MEAN, SUM, etc.) in order to correctly see your data.

I hope it can notify the monitor to update the data within 1 second. How do I need to implement it? Because I need to obtain the frequency of data publishing and subscription in real time (some publishers will publish high-frequency data at the same time -----500Hz) I hope to see from the monitor whether my publish frequency has reached 500HZ

jparisu commented 2 years ago

The way Fast DDS entities publish their statistics is not customizable. The DATA_COUNT, for instance, is published in "pseudo-random" time intervals whenever data has been sent. This means that the Monitor is not able to tell you exactly the amount of data sent in one specific second. However, the Monitor can get all the data received in a topic (DATA_COUNT for instance) and do a Statistical operation, so you get information of what has happend along this second.

For your scenario, I would use a dynamical chart https://fast-dds-monitor.readthedocs.io/en/latest/rst/user_manual/chart_panel/dynamic_series.html in DATA_COUNT topic with 1 second of update period https://fast-dds-monitor.readthedocs.io/en/latest/rst/user_manual/chart_panel/dynamic_series.html#update-period and using SUM as Statistical Kind https://fast-dds-monitor.readthedocs.io/en/latest/rst/user_manual/chart_panel/chart_panel.html#statistics-kind This will show you a chart where each second you will see the addition of the number of data sent in the last second. I think this is what you are seeking.

As this is no longer related with the issue mentioned before, if you have further questions on how to use the Monitor, please open a different Discussion: https://github.com/eProsima/Fast-DDS-monitor/discussions/new