Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20739] Refactor IStatusQueryable and make monitor service interfaces private #4651

Merged
merged 10 commits into from
Apr 17, 2024
9 changes: 8 additions & 1 deletion include/fastdds/rtps/builtin/discovery/participant/PDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <fastdds/rtps/participant/ParticipantDiscoveryInfo.h>
#include <fastdds/rtps/reader/ReaderDiscoveryInfo.h>
#include <fastdds/rtps/writer/WriterDiscoveryInfo.h>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IProxyObserver.hpp>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IProxyQueryable.hpp>
#include <fastrtps/qos/QosPolicies.h>
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>
Expand All @@ -42,6 +41,14 @@
namespace eprosima {

namespace fastdds {
namespace statistics {
namespace rtps {

struct IProxyObserver;

} // namespace rtps
} // namespace statistics

namespace rtps {

class PDPServerListener;
Expand Down
5 changes: 1 addition & 4 deletions include/fastdds/rtps/reader/RTPSReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
#include <fastdds/rtps/Endpoint.h>
#include <fastdds/rtps/history/ReaderHistory.h>
#include <fastdds/rtps/interfaces/IReaderDataFilter.hpp>
#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsQueryable.hpp>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsObserver.hpp>
#endif // ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/connections_fwd.hpp>
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#include <fastrtps/qos/LivelinessChangedStatus.h>
#include <fastrtps/utils/TimedConditionVariable.hpp>
Expand Down
5 changes: 1 addition & 4 deletions include/fastdds/rtps/writer/RTPSWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
#include <fastdds/rtps/Endpoint.h>
#include <fastdds/rtps/interfaces/IReaderDataFilter.hpp>
#include <fastdds/rtps/messages/RTPSMessageGroup.h>
#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsObserver.hpp>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsQueryable.hpp>
#endif // ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/connections_fwd.hpp>
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#include <fastrtps/qos/LivelinessLostStatus.h>

Expand Down
186 changes: 93 additions & 93 deletions include/fastdds/statistics/monitorservice_types.idl
Original file line number Diff line number Diff line change
Expand Up @@ -22,99 +22,99 @@ module eprosima {
module fastdds {
module statistics {

enum ConnectionMode
{
DATA_SHARING,
INTRAPROCESS,
TRANSPORT
};

struct Connection
{
ConnectionMode mode;
detail::GUID_s guid;
sequence<detail::Locator_s> announced_locators;
sequence<detail::Locator_s> used_locators;
};

struct QosPolicyCount_s
{
unsigned long policy_id;
unsigned long count;
};

struct BaseStatus_s
{
unsigned long total_count;
};

typedef sequence<QosPolicyCount_s> QosPolicyCountSeq_s;

struct IncompatibleQoSStatus_s
{
unsigned long total_count;
unsigned long last_policy_id;
QosPolicyCountSeq_s policies;
};

struct LivelinessChangedStatus_s
{
unsigned long alive_count;
unsigned long not_alive_count;
octet last_publication_handle[16];
};

struct DeadlineMissedStatus_s
{
unsigned long total_count;
octet last_instance_handle[16];
};

typedef BaseStatus_s LivelinessLostStatus_s;
typedef BaseStatus_s InconsistentTopicStatus_s;
typedef BaseStatus_s SampleLostStatus_s;

enum StatusKind
{
PROXY,
CONNECTION_LIST,
INCOMPATIBLE_QOS,
INCONSISTENT_TOPIC,
LIVELINESS_LOST,
LIVELINESS_CHANGED,
DEADLINE_MISSED,
SAMPLE_LOST,
STATUSES_SIZE
};

union MonitorServiceData switch(StatusKind)
{
case PROXY:
sequence<octet> entity_proxy;
case CONNECTION_LIST:
sequence<Connection> connection_list;
case INCOMPATIBLE_QOS:
IncompatibleQoSStatus_s incompatible_qos_status;
case INCONSISTENT_TOPIC:
InconsistentTopicStatus_s inconsistent_topic_status;
case LIVELINESS_LOST:
LivelinessLostStatus_s liveliness_lost_status;
case LIVELINESS_CHANGED:
LivelinessChangedStatus_s liveliness_changed_status;
case DEADLINE_MISSED:
DeadlineMissedStatus_s deadline_missed_status;
case SAMPLE_LOST:
SampleLostStatus_s sample_lost_status;
case STATUSES_SIZE:
octet statuses_size;
};

struct MonitorServiceStatusData
{
@Key detail::GUID_s local_entity;
@Key StatusKind status_kind;
MonitorServiceData value;
};
enum ConnectionMode
{
DATA_SHARING,
INTRAPROCESS,
TRANSPORT
};

struct Connection
{
ConnectionMode mode;
detail::GUID_s guid;
sequence<detail::Locator_s> announced_locators;
sequence<detail::Locator_s> used_locators;
};

struct QosPolicyCount_s
{
unsigned long policy_id;
unsigned long count;
};

struct BaseStatus_s
{
unsigned long total_count;
};

typedef sequence<QosPolicyCount_s> QosPolicyCountSeq_s;

struct IncompatibleQoSStatus_s
{
unsigned long total_count;
unsigned long last_policy_id;
QosPolicyCountSeq_s policies;
};

struct LivelinessChangedStatus_s
{
unsigned long alive_count;
unsigned long not_alive_count;
octet last_publication_handle[16];
};

struct DeadlineMissedStatus_s
{
unsigned long total_count;
octet last_instance_handle[16];
};

typedef BaseStatus_s LivelinessLostStatus_s;
typedef BaseStatus_s InconsistentTopicStatus_s;
typedef BaseStatus_s SampleLostStatus_s;

enum StatusKind
{
PROXY,
CONNECTION_LIST,
INCOMPATIBLE_QOS,
INCONSISTENT_TOPIC,
LIVELINESS_LOST,
LIVELINESS_CHANGED,
DEADLINE_MISSED,
SAMPLE_LOST,
STATUSES_SIZE
};

union MonitorServiceData switch(StatusKind)
{
case PROXY:
sequence<octet> entity_proxy;
case CONNECTION_LIST:
sequence<Connection> connection_list;
case INCOMPATIBLE_QOS:
IncompatibleQoSStatus_s incompatible_qos_status;
case INCONSISTENT_TOPIC:
InconsistentTopicStatus_s inconsistent_topic_status;
case LIVELINESS_LOST:
LivelinessLostStatus_s liveliness_lost_status;
case LIVELINESS_CHANGED:
LivelinessChangedStatus_s liveliness_changed_status;
case DEADLINE_MISSED:
DeadlineMissedStatus_s deadline_missed_status;
case SAMPLE_LOST:
SampleLostStatus_s sample_lost_status;
case STATUSES_SIZE:
octet statuses_size;
};

struct MonitorServiceStatusData
{
@Key detail::GUID_s local_entity;
@Key StatusKind status_kind;
MonitorServiceData value;
};

}; // namespace statisitcs
}; // namespace fastdds
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// 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.

/**
* @file connections_fwd.hpp
*
*/

#ifndef _FASTDDS_STATISTICS_MONITOR_SERVICE_CONNECTION_FWD_HPP_
#define _FASTDDS_STATISTICS_MONITOR_SERVICE_CONNECTION_FWD_HPP_

namespace eprosima {
namespace fastdds {
namespace statistics {

class Connection;

namespace rtps {

using ConnectionList = std::vector<eprosima::fastdds::statistics::Connection>;

} // rtps
} // statistics
} // fastdds
} // eprosima

#endif // _FASTDDS_STATISTICS_MONITOR_SERVICE_CONNECTION_FWD_HPP_
31 changes: 24 additions & 7 deletions src/cpp/fastdds/publisher/PublisherImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,7 @@ PublisherListener* PublisherImpl::get_listener_for(

#ifdef FASTDDS_STATISTICS
bool PublisherImpl::get_monitoring_status(
const uint32_t& status_id,
statistics::rtps::DDSEntityStatus*& status,
statistics::MonitorServiceData& status,
const fastrtps::rtps::GUID_t& entity_guid)
{
bool ret = false;
Expand All @@ -682,11 +681,21 @@ bool PublisherImpl::get_monitoring_status(
{
if (writer->guid() == entity_guid)
{
switch (status_id)
switch (status._d())
{
case statistics::INCOMPATIBLE_QOS:
{
writer->get_offered_incompatible_qos_status(*static_cast<OfferedIncompatibleQosStatus*>(status));
OfferedIncompatibleQosStatus incompatible_qos_status;
writer->get_offered_incompatible_qos_status(incompatible_qos_status);
status.incompatible_qos_status().total_count(incompatible_qos_status.total_count);
status.incompatible_qos_status().last_policy_id(incompatible_qos_status.last_policy_id);
for (auto& qos : incompatible_qos_status.policies)
{
statistics::QosPolicyCount_s count;
count.count(qos.count);
count.policy_id(qos.policy_id);
status.incompatible_qos_status().policies().push_back(count);
}
ret = true;
break;
}
Expand All @@ -699,19 +708,27 @@ bool PublisherImpl::get_monitoring_status(
}*/
case statistics::LIVELINESS_LOST:
{
writer->get_liveliness_lost_status(*static_cast<LivelinessLostStatus*>(status));
LivelinessLostStatus liveliness_lost_status;
writer->get_liveliness_lost_status(liveliness_lost_status);
status.liveliness_lost_status().total_count(liveliness_lost_status.total_count);
ret = true;
break;
}
case statistics::DEADLINE_MISSED:
{
writer->get_offered_deadline_missed_status(*static_cast<DeadlineMissedStatus*>(status));
DeadlineMissedStatus deadline_missed_status;
writer->get_offered_deadline_missed_status(deadline_missed_status);
status.deadline_missed_status().total_count(deadline_missed_status.total_count);
std::memcpy(
status.deadline_missed_status().last_instance_handle().data(),
deadline_missed_status.last_instance_handle.value,
16);
ret = true;
break;
}
default:
{
EPROSIMA_LOG_ERROR(PUBLISHER, "Queried status not available for this entity " << status_id);
EPROSIMA_LOG_ERROR(PUBLISHER, "Queried status not available for this entity " << status._d());
break;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/cpp/fastdds/publisher/PublisherImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <map>

#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/interfaces/IStatusQueryable.hpp>
#include <statistics/rtps/monitor-service/interfaces/IStatusQueryable.hpp>
#endif // ifdef FASTDDS_STATISTICS

using eprosima::fastrtps::types::ReturnCode_t;
Expand Down Expand Up @@ -206,8 +206,7 @@ class PublisherImpl

#ifdef FASTDDS_STATISTICS
bool get_monitoring_status(
const uint32_t& status_id,
statistics::rtps::DDSEntityStatus*& status,
statistics::MonitorServiceData& status,
const fastrtps::rtps::GUID_t& entity_guid);
#endif //FASTDDS_STATISTICS

Expand Down
Loading
Loading