From fabb06e87c4f2253cc13775605202f38ff3fb8a2 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Thu, 6 Sep 2018 18:07:44 -0400 Subject: [PATCH] Metric for # of securities watched by MDSource --- src/lib/orderman/actors/MDSource.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/orderman/actors/MDSource.h b/src/lib/orderman/actors/MDSource.h index ea2690d7e..a264cf699 100644 --- a/src/lib/orderman/actors/MDSource.h +++ b/src/lib/orderman/actors/MDSource.h @@ -42,9 +42,12 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { "spark_metrics_md_loop_us",buckets); _stats.publish(_loop_timer); + auto security_count_metric = std::make_shared>("spark_mdsource_security_count"); + _stats.publish(security_count_metric); + _book_update = make_stream(); - subscribe([this](auto const &update) { - if (update.events) + subscribe([this,security_count_metric](auto const &update) { + if (update.events) { for (auto const &ev : *update.events) { auto k = ev.security_key.value(); @@ -61,6 +64,8 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { auto handle = _md_consumer.get_handle(k); _handles.push_back({utils::TimeStamp(), handle}); } + security_count_metric->set(_handles.size()); + } }); }