/// <summary> /// Ajoute un nouveau store. /// </summary> /// <param name="store">Store.</param> public void AddMonitoringStore(IMonitoringStore store) { if (!IsEnabled) { return; } if (store == null) { throw new ArgumentNullException("store"); } _monitoringStore.Add(store); // Enregistrement en base de données des bases déja enregistrés. foreach (string dataBaseName in _mapDescription.Keys) { IManagerDescription description = _mapDescription[dataBaseName]; ExceptionSafeCreateDatabase(store, dataBaseName, description); } // Enregistrement en base de données des compteurs déja enregistrés. foreach (ICounterDefinition counter in _counterDefinitionRepository.Values) { ExceptionSafeCreateCounter(store, counter); } lock (_resetEvent) { if (!_threadStarted) { _threadStarted = true; _storageThread.Start(); } } }
private static void ExceptionSafeStoreCounters(IMonitoringStore store, ICollection <CounterData> counterDataList) { try { store.StoreCounters(counterDataList); } catch (Exception e) { ILog log = LogManager.GetLogger("Kinetix.Monitoring"); if (log.IsErrorEnabled) { log.Error("Erreur de persistance du monitoring.", e); } } }
private static void ExceptionSafeCreateCounter(IMonitoringStore store, ICounterDefinition counter) { try { store.CreateCounter(counter); } catch (Exception e) { ILog log = LogManager.GetLogger("Kinetix.Monitoring"); if (log.IsErrorEnabled) { log.Error("Erreur de persistance du monitoring.", e); } } }
private static void ExceptionSafeCreateDatabase(IMonitoringStore store, string dataBaseName, IManagerDescription description) { try { store.CreateDatabase(new DatabaseDefinition(dataBaseName, description)); } catch (Exception e) { ILog log = LogManager.GetLogger("Monitoring"); if (log.IsErrorEnabled) { log.Error("Erreur de persistance du monitoring.", e); } } }
private static int ExceptionSafeHandleException(IMonitoringStore store, Exception exception) { try { return(store.HandleException(exception)); } catch (Exception e) { ILog log = LogManager.GetLogger("Kinetix.Monitoring"); if (log.IsErrorEnabled) { log.Error("Erreur de persistance du monitoring.", e); } return(-1); } }