#include <IOPool/CMSSealPlugins/plugins/SQLMonitoringService.h>
Public Member Functions | |
virtual bool | active (const std::string &contextKey) const |
Return monitoring activity status. | |
virtual void | disable (const std::string &contextKey) |
virtual void | enable (const std::string &contextKey) |
virtual coral::monitor::Level | level (const std::string &contextKey) const |
Return current monitoring level. | |
virtual std::set< std::string > | monitoredDataSources () const |
Return the set of currently monitored data sources. | |
virtual void | record (const std::string &contextKey, coral::monitor::Source source, coral::monitor::Type type, const std::string &description, const std::string &data) |
Records an event with a payload. | |
virtual void | record (const std::string &contextKey, coral::monitor::Source source, coral::monitor::Type type, const std::string &description, double data) |
Records an event with a payload. | |
virtual void | record (const std::string &contextKey, coral::monitor::Source source, coral::monitor::Type type, const std::string &description, int data) |
Records an event with a payload. | |
virtual void | record (const std::string &contextKey, coral::monitor::Source source, coral::monitor::Type type, const std::string &description) |
Records an event without a payload ( time event for example ). | |
virtual void | report (const std::string &contextKey, unsigned int level) const |
Reports the events to the default reporter. | |
virtual void | report (unsigned int level) const |
Reports all the events. | |
virtual const coral::IMonitoringReporter & | reporter () const |
Return the current reporter. | |
void | reportForSession (Repository::const_iterator &it, seal::MessageStream &os) const |
void | reportForSession (Repository::const_iterator &it, std::ostream &os) const |
void | reportOnEvent (EventStream::const_iterator &it, seal::MessageStream &os) const |
void | reportOnEvent (EventStream::const_iterator &it, std::ostream &os) const |
virtual void | reportToOutputStream (const std::string &contextKey, std::ostream &os, unsigned int level) const |
Reports the events to the specified output stream. | |
virtual void | setLevel (const std::string &contextKey, coral::monitor::Level level) |
The implementation coral::IMonitoringService interface. | |
SQLMonitoringService (seal::Context *, const std::string &) | |
SQLMonitoringService (seal::Context *) | |
virtual | ~SQLMonitoringService () |
Private Attributes | |
DECLARE_SEAL_COMPONENT | |
Repository | m_events |
The all events repository classified by the sessions' keys. | |
std::set< std::string > | m_monitoredDS |
Definition at line 40 of file SQLMonitoringService.h.
cond::SQLMonitoringService::SQLMonitoringService | ( | seal::Context * | c | ) | [explicit] |
cond::SQLMonitoringService::SQLMonitoringService | ( | seal::Context * | c, | |
const std::string & | key | |||
) | [explicit] |
cond::SQLMonitoringService::~SQLMonitoringService | ( | ) | [virtual] |
bool cond::SQLMonitoringService::active | ( | const std::string & | contextKey | ) | const [virtual] |
Return monitoring activity status.
Definition at line 67 of file SQLMonitoringService.cc.
References m_events.
Referenced by record().
00068 { 00069 Repository::const_iterator rit; 00070 00071 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00072 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::active", this->name() ); 00073 00074 return (*rit).second.active; 00075 }
void cond::SQLMonitoringService::disable | ( | const std::string & | contextKey | ) | [virtual] |
Definition at line 87 of file SQLMonitoringService.cc.
References m_events.
00088 { 00089 Repository::iterator rit; 00090 00091 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00092 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::disable", this->name() ); 00093 00094 (*rit).second.active = false; 00095 }
void cond::SQLMonitoringService::enable | ( | const std::string & | contextKey | ) | [virtual] |
Definition at line 77 of file SQLMonitoringService.cc.
References m_events.
00078 { 00079 Repository::iterator rit; 00080 00081 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00082 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::enable", this->name() ); 00083 00084 (*rit).second.active = true; 00085 }
coral::monitor::Level cond::SQLMonitoringService::level | ( | const std::string & | contextKey | ) | const [virtual] |
Return current monitoring level.
Definition at line 57 of file SQLMonitoringService.cc.
References m_events.
Referenced by record().
00058 { 00059 Repository::const_iterator rit; 00060 00061 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00062 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::level", this->name() ); 00063 00064 return (*rit).second.level; 00065 }
std::set< std::string > cond::SQLMonitoringService::monitoredDataSources | ( | ) | const [virtual] |
Return the set of currently monitored data sources.
Definition at line 173 of file SQLMonitoringService.cc.
References m_monitoredDS.
00174 { 00175 return m_monitoredDS; 00176 }
void cond::SQLMonitoringService::record | ( | const std::string & | contextKey, | |
coral::monitor::Source | source, | |||
coral::monitor::Type | type, | |||
const std::string & | description, | |||
const std::string & | data | |||
) | [virtual] |
Records an event with a payload.
Definition at line 145 of file SQLMonitoringService.cc.
References active(), level(), and m_events.
00146 { 00147 Repository::iterator rit; 00148 00149 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00150 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::record", this->name() ); 00151 00152 bool active = (*rit).second.active; 00153 coral::monitor::Level level = (*rit).second.level; 00154 00155 if( active && (type & level) ) 00156 { 00157 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description, data ) ); 00158 } 00159 }
void cond::SQLMonitoringService::record | ( | const std::string & | contextKey, | |
coral::monitor::Source | source, | |||
coral::monitor::Type | type, | |||
const std::string & | description, | |||
double | data | |||
) | [virtual] |
Records an event with a payload.
Definition at line 129 of file SQLMonitoringService.cc.
References active(), level(), and m_events.
00130 { 00131 Repository::iterator rit; 00132 00133 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00134 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::record", this->name() ); 00135 00136 bool active = (*rit).second.active; 00137 coral::monitor::Level level = (*rit).second.level; 00138 00139 if( active && (type & level) ) 00140 { 00141 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description, data ) ); 00142 } 00143 }
void cond::SQLMonitoringService::record | ( | const std::string & | contextKey, | |
coral::monitor::Source | source, | |||
coral::monitor::Type | type, | |||
const std::string & | description, | |||
int | data | |||
) | [virtual] |
Records an event with a payload.
Definition at line 113 of file SQLMonitoringService.cc.
References active(), level(), and m_events.
00114 { 00115 Repository::iterator rit; 00116 00117 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00118 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::record", this->name() ); 00119 00120 bool active = (*rit).second.active; 00121 coral::monitor::Level level = (*rit).second.level; 00122 00123 if( active && (type & level) ) 00124 { 00125 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description, data ) ); 00126 } 00127 }
void cond::SQLMonitoringService::record | ( | const std::string & | contextKey, | |
coral::monitor::Source | source, | |||
coral::monitor::Type | type, | |||
const std::string & | description | |||
) | [virtual] |
Records an event without a payload ( time event for example ).
Definition at line 97 of file SQLMonitoringService.cc.
References active(), level(), and m_events.
00098 { 00099 Repository::iterator rit; 00100 00101 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00102 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::record", this->name() ); 00103 00104 bool active = (*rit).second.active; 00105 coral::monitor::Level level = (*rit).second.level; 00106 00107 if( active && (type & level) ) 00108 { 00109 (*rit).second.stream.push_back( coral::monitor::createEvent( source, type, description ) ); 00110 } 00111 }
void cond::SQLMonitoringService::report | ( | const std::string & | contextKey, | |
unsigned int | level | |||
) | const [virtual] |
Reports the events to the default reporter.
contextKey | The session ID for which to make the report |
Definition at line 188 of file SQLMonitoringService.cc.
References funct::log(), m_events, and reportForSession().
00189 { 00190 Repository::const_iterator rit; 00191 00192 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00193 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::record", this->name() ); 00194 00195 // Dummy reporting so far 00196 seal::MessageStream log( const_cast<cond::SQLMonitoringService*>(this), "MonitoringService" ); 00197 00198 reportForSession( rit, log ); 00199 }
Reports all the events.
contextKey | The session ID for which to make the report |
Definition at line 178 of file SQLMonitoringService.cc.
References cond::Info, funct::log(), m_events, and reportForSession().
00179 { 00180 Repository::const_iterator rit; 00181 seal::MessageStream log( localContext(), "MonitoringService", seal::Msg::Info ); 00182 00183 // Dummy reporting so far 00184 for( rit = m_events.begin(); rit != m_events.end(); ++rit ) 00185 reportForSession( rit, log ); 00186 }
const coral::IMonitoringReporter & cond::SQLMonitoringService::reporter | ( | ) | const [virtual] |
Return the current reporter.
Definition at line 161 of file SQLMonitoringService.cc.
00162 { 00163 std::vector< seal::IHandle<coral::IMonitoringReporter> > rv; 00164 this->localContext()->query( rv ); 00165 00166 if( rv.empty() ) 00167 return( static_cast<const coral::IMonitoringReporter&>(*this) ); 00168 00169 return *(rv[0]); 00170 }
void cond::SQLMonitoringService::reportForSession | ( | Repository::const_iterator & | it, | |
seal::MessageStream & | os | |||
) | const |
Definition at line 241 of file SQLMonitoringService.cc.
References reportOnEvent().
00242 { 00243 const EventStream& evsref = (*it).second.stream; 00244 00245 for( EventStream::const_iterator evit = evsref.begin(); evit != evsref.end(); ++evit ) 00246 { 00247 reportOnEvent( evit, os ); 00248 } 00249 00250 }
void cond::SQLMonitoringService::reportForSession | ( | Repository::const_iterator & | it, | |
std::ostream & | os | |||
) | const |
Definition at line 231 of file SQLMonitoringService.cc.
References reportOnEvent().
Referenced by report(), and reportToOutputStream().
00232 { 00233 const EventStream& evsref = (*it).second.stream; 00234 00235 for( EventStream::const_iterator evit = evsref.begin(); evit != evsref.end(); ++evit ) 00236 { 00237 reportOnEvent( evit, os ); 00238 } 00239 }
void cond::SQLMonitoringService::reportOnEvent | ( | EventStream::const_iterator & | it, | |
seal::MessageStream & | os | |||
) | const |
Definition at line 223 of file SQLMonitoringService.cc.
References flush().
00224 { 00225 if(it->m_source == coral::monitor::Statement) 00226 { 00227 os << (*it).m_description <<seal::flush; 00228 } 00229 }
void cond::SQLMonitoringService::reportOnEvent | ( | EventStream::const_iterator & | it, | |
std::ostream & | os | |||
) | const |
Definition at line 214 of file SQLMonitoringService.cc.
References lat::endl().
Referenced by reportForSession().
00215 { 00216 if(it->m_source == coral::monitor::Statement) 00217 { 00218 os << (*it).m_description << ";"<< std::endl; 00219 } 00220 }
void cond::SQLMonitoringService::reportToOutputStream | ( | const std::string & | contextKey, | |
std::ostream & | os, | |||
unsigned int | level | |||
) | const [virtual] |
Reports the events to the specified output stream.
contextKey | The session ID for which to make the report |
Definition at line 201 of file SQLMonitoringService.cc.
References funct::log(), m_events, and reportForSession().
00202 { 00203 Repository::const_iterator rit; 00204 00205 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00206 throw coral::MonitoringException( "Monitoring for session " + contextKey + " not initialized...", "MonitoringService::record", this->name() ); 00207 00208 // Dummy reporting so far 00209 seal::MessageStream log( const_cast<cond::SQLMonitoringService*>(this), "MonitoringService" ); 00210 00211 reportForSession( rit, os ); 00212 }
void cond::SQLMonitoringService::setLevel | ( | const std::string & | contextKey, | |
coral::monitor::Level | level | |||
) | [virtual] |
The implementation coral::IMonitoringService interface.
Sets the level
contextKey | The session ID for which to make the report | |
level | The monitoring level ( Default, Debug, Trace ) |
Definition at line 35 of file SQLMonitoringService.cc.
References m_events, and m_monitoredDS.
00036 { 00037 Repository::iterator rit; 00038 00039 if( ( rit = m_events.find( contextKey ) ) == m_events.end() ) 00040 { 00041 m_events[contextKey] = SessionMonitor(); 00042 m_monitoredDS.insert( contextKey ); 00043 } 00044 00045 m_events[contextKey].level = level; 00046 00047 if( level == coral::monitor::Off ) 00048 { 00049 m_events[contextKey].active = false; 00050 } 00051 else 00052 { 00053 m_events[contextKey].active = true; 00054 } 00055 }
Definition at line 42 of file SQLMonitoringService.h.
The all events repository classified by the sessions' keys.
Definition at line 146 of file SQLMonitoringService.h.
Referenced by active(), disable(), enable(), level(), record(), report(), reportToOutputStream(), and setLevel().
std::set<std::string> cond::SQLMonitoringService::m_monitoredDS [private] |
Definition at line 147 of file SQLMonitoringService.h.
Referenced by monitoredDataSources(), and setLevel().