+ const lttng::pthread::lock_guard consumer_data_lock(the_consumer_data.lock);
+ const auto ht = the_consumer_data.stream_list_ht;
+
+ /*
+ * We only need a reference to the channel, but they are not
+ * directly indexed, so we just use the first matching stream
+ * to extract the information we need, we default to 0 if not
+ * found (no events are dropped if the channel is not yet in
+ * use).
+ */
+ discarded_events = 0;
+ for (auto *stream : lttng::urcu::lfht_filtered_iteration_adapter<
+ lttng_consumer_stream,
+ decltype(lttng_consumer_stream::node_channel_id),
+ <tng_consumer_stream::node_session_id,
+ std::uint64_t>(*ht->ht,
+ &id,
+ ht->hash_fct(&id, lttng_ht_seed),
+ ht->match_fct)) {
+ if (stream->chan->key == key) {
+ discarded_events = stream->chan->discarded_events;
+ break;
+ }