Beispiel #1
0
        /// <summary>
        /// Explicitly updates context properties to be appended to future calls to the current telemetry pipeline
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        public static void AddOrUpdateContextProperty(TelemetryProperty property, string value)
        {
            if (!IsEnabled)
            {
                return;
            }

            TelemetrySink.AddOrUpdateContextProperty(property.ToString(), value);
        }
Beispiel #2
0
        /// <summary>
        /// Publishes event to the current telemetry pipeline
        /// </summary>
        /// <param name="action">The action being recorded</param>
        /// <param name="propertyBag">Associated property bag--this may be null</param>
        public static void PublishTelemetryEvent(TelemetryAction action, IReadOnlyDictionary <TelemetryProperty, string> propertyBag = null)
        {
            // Conversions to strings are expensive, so skip it if possible
            if (!IsEnabled)
            {
                return;
            }

            TelemetrySink.PublishTelemetryEvent(action.ToString(), ConvertFromProperties(propertyBag));
        }
Beispiel #3
0
        /// <summary>
        /// Publishes event with single property/value pair to the current telemetry pipeline
        /// </summary>
        /// <param name="action"></param>
        /// <param name="property"></param>
        /// <param name="value"></param>
        public static void PublishTelemetryEvent(TelemetryAction action, TelemetryProperty property, string value)
        {
            // Conversions to strings are expensive, so skip it if possible
            if (!IsEnabled)
            {
                return;
            }

            TelemetrySink.PublishTelemetryEvent(action.ToString(), property.ToString(), value);
        }
Beispiel #4
0
        public static void Enable()
        {
            // Report any exceptions which may have been caught before telemetry was enabled.
            ReportExceptionBuffer.EnableForwarding();

            // we report this problem after the buffer is flushed
            // because the above call also opens future exceptions to be passed through
            // and in case telemetry is allowed later, we want all the exceptions we can get
            if (!TelemetrySink.IsEnabled)
            {
                TelemetrySink.ReportException(new Exception("Telemetry was lost! Exceptions were flushed from ReportExceptionBuffer, but the telemetry sink was not open."));
            }
        }
Beispiel #5
0
        /// <summary>
        /// Report an Exception into the pipeline
        /// </summary>
        /// <param name="e">The Exception to report</param>
        public static void ReportException(this Exception e)
        {
            if (!IsEnabled)
            {
                return;
            }
            if (e == null)
            {
                return;
            }

            TelemetrySink.ReportException(e);
        }
Beispiel #6
0
 public void ReportException(Exception e)
 {
     TelemetrySink.ReportException(e);
 }
Beispiel #7
0
 public void PublishEvent(string eventName, IReadOnlyDictionary <string, string> propertyBag)
 {
     TelemetrySink.PublishTelemetryEvent(eventName, propertyBag);
 }