8 #include "EventFilter/StorageManager/src/ConsumerWebPageHelper.icc"
10 #include <boost/pointer_cast.hpp>
17 xdaq::ApplicationDescriptor* appDesc,
21 stateMachine_(stateMachine),
40 getDataRetrieverMonitorCollection().getSummaryStats(summaryStats);
100 "DQM Event Processor",
107 stateMachine_->getStatisticsReporter()->getDQMEventMonitorCollection();
124 std::string
url = appDescriptor_->getContextDescriptor()->getURL()
125 +
"/" + appDescriptor_->getURN();
132 linkAttr[
"href" ] =
url;
133 link = maker.
addNode(
"a", parent, linkAttr);
134 maker.
addText(link,
"Main web page");
138 linkAttr[
"href" ] = url +
"/dataRetriever";
139 link = maker.
addNode(
"a", parent, linkAttr);
140 maker.
addText(link,
"Data retriever web page");
144 linkAttr[
"href" ] = url +
"/dqmEventStatistics";
145 link = maker.
addNode(
"a", parent, linkAttr);
146 maker.
addText(link,
"DQM event processor statistics");
150 linkAttr[
"href" ] = url +
"/consumerStatistics";
151 link = maker.
addNode(
"a", parent, linkAttr);
152 maker.
addText(link,
"Consumer Statistics");
166 colspanAttr[
"colspan" ] =
"2";
169 tableAttr[
"width" ] =
"50%";
172 widthAttr[
"width" ] =
"70%";
178 maker.
addText(tableDiv,
"Connection Information");
181 tableRow = maker.
addNode(
"tr", table, rowAttr_);
182 tableDiv = maker.
addNode(
"td", tableRow, widthAttr);
183 maker.
addText(tableDiv,
"# of configured StorageManagers");
184 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
185 const size_t configuredSMs = stateMachine_->getConfiguration()->
186 getDataRetrieverParams().smRegistrationList_.size();
187 maker.
addInt(tableDiv, configuredSMs);
190 tableRow = maker.
addNode(
"tr", table, rowAttr_);
191 tableDiv = maker.
addNode(
"td", tableRow, widthAttr);
192 maker.
addText(tableDiv,
"# of requested SM connections");
193 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
197 tableRow = maker.
addNode(
"tr", table, rowAttr_);
198 tableDiv = maker.
addNode(
"td", tableRow, widthAttr);
199 maker.
addText(tableDiv,
"# of active SM connections");
200 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
204 tableRow = maker.
addNode(
"tr", table, rowAttr_);
205 tableDiv = maker.
addNode(
"td", tableRow, widthAttr);
206 maker.
addText(tableDiv,
"# of connected event consumers");
207 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
209 stateMachine_->getRegistrationCollection()->
210 getEventConsumers(consumers);
211 maker.
addInt(tableDiv, consumers.size());
214 tableRow = maker.
addNode(
"tr", table, rowAttr_);
215 tableDiv = maker.
addNode(
"td", tableRow, widthAttr);
216 maker.
addText(tableDiv,
"# of connected histogram consumers");
217 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
219 stateMachine_->getRegistrationCollection()->
220 getDQMEventConsumers(dqmConsumers);
221 maker.
addInt(tableDiv, dqmConsumers.size());
233 colspanAttr[
"colspan" ] =
"13";
238 rowspanAttr[
"rowspan" ] =
"3";
239 rowspanAttr[
"width" ] =
"30%";
242 noWrapAttr[
"style" ] =
"white-space: nowrap;";
247 maker.
addText(tableDiv,
"Throughput");
249 tableRow = maker.
addNode(
"tr", table, rowAttr_);
250 tableDiv = maker.
addNode(
"th", tableRow, rowspanAttr);
251 maker.
addText(tableDiv,
"Requested Event Type");
252 subColspanAttr[
"colspan" ] =
"2";
253 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
255 subColspanAttr[
"colspan" ] =
"6";
256 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
257 maker.
addText(tableDiv,
"Input");
258 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
259 maker.
addText(tableDiv,
"Output");
261 subColspanAttr[
"colspan" ] =
"2";
262 tableRow = maker.
addNode(
"tr", table, rowAttr_);
263 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
264 maker.
addText(tableDiv,
"Average Event Size (kB)");
265 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
266 maker.
addText(tableDiv,
"Event Rate (Hz)");
267 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
268 maker.
addText(tableDiv,
"Bandwidth (kB/s)");
269 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
270 maker.
addText(tableDiv,
"Corrupted Event Rate (Hz)");
271 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
272 maker.
addText(tableDiv,
"Event Rate (Hz)");
273 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
274 maker.
addText(tableDiv,
"Bandwidth (kB/s)");
276 tableRow = maker.
addNode(
"tr", table, rowAttr_);
277 tableDiv = maker.
addNode(
"th", tableRow);
278 maker.
addText(tableDiv,
"overall");
279 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
280 maker.
addText(tableDiv,
"last 60 s");
281 tableDiv = maker.
addNode(
"th", tableRow);
282 maker.
addText(tableDiv,
"overall");
283 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
284 maker.
addText(tableDiv,
"last 60 s");
285 tableDiv = maker.
addNode(
"th", tableRow);
286 maker.
addText(tableDiv,
"overall");
287 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
288 maker.
addText(tableDiv,
"last 60 s");
289 tableDiv = maker.
addNode(
"th", tableRow);
290 maker.
addText(tableDiv,
"overall");
291 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
292 maker.
addText(tableDiv,
"last 60 s");
293 tableDiv = maker.
addNode(
"th", tableRow);
294 maker.
addText(tableDiv,
"overall");
295 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
296 maker.
addText(tableDiv,
"last 60 s");
297 tableDiv = maker.
addNode(
"th", tableRow);
298 maker.
addText(tableDiv,
"overall");
299 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
300 maker.
addText(tableDiv,
"last 60 s");
305 messageAttr[
"align" ] =
"center";
309 maker.
addText(tableDiv,
"No data flowing, yet.");
313 bool evenRow =
false;
315 for (DataRetrieverMonitorCollection::SummaryStats::EventTypeStatList::const_iterator
322 rowAttr[
"style" ] =
"background-color:#e0e0e0;";
330 addRowForEventType(maker, tableRow, *it);
333 addSummaryRowForThroughput(maker, table, summaryStats);
347 std::ostringstream eventType;
348 stats.first->eventType(eventType);
349 maker.
addText(pre, eventType.str());
352 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
354 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
358 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
360 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
364 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
366 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
370 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
373 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
379 bool isEventConsumer =
380 stateMachine_->getDataManager()->getQueueIDsFromDataEventRetrievers(
381 boost::dynamic_pointer_cast<stor::EventConsumerRegistrationInfo>(stats.first),
384 if ( ! isEventConsumer)
386 stateMachine_->getDataManager()->getQueueIDsFromDQMEventRetrievers(
387 boost::dynamic_pointer_cast<stor::DQMEventConsumerRegistrationInfo>(stats.first),
392 if ( queueIDs.empty() )
395 noConsumersAttr[
"colspan" ] =
"4";
396 tableDiv = maker.
addNode(
"td", tableRow, noConsumersAttr);
397 maker.
addText(tableDiv,
"no consumers connected");
402 stateMachine_->getStatisticsReporter()->getEventConsumerMonitorCollection();
404 stateMachine_->getStatisticsReporter()->getDQMConsumerMonitorCollection();
408 static_cast<const stor::ConsumerMonitorCollection&>(dcmc);
410 double rateOverall = 0;
411 double rateRecent = 0;
412 double bandwidthOverall = 0;
413 double bandwidthRecent = 0;
415 for ( stor::QueueIDs::const_iterator it = queueIDs.begin(),
416 itEnd = queueIDs.end(); it != itEnd; ++it)
428 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
430 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
432 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
433 maker.
addDouble(tableDiv, bandwidthOverall);
434 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
435 maker.
addDouble(tableDiv, bandwidthRecent);
448 maker.
addText(tableDiv,
"Total");
451 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
453 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
457 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
459 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
463 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
465 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
469 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
471 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
475 stateMachine_->getStatisticsReporter()->getEventConsumerMonitorCollection();
477 stateMachine_->getStatisticsReporter()->getDQMConsumerMonitorCollection();
483 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
488 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
495 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
500 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
515 colspanAttr[
"colspan" ] =
"14";
521 maker.
addText(tableDiv,
"Event Servers");
524 rowspanAttr[
"rowspan" ] =
"2";
527 subColspanAttr[
"colspan" ] =
"2";
530 noWrapAttr[
"style" ] =
"white-space: nowrap;";
533 tableRow = maker.
addNode(
"tr", table, specialRowAttr_);
534 tableDiv = maker.
addNode(
"th", tableRow, rowspanAttr);
535 maker.
addText(tableDiv,
"Hostname");
536 tableDiv = maker.
addNode(
"th", tableRow, rowspanAttr);
537 maker.
addText(tableDiv,
"Status");
538 tableDiv = maker.
addNode(
"th", tableRow, rowspanAttr);
539 maker.
addText(tableDiv,
"Requested Event Type");
540 tableDiv = maker.
addNode(
"th", tableRow, rowspanAttr);
541 maker.
addText(tableDiv,
"Max Request Rate (Hz)");
542 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
543 maker.
addText(tableDiv,
"Event Rate (Hz)");
544 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
545 maker.
addText(tableDiv,
"Average Event Size (kB)");
546 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
547 maker.
addText(tableDiv,
"Bandwidth (kB/s)");
548 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
549 maker.
addText(tableDiv,
"Corrupted Events");
550 tableDiv = maker.
addNode(
"th", tableRow, subColspanAttr);
551 maker.
addText(tableDiv,
"Corrupted Event Rate (Hz)");
553 tableRow = maker.
addNode(
"tr", table, specialRowAttr_);
554 tableDiv = maker.
addNode(
"th", tableRow);
555 maker.
addText(tableDiv,
"overall");
556 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
557 maker.
addText(tableDiv,
"last 60 s");
558 tableDiv = maker.
addNode(
"th", tableRow);
559 maker.
addText(tableDiv,
"overall");
560 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
561 maker.
addText(tableDiv,
"last 60 s");
562 tableDiv = maker.
addNode(
"th", tableRow);
563 maker.
addText(tableDiv,
"overall");
564 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
565 maker.
addText(tableDiv,
"last 60 s");
566 tableDiv = maker.
addNode(
"th", tableRow);
567 maker.
addText(tableDiv,
"overall");
568 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
569 maker.
addText(tableDiv,
"last 60 s");
570 tableDiv = maker.
addNode(
"th", tableRow);
571 maker.
addText(tableDiv,
"overall");
572 tableDiv = maker.
addNode(
"th", tableRow, noWrapAttr);
573 maker.
addText(tableDiv,
"last 60 s");
576 stateMachine_->getStatisticsReporter()->getDataRetrieverMonitorCollection()
577 .getStatsByEventTypesPerConnection(eventTypePerConnectionStats);
580 stateMachine_->getStatisticsReporter()->getDataRetrieverMonitorCollection()
581 .getStatsByConnection(connectionStats);
583 if ( eventTypePerConnectionStats.empty() )
586 messageAttr[
"align" ] =
"center";
588 tableRow = maker.
addNode(
"tr", table, rowAttr_);
589 tableDiv = maker.
addNode(
"td", tableRow, messageAttr);
590 maker.
addText(tableDiv,
"Not registered to any event servers yet");
594 bool evenRow =
false;
596 for (DataRetrieverMonitorCollection::EventTypePerConnectionStatList::const_iterator
597 it = eventTypePerConnectionStats.begin(), itEnd = eventTypePerConnectionStats.end();
603 rowAttr[
"style" ] =
"background-color:#e0e0e0;";
611 addRowForEventServer(maker, tableRow, *it);
613 const std::string currentSourceURL = it->regPtr->sourceURL();
615 if ( (it+1) == eventTypePerConnectionStats.end() ||
616 (it+1)->regPtr->sourceURL() != currentSourceURL )
618 addSummaryRowForEventServer(maker, table,
619 connectionStats.find(currentSourceURL));
635 addDOMforSMhost(maker, tableRow, stats.
regPtr->sourceURL());
640 tableDiv = maker.
addNode(
"td", tableRow, tableLabelAttr_);
641 maker.
addText(tableDiv,
"Connected");
646 statusAttr[
"style" ] =
"color:brown;";
647 tableDiv = maker.
addNode(
"td", tableRow, statusAttr);
648 std::ostringstream
status;
650 maker.
addText(tableDiv, status.str());
654 tableDiv = maker.
addNode(
"td", tableRow, tableLabelAttr_);
656 std::ostringstream eventType;
657 stats.
regPtr->eventType(eventType);
658 maker.
addText(pre, eventType.str());
661 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
663 stats.
regPtr->minEventRequestInterval();
664 if ( interval.is_not_a_date_time() )
665 maker.
addText(tableDiv,
"unlimited");
670 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
672 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
676 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
678 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
682 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
684 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
688 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
691 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
696 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
699 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
709 DataRetrieverMonitorCollection::ConnectionStats::const_iterator
pos
715 addDOMforSMhost(maker, tableRow, pos->first);
719 tableDiv = maker.
addNode(
"td", tableRow);
720 tableDiv = maker.
addNode(
"td", tableRow);
723 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
725 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
729 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
731 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
735 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
737 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
741 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
744 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
749 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
752 tableDiv = maker.
addNode(
"td", tableRow, tableValueAttr_);
767 if ( startPos == std::string::npos )
772 const std::string hostname = sourceURL.substr(startPos,(endPos-startPos));
774 linkAttr[
"href" ] = sourceURL +
"/consumerStatistics";
double getValueRate(DataSetType t=FULL) const
Node * addNode(const std::string &name, Node *parent, const AttrMap &attrs)
void addDOMforDQMEventStatistics(XHTMLMaker &maker, XHTMLMaker::Node *parent, DQMEventMonitorCollection const &) const
void addDouble(Node *parent, const double &value, const unsigned int &precision=2)
std::map< std::string, EventStats > ConnectionStats
std::vector< EventConsRegPtr > ConsumerRegistrations
bool getServed(const QueueID &qid, MonitoredQuantity::Stats &result) const
void addText(Node *parent, const std::string &)
void addSummaryRowForThroughput(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::SummaryStats const &) const
std::vector< QueueID > QueueIDs
void defaultWebPage(xgi::Output *) const
MonitoredQuantity::Stats servedStats
void dataRetrieverWebPage(xgi::Output *) const
stor::MonitoredQuantity::Stats sizeStats
std::string link(std::string &nm, std::string &ns)
boost::posix_time::time_duration Duration_t
std::vector< EventTypePerConnectionStats > EventTypePerConnectionStatList
void addDOMforDQMEventServers(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent) const
edm::serviceregistry::AllArgsMaker< DTDataMonitorInterface, DTDataIntegrityTask > maker
std::map< std::string, std::string > AttrMap
ConsumerWebPageHelper_t consumerWebPageHelper_
void addInt(Node *parent, const int &)
void getTotalStats(TotalStats &) const
double getSampleRate(DataSetType t=FULL) const
void dqmEventStatisticsWebPage(xgi::Output *) const
StateMachinePtr stateMachine_
double getValueAverage(DataSetType t=FULL) const
void addDOMforProcessedDQMEvents(XHTMLMaker &maker, XHTMLMaker::Node *parent, DQMEventMonitorCollection const &) const
void addSummaryRowForEventServer(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::ConnectionStats::const_iterator) const
void addDOMforSMhost(stor::XHTMLMaker &, stor::XHTMLMaker::Node *tableRow, const std::string &sourceURL) const
SMPSWebPageHelper(xdaq::ApplicationDescriptor *, StateMachinePtr)
void addDOMforConnectionInfo(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent, const DataRetrieverMonitorCollection::SummaryStats &) const
EventTypeStatList eventTypeStats
boost::shared_ptr< StateMachine > StateMachinePtr
std::pair< stor::RegPtr, EventStats > EventTypeStats
ConnectionStatus connectionStatus
virtual void addDOMforHyperLinks(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent) const
void consumerStatistics(xgi::Output *, const std::string &externallyVisibleState, const std::string &innerStateName, const std::string &errorMsg, boost::shared_ptr< StatisticsReporter_t >, RegistrationCollectionPtr, boost::shared_ptr< EventQueueCollection_t >, DQMEventQueueCollectionPtr) const
stor::MonitoredQuantity::Stats corruptedEventsStats
std::vector< DQMEventConsRegPtr > DQMConsumerRegistrations
double durationToSeconds(Duration_t const &)
void addDOMforThroughputPerEventType(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent, const DataRetrieverMonitorCollection::SummaryStats &) const
void addRowForEventServer(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::EventTypePerConnectionStats const &) const
XHTMLMaker::Node * createWebPageBody(XHTMLMaker &, const std::string &pageTitle, const std::string &externallyVisibleState, const std::string &innerStateName, const std::string &errorMsg) const
double getValueSum(DataSetType t=FULL) const
void addDOMforEventServers(stor::XHTMLMaker &, stor::XHTMLMaker::Node *parent) const
void addRowForEventType(stor::XHTMLMaker &, stor::XHTMLMaker::Node *table, DataRetrieverMonitorCollection::SummaryStats::EventTypeStats const &) const
void consumerStatisticsWebPage(xgi::Output *) const