Example #1
0
        internal void UpdateHugeDocuments(object state)
        {
            try
            {
                if (_needsSync == false)
                {
                    return;
                }

                lock (_addHintSyncObj)
                {
                    _needsSync = false;

                    _performanceHint.RefreshCreatedAt();
                    _notificationCenter.Add(_performanceHint);
                }
            }
            catch (Exception e)
            {
                if (_logger.IsInfoEnabled)
                {
                    _logger.Info("Error in a huge documents timer", e);
                }
            }
        }
Example #2
0
 private void AddHint(string id, int size)
 {
     lock (_addHintSyncObj)
     {
         var performanceHint = GetOrCreatePerformanceHint(out var details);
         details.Update(id, size);
         _notificationCenter.Add(performanceHint);
     }
 }
Example #3
0
        public void RecordTransformationError(Exception e)
        {
            TransformationErrors++;

            LastErrorTime = SystemTime.UtcNow;

            LastAlert = AlertRaised.Create(
                _databaseName,
                _processType,
                $"[{_name}] Transformation script failed",
                AlertType.Etl_TransformationError,
                NotificationSeverity.Warning,
                key: _name,
                details: new ExceptionDetails(e));

            if (TransformationErrors < 100)
            {
                return;
            }

            if (TransformationErrors <= TransformationSuccesses)
            {
                return;
            }

            var message = $"[{_name}] Transformation errors ratio too high. " +
                          "Could not tolerate transformation script error ratio and stopped current ETL cycle";

            LastAlert = AlertRaised.Create(
                _databaseName,
                _processType,
                message,
                AlertType.Etl_TransformationError,
                NotificationSeverity.Error,
                key: _name,
                details: new ExceptionDetails(e));

            _notificationCenter.Add(LastAlert);

            throw new InvalidOperationException($"{message}. Current stats: {this}");
        }
Example #4
0
        private void NotifyWarning(string warningMsg, Exception e = null)
        {
            if (_logger.IsOperationsEnabled)
            {
                _logger.Operations(warningMsg, e);
            }

            try
            {
                var alert = AlertRaised.Create(
                    null,
                    "Cpu usage extension point error",
                    warningMsg,
                    AlertType.CpuUsageExtensionPointError,
                    NotificationSeverity.Warning);
                _notificationCenter.Add(alert);
            }
            catch
            {
                // nothing to do if we can't report it
            }
        }