/// <summary> /// statistic event override /// </summary> /// <param name="event"></param> public void Write(StatisticEvent <int> @event) { if (@event.Metric != StatisticType.WorkersLog) { return; } lock (_pipelineId) { var metric = new ActiveWorkersLogMessage { Timestamp = DateTime.Now, PipelineId = _pipelineId, ActiveWorkers = @event.Value }; _storage.Value.AddToList(new StorageKey(_pipelineId, $"log:{@event.Metric}"), metric); if (_dispatcherLock.IsLocked()) { return; } _dispatcherLock.Lock(); if (_taskDispatcher == null) { _taskDispatcher = new BackgroundTaskDispatcher(new StorageContext(_storage.Value)); } _taskDispatcher.StartNew(new ActiveWorkersLogCleanupTask(_dispatcherLock, new StorageKey(_pipelineId, $"log:{@event.Metric}"))); } }
/// <summary> /// Write the StatisticEvent to the Logs /// </summary> /// <param name="event"></param> public void Write(StatisticEvent <string> @event) { if (@event.Metric != StatisticType.ProcessedEvent) { return; } lock (_pipelineId) { _count += 1; _metrics.SetMetric(new Metric(MetricType.ProcessedEvents, "Processed Events", _count)); } }
public StatEventArgs(StatisticEvent statEvent) { this.EventData = statEvent; }
public void Stat(string processName, string subProcessName, string statCategory, string statName, int statValue) { StatisticEvent statEvent = new StatisticEvent(); statEvent.StatisticType = StatisticEvent.StatisticTypes.Integer; statEvent.StatisticValueInt = statValue; statEvent.DateTimeSource = DateTime.Now; statEvent.ProcessName = processName; statEvent.SubProcessName = subProcessName; statEvent.StatisticCategory = statCategory; statEvent.StatisticName = statName; m_Queue.Enqueue(statEvent); m_EventContinue.Set(); }
public void Stat(string processName, string subProcessName, string statCategory, string statName, double statValue, TimeSpan timeSpan) { StatisticEvent statEvent = new StatisticEvent(); statEvent.StatisticType = StatisticEvent.StatisticTypes.DoubleTimeSpan; statEvent.StatisticValueTimeSpan = timeSpan; statEvent.StatisticValueDouble = statValue; statEvent.DateTimeSource = DateTime.Now; statEvent.ProcessName = processName; statEvent.SubProcessName = subProcessName; statEvent.StatisticCategory = statCategory; statEvent.StatisticName = statName; m_Queue.Enqueue(statEvent); m_EventContinue.Set(); }
private void ProcessMessages() { var name = _settings.Settings.InstanceName; const int maxUpdates = 100; var updates = new StatisticEvent[maxUpdates]; foreach (var typeChannels in _channels) { foreach (var channel in typeChannels.Value) { StatChannel.Mesg msg; for (var i = 0; i < maxUpdates & channel.TryDequeue(out msg); i++) { switch (msg.Action) { case Actions.Posted: if (msg.ids == null) { updates[i] = new PostEvent(name, msg.id, typeChannels.Key, msg.Length, msg.Time); } else { updates[i] = new SerialPostEvent(name, msg.Time, msg.Length); } break; case Actions.ExternalGet: if (msg.ids == null) { updates[i] = new ExternalGetEvent(name, msg.id, typeChannels.Key, msg.Length, msg.Time); } else { updates[i] = new ExternalSerialGetEvent(name, msg.ids, typeChannels.Key, msg.Length, msg.Time); } break; case Actions.CacheGet: updates[i] = new CachedGetEvent(name, msg.id, typeChannels.Key, msg.Length, msg.Time); break; case Actions.BecameUnactual: updates[i] = new UnactualGetEvent(name, msg.id, typeChannels.Key, msg.Time); break; case Actions.RebalanceStarted: updates[i] = new RebalanceEvent(name, msg.Time, typeChannels.Key, "Started"); break; case Actions.RebalanceQueued: updates[i] = new RebalanceEvent(name, msg.Time, typeChannels.Key, "Queued"); break; case Actions.RebalanceEnded: updates[i] = new RebalanceEvent(name, msg.Time, typeChannels.Key, "Ended", msg.Length); break; case Actions.BranchChanged: updates[i] = new BranchChangedEvent(name, msg.Time, msg.Length, typeChannels.Key); break; } } } } _statQueue.PutEvent(updates); }
public void Statistic(StatisticEvent statEvent) { StatisticEvent(statEvent); }
public StatisticsRequestEvent(StatisticEvent Event) { this.Event = Event; }