internal static EventTelemetry ToTelemetry([NotNull] this BbTimedEvent @event) { try { var tEvent = new EventTelemetry { Name = @event.GetType().Name, Timestamp = DateTimeOffset.Now, }; tEvent.Metrics[nameof(BbTimedEvent.ProcessingTime)] = @event.ProcessingTime.TotalSeconds; tEvent.SetCorrelation(@event); @event.CopyPropertiesInto(tEvent.Properties); return(tEvent); } catch (Exception ex) { #if DEBUG if (Debugger.IsAttached) { throw; } #endif BigBrother.PublishError(ex); return(null); } }
internal static ExceptionTelemetry ToTelemetry([NotNull] this BbExceptionEvent @event) { try { var tEvent = new ExceptionTelemetry { Message = @event.Exception.Message, Exception = @event.Exception, Timestamp = DateTimeOffset.Now }; tEvent.SetCorrelation(@event); @event.CopyPropertiesInto(tEvent.Properties); return(tEvent); } catch (Exception ex) { #if DEBUG if (Debugger.IsAttached) { throw; } #endif BigBrother.PublishError(ex); return(null); } }