|
21 | 21 | #include "Framework/TableConsumer.h" |
22 | 22 | #include "Framework/DataOutputDirector.h" |
23 | 23 | #include "Framework/TableTreeHelpers.h" |
| 24 | +#include "Framework/Monitoring.h" |
24 | 25 |
|
| 26 | +#include <Monitoring/Monitoring.h> |
25 | 27 | #include <TFile.h> |
26 | 28 | #include <TFile.h> |
27 | 29 | #include <TTree.h> |
@@ -235,6 +237,7 @@ AlgorithmSpec AODWriterHelpers::getOutputTTreeWriter(ConfigContext const& ctx) |
235 | 237 |
|
236 | 238 | AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& ctx) |
237 | 239 | { |
| 240 | + using namespace monitoring; |
238 | 241 | auto& ac = ctx.services().get<AnalysisContext>(); |
239 | 242 | auto tskmap = ac.outTskMap; |
240 | 243 | auto objmap = ac.outObjHistMap; |
@@ -269,7 +272,7 @@ AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& ctx) |
269 | 272 |
|
270 | 273 | callbacks.set<CallbackService::Id::EndOfStream>(endofdatacb); |
271 | 274 | return [inputObjects, objmap, tskmap](ProcessingContext& pc) mutable -> void { |
272 | | - auto mergePart = [&inputObjects, &objmap, &tskmap](DataRef const& ref) { |
| 275 | + auto mergePart = [&inputObjects, &objmap, &tskmap, &pc](DataRef const& ref) { |
273 | 276 | if (!ref.header) { |
274 | 277 | LOG(error) << "Header not found"; |
275 | 278 | return; |
@@ -381,7 +384,13 @@ AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& ctx) |
381 | 384 | if (object->InheritsFrom(TList::Class())) { |
382 | 385 | writeListToFile(static_cast<TList*>(object), parentDir->mkdir(object->GetName(), object->GetName(), true)); |
383 | 386 | } else { |
384 | | - parentDir->WriteObjectAny(object, object->Class(), object->GetName()); |
| 387 | + int objSize = parentDir->WriteObjectAny(object, object->Class(), object->GetName()); |
| 388 | + static int maxSizeWritten = 0; |
| 389 | + if (objSize > maxSizeWritten) { |
| 390 | + auto& monitoring = pc.services().get<Monitoring>(); |
| 391 | + maxSizeWritten = objSize; |
| 392 | + monitoring.send(Metric{fmt::format("{}/{}:{}", object->ClassName(), object->GetName(), objSize), "aod-largest-object-written"}.addTag(tags::Key::Subsystem, tags::Value::DPL)); |
| 393 | + } |
385 | 394 | auto* written = list->Remove(object); |
386 | 395 | delete written; |
387 | 396 | } |
|
0 commit comments