Ejemplo n.º 1
0
 public static void LogMessage(this IDataCollection collector, string message)
 {
     collector.Write(new LogEvent(message)
     {
         Level = LoggingLevel.Info
     });
 }
Ejemplo n.º 2
0
 public static void LogException(this IDataCollection collector, string message, Exception ex)
 {
     collector.Write(new LogEvent(message, ex)
     {
         Level = LoggingLevel.Error
     });
 }
Ejemplo n.º 3
0
 public static async Task SecurityEvent(this IDataCollection collector, SecurityEventDirection direction, Exception ex)
 {
     collector.Write(new SecurityEvent()
     {
         Direction = direction, Ex = ex
     }, DataCollectionSupport.Security);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// This interface is used to log payload data when a message is either incoming or outgoing from the system.
 /// </summary>
 /// <param name="collector">The data collector.</param>
 /// <param name="direction">The direction of the message.</param>
 /// <param name="payload">The payload.</param>
 /// <param name="ex">Any exception generated by the attempt. If this is not null then you can assume that the incoming or outgoing action was not successful.</param>
 /// <param name="batchId">The batch id.</param>
 public static void BoundaryLog(this IDataCollection collector, ChannelDirection direction
                                , TransmissionPayload payload, string channelId, int channelPriority, Exception ex = null, Guid?batchId = null)
 {
     collector.Write(
         new BoundaryEvent()
     {
         Direction         = direction
         , ChannelId       = payload?.Message?.ChannelId
         , Id              = payload?.Id
         , Payload         = payload
         , Ex              = ex
         , BatchId         = batchId
         , Type            = BoundaryEventType.Boundary
         , ChannelPriority = channelPriority
     });
 }
Ejemplo n.º 5
0
        /// <summary>
        /// This method is used to record the success rate of a batch poll so that messages can be reconciled against the request, and polling algorithm assessed.
        /// </summary>
        /// <param name="collector">The data collector.</param>
        /// <param name="requested">The number of messages requested.</param>
        /// <param name="actual">The actual number returned.</param>
        /// <param name="channelId">The channel id for the request.</param>
        /// <returns>Returns a trace GUID for the individual boundary listener poll.</returns>
        public static Guid BoundaryBatchPoll(this IDataCollection collector, int requested, int actual, string channelId, int channelPriority)
        {
            var id = Guid.NewGuid();

            collector.Write(
                new BoundaryEvent()
            {
                BatchId           = id
                , Requested       = requested
                , Actual          = actual
                , ChannelId       = channelId
                , ChannelPriority = channelPriority
                , Type            = BoundaryEventType.Poll
            });
            return(id);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// This extension method writes the raw object to the data collector.
 /// </summary>
 /// <param name="collector">The data collector.</param>
 /// <param name="myEvent">The telemetry event.</param>
 /// <param name="sync">Specifies whether this method should be written synchronously or on to the async queue for offline processing.</param>
 public static void Write(this IDataCollection collector, TelemetryEvent myEvent, bool sync = false)
 {
     collector.Write(myEvent, DataCollectionSupport.Telemetry, sync);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// This extension method writes the raw object to the data collector.
 /// </summary>
 /// <param name="collector">The data collector.</param>
 /// <param name="myEvent">The resource event.</param>
 /// <param name="sync">Specifies whether this method should be written synchronously or on to the async queue for offline processing.</param>
 public static void Write(this IDataCollection collector, ResourceEvent myEvent, bool sync = false)
 {
     collector.Write(myEvent, DataCollectionSupport.Resource, sync);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// This extension method writes the raw object to the data collector.
 /// </summary>
 /// <param name="collector">The data collector.</param>
 /// <param name="myEvent">The log event.</param>
 /// <param name="sync">Specifies whether this method should be written synchronously or on to the async queue for offline processing.</param>
 public static void Write(this IDataCollection collector, LogEvent myEvent, bool sync = false)
 {
     collector.Write(myEvent, DataCollectionSupport.Logger, sync);
 }
Ejemplo n.º 9
0
 public static void DispatcherPayloadUnresolved(this IDataCollection collector, TransmissionPayload payload, DispatcherRequestUnresolvedReason reason)
 {
     collector.Write(new DispatcherEvent {
         Type = PayloadEventType.Unresolved, Payload = payload, Reason = reason
     }, DataCollectionSupport.Dispatcher);
 }
Ejemplo n.º 10
0
 public static void DispatcherPayloadIncoming(this IDataCollection collector, TransmissionPayload payload)
 {
     collector.Write(new DispatcherEvent {
         Type = PayloadEventType.Incoming, Payload = payload
     }, DataCollectionSupport.Dispatcher);
 }
Ejemplo n.º 11
0
 public static void DispatcherPayloadException(this IDataCollection collector, TransmissionPayload payload, Exception pex)
 {
     collector.Write(new DispatcherEvent {
         Type = PayloadEventType.Exception, Payload = payload, Ex = pex
     }, DataCollectionSupport.Dispatcher);
 }
Ejemplo n.º 12
0
 public static void DispatcherPayloadComplete(this IDataCollection collector, TransmissionPayload payload, int delta, bool isSuccess)
 {
     collector.Write(new DispatcherEvent {
         Type = PayloadEventType.Complete, Payload = payload, Delta = delta, IsSuccess = isSuccess
     }, DataCollectionSupport.Dispatcher);
 }
Ejemplo n.º 13
0
 public static void LogMessage(this IDataCollection collector, LoggingLevel level, string message, string category)
 {
     collector.Write(new LogEvent(level, message, category));
 }
Ejemplo n.º 14
0
 public static async Task Log(this IDataCollection collector, LogEvent logEvent)
 {
     collector.Write(logEvent);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Track the metric for each of the trackers.
 /// </summary>
 /// <param name="collector">The collector reference.</param>
 /// <param name="metricName"></param>
 /// <param name="value"></param>
 public static void TrackMetric(this IDataCollection collector, string metricName, double value)
 {
     collector.Write(new TelemetryEvent {
         MetricName = metricName, Value = value
     }, DataCollectionSupport.Telemetry);
 }
Ejemplo n.º 16
0
 public static async Task SecurityEvent(this IDataCollection collector, SecurityEvent secEvent)
 {
     collector.Write(secEvent, DataCollectionSupport.Security);
 }