diag: Add logs around synthetic security discovery in MDConsumer
This commit is contained in:
1 parent
d947882b0e
commit
97e4276e20
1 file changed
+20
-1
@@ -179,6 +179,7 @@ class SyntheticConsumerInst {
|
||||
// update security metadata
|
||||
auto iter = _data.find(m.security_key());
|
||||
if (iter != _data.end()) {
|
||||
LOG(md, Info, "Received synth metadata. {}", m.DebugString());
|
||||
auto updated = std::make_unique<spark::ExecutionStrategy>();
|
||||
updated->CopyFrom(m.strategy());
|
||||
iter->second->strategy.swap(updated);
|
||||
@@ -188,6 +189,9 @@ class SyntheticConsumerInst {
|
||||
// memory
|
||||
if (updated != nullptr)
|
||||
_old_strategies.push_back(std::move(updated));
|
||||
} else {
|
||||
LOG(md, Warn, "Received metadata for unknown or unresolved synth. {}",
|
||||
m.DebugString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +246,8 @@ class SyntheticConsumerInst {
|
||||
// If we found all the legs
|
||||
if (legs.size() ==
|
||||
(size_t)strategy.security->synthetic().legs_size()) {
|
||||
LOG(md, Info, "Resolved leg keys for synth: {} {}",
|
||||
strategy.security->exchange(), *strategy.security);
|
||||
auto s = make_shared<SyntheticStrategy>();
|
||||
s->security.CopyFrom(*strategy.security);
|
||||
s->strategy = std::make_unique<spark::ExecutionStrategy>(
|
||||
@@ -249,6 +255,9 @@ class SyntheticConsumerInst {
|
||||
s->legs = legs;
|
||||
s->updated = utils::TimeStamp::now();
|
||||
result.insert(make_pair(strategy.security->id(), s));
|
||||
} else {
|
||||
LOG(md, Warn, "Did not resolve leg keys for synth: {} {}",
|
||||
strategy.security->exchange(), *strategy.security);
|
||||
}
|
||||
}
|
||||
// iterate as long as progress is made
|
||||
@@ -268,6 +277,8 @@ class SyntheticConsumerInst {
|
||||
}
|
||||
|
||||
void add_snapshot(const vector<shared_ptr<Security>> &securities) {
|
||||
LOG(md, Info, "Adding synthetic snapshot. num_secs: {}",
|
||||
securities.size());
|
||||
std::vector<IncompleteStrategy> strategies;
|
||||
for (const auto &sec : securities) {
|
||||
if (_data.find(sec->id()) == _data.end()) {
|
||||
@@ -279,10 +290,18 @@ class SyntheticConsumerInst {
|
||||
// put strategies that are incomplete into a backlog
|
||||
for (const auto &s : strategies) {
|
||||
if (handles.find(s.security->id()) == handles.end()) {
|
||||
LOG(md, Warn, "Adding unresolved synth to backlog {} {}",
|
||||
s.security->exchange(), *s.security);
|
||||
_pending.push_back(s.security);
|
||||
}
|
||||
}
|
||||
_data.insert(handles.begin(), handles.end());
|
||||
if (!handles.empty()) {
|
||||
for (auto &[k, v] : handles) {
|
||||
LOG(md, Warn, "Adding resolved synths to data. {} {} key: {}",
|
||||
v->security.exchange(), v->security, k);
|
||||
}
|
||||
_data.insert(handles.begin(), handles.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user