1.10. Get status data

Fast DDS Statistics Backend provides a template of get_status_data() to retrieve monitor service status data sample of a given StatusKind (for more information about all the reported StatusKind, please refer to StatusData).

The sample is passed as an argument to the function along with the EntityId of the entity whose status is to be known. This sample is populated with the most recent status data of that kind.

Only PARTICIPANT, DATAWRITER and DATAREADER have associated status data. The following table describes which StatusKind each of these entities has:

StatusKind

PARTICIPANT

DATAWRITER

DATAREADER

PROXY

Yes

Yes

Yes

CONNECTION_LIST

Yes

Yes

Yes

INCOMPATIBLE_QOS

No

Yes

Yes

LIVELINESS_LOST

No

Yes

No

LIVELINESS_CHANGED

No

No

Yes

DEADLINE_MISSED

No

Yes

Yes

SAMPLE_LOST

No

No

Yes

Note

For entity transitions, WARNING status level takes precedence over OK level, and ERROR does over WARNING and OK levels.

get_status_data() throws BadParameter in the following cases:

  • If the EntityId does not reference a Entity contained in the database.

  • If there is no specialization template for the requested StatusKind.

  • If the EntityKind of the Entity doesn’t have the associated StatusKind.

Every time new status data is available there will be a callback to Domain Listener’s on_status_reported() (for more information about DomainListener callbacks, please refer to DomainListener).

1.10.1. Examples

Following, some example queries are provided to serve a inspiration for applications using Fast DDS Statistics Backend.

1.10.1.1. Proxy example

/*
 * Get the proxy info associated to an entity.
 */
ProxySample proxy_sample;
StatisticsBackend::get_status_data(
    entity_id,                                                   // EntityId (DomainParticipant, DataWriter or DataReader)
    proxy_sample);                                               // Sample to be populated

1.10.1.2. Connection List example

/*
 * Get the connection list sample associated to an entity.
 */
ConnectionListSample connection_list_sample_;
StatisticsBackend::get_status_data(
    entity_id,                                                   // EntityId (DomainParticipant, DataWriter or DataReader)
    connection_list_sample_);                                    // Sample to be populated

1.10.1.3. Incompatible QoS example

/*
 * Get the incompatible qos info associated to an entity.
 */
IncompatibleQosSample incompatible_qos_sample;
StatisticsBackend::get_status_data(
    entity_id,                                                   // EntityId (DataWriter or DataReader)
    incompatible_qos_sample);                                    // Sample to be populated

1.10.1.4. Liveliness Lost example

/*
 * Get the liveliness lost info associated to an entity.
 */
LivelinessLostSample liveliness_lost_sample;
StatisticsBackend::get_status_data(
    entity_id,                                                   // EntityId (DataWriter)
    liveliness_lost_sample);                                     // Sample to be populated

1.10.1.5. Liveliness Changed example

/*
 * Get the liveliness changed info associated to an entity.
 */
LivelinessChangedSample liveliness_changed_sample;
StatisticsBackend::get_status_data(
    entity_id,                                                   // EntityId (DataReader)
    liveliness_changed_sample);                                  // Sample to be populated

1.10.1.6. Deadline Missed example

/*
 * Get the deadline missed info associated to an entity.
 */
DeadlineMissedSample deadline_missed_sample;
StatisticsBackend::get_status_data(
    entity_id,                                                   // EntityId (DataWriter or DataReader)
    deadline_missed_sample);                                     // Sample to be populated

1.10.1.7. Sample Lost example

/*
 * Get the sample lost info associated to an entity.
 */
SampleLostSample sample_lost_sample;
StatisticsBackend::get_status_data(
    entity_id,                                                   // EntityId (DataWriter or DataReader)
    sample_lost_sample);                                         // Sample to be populated