/// <summary> /// Converts this event into an Application Insights <see cref="EventTelemetry"/> event ready to be tracked by /// the AI client. /// </summary> /// <returns>The converted <see cref="EventTelemetry"/> event.</returns> public TTo?ToTelemetry() { try { var resultEvent = new TTo { Timestamp = Now() }; // Specific event type handling HandleEventTypes(resultEvent); Event.CopyPropertiesInto(resultEvent.Properties); return(resultEvent); } catch (Exception ex) { #if DEBUG if (Debugger.IsAttached) { Debugger.Break(); throw; } #endif BigBrother.PublishError(ex); return(default);
/// <summary> /// ReSharper disable once CommentTypo /// creates default <see cref="BigBrother"/> instance with <see cref="OperationCorrelationTelemetryInitializer"/> and <see cref="EnvironmentDetailsTelemetryInitializer"/> initializers /// /// the expected usage is exception happening prior to DI container established /// </summary> /// <param name="aiKey">The application's Application Insights instrumentation key</param> /// <param name="internalKey">The devops internal telemetry Application Insights instrumentation key.</param> /// <returns><see cref="BigBrother"/> default instance</returns> public static BigBrother CreateDefault(string aiKey, string internalKey) { if (_defaultBigBrother != null) { return(_defaultBigBrother); } lock (_defaultBigBrotherLock) { var telConfig = TelemetryConfiguration.CreateDefault(); telConfig.TelemetryInitializers.Add(new EnvironmentDetailsTelemetryInitializer()); var telClient = new TelemetryClient(telConfig) { InstrumentationKey = aiKey }; _defaultBigBrother = new BigBrother(telClient, aiKey, internalKey); return(_defaultBigBrother); } }
internal TraceSink(BigBrother bb) { Bb = bb; }
internal EventSourceSink(BigBrother bb) { Bb = bb; }