Metric for # of securities watched by MDSource
This commit is contained in:
1 parent
0ce2b9f135
commit
fabb06e87c
1 file changed
+7
-2
@@ -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<metrics::CounterMetric<int>>("spark_mdsource_security_count");
|
||||
_stats.publish(security_count_metric);
|
||||
|
||||
_book_update = make_stream<BookUpdateEvent>();
|
||||
subscribe<MDRequestEvent>([this](auto const &update) {
|
||||
if (update.events)
|
||||
subscribe<MDRequestEvent>([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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user