public void DroppedEventsStatistics() { var payload = new DroppedEventsStatisticsPayload { CollectedEvents = 4, DroppedEvents = 5, Queue = EventPriority.Operational }; foreach (EventPriority value in Enum.GetValues(typeof(EventPriority))) { if (value == EventPriority.Off || value == EventPriority.Operational) { continue; } payload.Queue = value; var obj = new DroppedEventsStatistics(new DroppedEventsStatisticsPayload[] { payload }); obj.ValidateSchema(); } }
/// <summary> /// Generates telemetry events from the given data /// </summary> /// <param name="counterData"></param> /// <returns></returns> private List <IEvent> GenerateTelemetryEventsFromCounterData(IDictionary <CounterType, int> counterData) { var messageStatsEvent = new MessageStatistics(new[] { new MessageStatisticsPayload { MessagesUnder4KB = counterData[CounterType.MessagesUnder4KB], TotalFailed = counterData[CounterType.SendFailed], MessagesSent = counterData[CounterType.SendSuccesfully] + counterData[CounterType.SendFailed] } }); var droppedEventsEvent = new DroppedEventsStatistics(new[] { new DroppedEventsStatisticsPayload { Queue = EventPriority.High, CollectedEvents = counterData[CounterType.EnqueuedHighPriorityEvent], DroppedEvents = counterData[CounterType.DroppedHighPriorityEvent] }, new DroppedEventsStatisticsPayload { Queue = EventPriority.Low, CollectedEvents = counterData[CounterType.EnqueuedLowPriorityEvent], DroppedEvents = counterData[CounterType.DroppedLowPriorityEvent] }, new DroppedEventsStatisticsPayload { Queue = EventPriority.Operational, CollectedEvents = counterData[CounterType.EnqueuedOperationalEvent], DroppedEvents = counterData[CounterType.DroppedOperationalEvent] } }); return(new List <IEvent> { messageStatsEvent, droppedEventsEvent }); }