Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiverDiagnostics"/> class.
 /// </summary>
 /// <param name="receiverDiagnostics">Internal receiver diagnostics.</param>
 /// <param name="builder">Builder of pipeline parts used during construction.</param>
 internal ReceiverDiagnostics(PipelineDiagnosticsInternal.ReceiverDiagnostics receiverDiagnostics, Builder builder)
 {
     this.Id                       = receiverDiagnostics.Id;
     this.ReceiverName             = receiverDiagnostics.ReceiverName;
     this.DeliveryPolicyName       = receiverDiagnostics.DeliveryPolicyName;
     this.TypeName                 = receiverDiagnostics.TypeName;
     this.Throttled                = receiverDiagnostics.Throttled;
     this.QueueSize                = receiverDiagnostics.QueueSizeHistory.AverageSize();
     this.ProcessedCount           = receiverDiagnostics.ProcessedCount;
     this.ProcessedPerTimeSpan     = receiverDiagnostics.ProcessedHistory.Count;
     this.DroppedCount             = receiverDiagnostics.DroppedCount;
     this.DroppedPerTimeSpan       = receiverDiagnostics.DroppedHistory.Count;
     this.MessageLatencyAtEmitter  = receiverDiagnostics.MessageLatencyAtEmitterHistory.AverageTime().TotalMilliseconds;
     this.MessageLatencyAtReceiver = receiverDiagnostics.MessageLatencyAtReceiverHistory.AverageTime().TotalMilliseconds;
     this.ProcessingTime           = receiverDiagnostics.ProcessingTimeHistory.AverageTime().TotalMilliseconds;
     this.MessageSize              = receiverDiagnostics.MessageSizeHistory.AverageSize();
     builder.EnqueueThunk(() =>
     {
         if (builder.PipelineElements.TryGetValue(receiverDiagnostics.PipelineElement.Id, out var element))
         {
             this.PipelineElement = element;
         }
     });
     if (receiverDiagnostics.Source != null)
     {
         builder.EnqueueThunk(() =>
         {
             if (receiverDiagnostics.Source != null && builder.Emitters.TryGetValue(receiverDiagnostics.Source.Id, out var source))
             {
                 this.Source = source;
             }
         });
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiverCollector"/> class.
 /// </summary>
 /// <param name="pipelineElementDiagnostics">Pipeline element diagnostics instance associated with this receiver.</param>
 /// <param name="receiverId">The id for the receiver to collect diagnostics about.</param>
 /// <param name="diagnosticsConfig">Diagnostics configuration.</param>
 internal ReceiverCollector(
     PipelineDiagnosticsInternal.PipelineElementDiagnostics pipelineElementDiagnostics,
     int receiverId,
     DiagnosticsConfiguration diagnosticsConfig)
 {
     this.pipelineElementDiagnostics = pipelineElementDiagnostics;
     this.receiverDiagnostics        = this.pipelineElementDiagnostics.Receivers[receiverId];
     this.diagnosticsConfig          = diagnosticsConfig;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiverDiagnostics"/> class.
 /// </summary>
 /// <param name="receiverDiagnostics">Internal receiver diagnostics.</param>
 /// <param name="builder">Builder of pipeline parts used during construction.</param>
 internal ReceiverDiagnostics(PipelineDiagnosticsInternal.ReceiverDiagnostics receiverDiagnostics, Builder builder)
 {
     this.Id                          = receiverDiagnostics.Id;
     this.ReceiverName                = receiverDiagnostics.ReceiverName;
     this.DeliveryPolicyName          = receiverDiagnostics.DeliveryPolicyName;
     this.TypeName                    = receiverDiagnostics.TypeName;
     this.ReceiverIsThrottled         = receiverDiagnostics.ReceiverIsThrottled;
     this.LastDeliveryQueueSize       = receiverDiagnostics.DeliveryQueueSizeHistory.LastOrDefault().Item1;
     this.AvgDeliveryQueueSize        = receiverDiagnostics.DeliveryQueueSizeHistory.AverageSize();
     this.TotalMessageEmittedCount    = receiverDiagnostics.TotalMessageEmittedCount;
     this.WindowMessageEmittedCount   = receiverDiagnostics.MessageEmittedCountHistory.Count;
     this.TotalMessageProcessedCount  = receiverDiagnostics.TotalMessageProcessedCount;
     this.WindowMessageProcessedCount = receiverDiagnostics.MessageProcessedCountHistory.Count;
     this.TotalMessageDroppedCount    = receiverDiagnostics.TotalMessageDroppedCount;
     this.WindowMessageDroppedCount   = receiverDiagnostics.MessageDroppedCountHistory.Count;
     this.LastMessageCreatedLatency   = receiverDiagnostics.MessageCreatedLatencyHistory.LastOrDefault().Item1.TotalMilliseconds;
     this.AvgMessageCreatedLatency    = receiverDiagnostics.MessageCreatedLatencyHistory.AverageTime().TotalMilliseconds;
     this.LastMessageEmittedLatency   = receiverDiagnostics.MessageEmittedLatencyHistory.LastOrDefault().Item1.TotalMilliseconds;
     this.AvgMessageEmittedLatency    = receiverDiagnostics.MessageEmittedLatencyHistory.AverageTime().TotalMilliseconds;
     this.LastMessageReceivedLatency  = receiverDiagnostics.MessageReceivedLatencyHistory.LastOrDefault().Item1.TotalMilliseconds;
     this.AvgMessageReceivedLatency   = receiverDiagnostics.MessageReceivedLatencyHistory.AverageTime().TotalMilliseconds;
     this.LastMessageProcessTime      = receiverDiagnostics.MessageProcessTimeHistory.LastOrDefault().Item1.TotalMilliseconds;
     this.AvgMessageProcessTime       = receiverDiagnostics.MessageProcessTimeHistory.AverageTime().TotalMilliseconds;
     this.LastMessageSize             = receiverDiagnostics.MessageSizeHistory.LastOrDefault().Item1;
     this.AvgMessageSize              = receiverDiagnostics.MessageSizeHistory.AverageSize();
     builder.EnqueueThunk(() =>
     {
         if (builder.PipelineElements.TryGetValue(receiverDiagnostics.PipelineElement.Id, out var element))
         {
             this.PipelineElement = element;
         }
     });
     if (receiverDiagnostics.Source != null)
     {
         builder.EnqueueThunk(() =>
         {
             if (receiverDiagnostics.Source != null && builder.Emitters.TryGetValue(receiverDiagnostics.Source.Id, out var source))
             {
                 this.Source = source;
             }
         });
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiverCollector"/> class.
 /// </summary>
 /// <param name="receiverDiagnostics">Receiver diagnostics instance being collected.</param>
 /// <param name="diagnosticsConfig">Diagnostics configuration.</param>
 internal ReceiverCollector(PipelineDiagnosticsInternal.ReceiverDiagnostics receiverDiagnostics, DiagnosticsConfiguration diagnosticsConfig)
 {
     this.receiverDiagnostics = receiverDiagnostics;
     this.diagnosticsConfig   = diagnosticsConfig;
 }
Esempio n. 5
0
 /// <summary>
 /// Get or create external receiver diagnostics representation.
 /// </summary>
 /// <param name="receiverDiagnosticsInternal">Internal pipeline element diagnostics representation.</param>
 /// <returns>External pipeline element diagnostics representation.</returns>
 public ReceiverDiagnostics GetOrCreateReceiverDiagnostics(PipelineDiagnosticsInternal.ReceiverDiagnostics receiverDiagnosticsInternal)
 {
     return(this.GetOrCreate(this.Receivers, receiverDiagnosticsInternal, r => r.Id, (r, c) => new ReceiverDiagnostics(r, c)));
 }