Further updates to clean up current approach and remove obselete flags until future release.
This commit is contained in:
Родитель
c96e65e1d1
Коммит
7197d0a7ea
|
@ -11,7 +11,7 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <summary>
|
||||
/// A logging client for bot telemetry.
|
||||
/// </summary>
|
||||
public class AppInsightsTelemetryClient : LogTelemetryClient
|
||||
public class AppInsightsTelemetryClient : LogTelemetryClientBase
|
||||
{
|
||||
private readonly TelemetryClient _telemetryClient;
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <param name="message">Error message on availability test run failure.</param>
|
||||
/// <param name="properties">Named string values you can use to classify and search for this availability telemetry.</param>
|
||||
/// <param name="metrics">Additional values associated with this availability telemetry.</param>
|
||||
public virtual void TrackAvailability(string name, DateTimeOffset timeStamp, TimeSpan duration, string runLocation, bool success, string message = null, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
public override void TrackAvailability(string name, DateTimeOffset timeStamp, TimeSpan duration, string runLocation, bool success, string message = null, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
var telemetry = new AvailabilityTelemetry(name, timeStamp, duration, runLocation, success, message);
|
||||
if (properties != null)
|
||||
|
@ -71,7 +71,7 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <param name="duration">The time taken by the external dependency to handle the call.</param>
|
||||
/// <param name="resultCode">Result code of dependency call execution.</param>
|
||||
/// <param name="success">True if the dependency call was handled successfully.</param>
|
||||
public virtual void TrackDependency(string dependencyTypeName, string target, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, string resultCode, bool success)
|
||||
public override void TrackDependency(string dependencyTypeName, string target, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, string resultCode, bool success)
|
||||
{
|
||||
var telemetry = new DependencyTelemetry
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <param name="eventName">A name for the event.</param>
|
||||
/// <param name="properties">Named string values you can use to search and classify events.</param>
|
||||
/// <param name="metrics">Measurements associated with this event.</param>
|
||||
public virtual void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
public override void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
var telemetry = new EventTelemetry(eventName);
|
||||
if (properties != null)
|
||||
|
@ -122,7 +122,7 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <param name="exception">The exception to log.</param>
|
||||
/// <param name="properties">Named string values you can use to classify and search for this exception.</param>
|
||||
/// <param name="metrics">Additional values associated with this exception.</param>
|
||||
public virtual void TrackException(Exception exception, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
public override void TrackException(Exception exception, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
var telemetry = new ExceptionTelemetry(exception);
|
||||
if (properties != null)
|
||||
|
@ -150,7 +150,7 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <param name="message">Message to display.</param>
|
||||
/// <param name="severityLevel">Trace severity level <see cref="Severity"/>.</param>
|
||||
/// <param name="properties">Named string values you can use to search and classify events.</param>
|
||||
public virtual void TrackTrace(string message, Severity severityLevel, IDictionary<string, string> properties)
|
||||
public override void TrackTrace(string message, Severity severityLevel, IDictionary<string, string> properties)
|
||||
{
|
||||
var telemetry = new TraceTelemetry(message)
|
||||
{
|
||||
|
@ -171,10 +171,10 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <summary>
|
||||
/// Logs a an Application Insights page view.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the page view to log.</param>
|
||||
/// <param name="name">The name of the dialog view to log.</param>
|
||||
/// <param name="properties">Named string values you can use to search and classify events.</param>
|
||||
/// <param name="metrics">Measurements associated with this event.</param>
|
||||
public virtual void TrackPageView(string name, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
public override void TrackDialogView(string name, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
var telemetry = new PageViewTelemetry(name);
|
||||
|
||||
|
@ -200,6 +200,6 @@ namespace Microsoft.Bot.Builder.ApplicationInsights
|
|||
/// <summary>
|
||||
/// Flushes the in-memory buffer and any metrics being pre-aggregated.
|
||||
/// </summary>
|
||||
public virtual void Flush() => _telemetryClient.Flush();
|
||||
public override void Flush() => _telemetryClient.Flush();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// </summary>
|
||||
/// <value>The <see cref="IBotTelemetryClient"/> to use when logging.</value>
|
||||
/// <seealso cref="DialogSet.TelemetryClient"/>
|
||||
[Obsolete("TelemetryClient is now obselete. Please use LogTelemetryClient instead.", false)]
|
||||
public override IBotTelemetryClient TelemetryClient
|
||||
{
|
||||
get
|
||||
|
@ -60,7 +59,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// </summary>
|
||||
/// <value>The <see cref="LogTelemetryClient"/> to use when logging.</value>
|
||||
/// <seealso cref="DialogSet.LogTelemetryClient"/>
|
||||
public override LogTelemetryClient LogTelemetryClient
|
||||
public override LogTelemetryClientBase LogTelemetryClient
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -110,7 +109,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
return await EndComponentAsync(outerDc, turnResult.Result, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
LogTelemetryClient.TrackPageView(Id);
|
||||
LogTelemetryClient.TrackDialogView(Id);
|
||||
|
||||
// Just signal waiting
|
||||
return Dialog.EndOfTurn;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
public static readonly DialogTurnResult EndOfTurn = new DialogTurnResult(DialogTurnStatus.Waiting);
|
||||
|
||||
private IBotTelemetryClient _telemetryClient;
|
||||
private LogTelemetryClient _logTelemetryClient;
|
||||
private LogTelemetryClientBase _logTelemetryClient;
|
||||
|
||||
[JsonProperty("id")]
|
||||
private string id;
|
||||
|
@ -68,7 +68,6 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// <value>The <see cref="IBotTelemetryClient"/> to use for logging.</value>
|
||||
/// <seealso cref="DialogSet.TelemetryClient"/>
|
||||
[JsonIgnore]
|
||||
[Obsolete("TelemetryClient is now obselete. Please use LogTelemetryClient instead.", false)]
|
||||
public virtual IBotTelemetryClient TelemetryClient
|
||||
{
|
||||
get
|
||||
|
@ -88,7 +87,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// <value>The <see cref="LogTelemetryClient"/> to use for logging.</value>
|
||||
/// <seealso cref="DialogSet.LogTelemetryClient"/>
|
||||
[JsonIgnore]
|
||||
public virtual LogTelemetryClient LogTelemetryClient
|
||||
public virtual LogTelemetryClientBase LogTelemetryClient
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
private readonly IDictionary<string, Dialog> _dialogs = new Dictionary<string, Dialog>();
|
||||
|
||||
private IBotTelemetryClient _telemetryClient;
|
||||
private LogTelemetryClient _logTelemetryClient;
|
||||
private LogTelemetryClientBase _logTelemetryClient;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DialogSet"/> class.
|
||||
|
@ -50,7 +50,6 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// <remarks>When this property is set, it sets the <see cref="Dialog.TelemetryClient"/> of each
|
||||
/// dialog in the set to the new value.</remarks>
|
||||
[JsonIgnore]
|
||||
[Obsolete("TelemetryClient is now obselete. Please use LogTelemetryClient instead.", false)]
|
||||
public IBotTelemetryClient TelemetryClient
|
||||
{
|
||||
get
|
||||
|
@ -75,7 +74,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// <remarks>When this property is set, it sets the <see cref="Dialog.LogTelemetryClient"/> of each
|
||||
/// dialog in the set to the new value.</remarks>
|
||||
[JsonIgnore]
|
||||
public LogTelemetryClient LogTelemetryClient
|
||||
public LogTelemetryClientBase LogTelemetryClient
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
};
|
||||
TrackTelemetryEvent("WaterfallStart", properties);
|
||||
|
||||
LogTelemetryClient.TrackPageView(Id);
|
||||
LogTelemetryClient.TrackDialogView(Id);
|
||||
|
||||
// Run first step
|
||||
return await RunStepAsync(dc, 0, DialogReason.BeginCalled, null, cancellationToken).ConfigureAwait(false);
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// <summary>
|
||||
/// A logging client for bot telemetry.
|
||||
/// </summary>
|
||||
public abstract class LogTelemetryClient
|
||||
public abstract class LogTelemetryClientBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Send information about availability of an application.
|
||||
|
@ -22,9 +22,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// <param name="message">Error message on availability test run failure.</param>
|
||||
/// <param name="properties">Named string values you can use to classify and search for this availability telemetry.</param>
|
||||
/// <param name="metrics">Additional values associated with this availability telemetry.</param>
|
||||
public virtual void TrackAvailability(string name, DateTimeOffset timeStamp, TimeSpan duration, string runLocation, bool success, string message = null, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
public abstract void TrackAvailability(string name, DateTimeOffset timeStamp, TimeSpan duration, string runLocation, bool success, string message = null, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null);
|
||||
|
||||
/// <summary>
|
||||
/// Send information about an external dependency (outgoing call) in the application.
|
||||
|
@ -40,9 +38,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// <param name="duration">The time taken by the external dependency to handle the call.</param>
|
||||
/// <param name="resultCode">Result code of dependency call execution.</param>
|
||||
/// <param name="success">True if the dependency call was handled successfully.</param>
|
||||
public virtual void TrackDependency(string dependencyTypeName, string target, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, string resultCode, bool success)
|
||||
{
|
||||
}
|
||||
public abstract void TrackDependency(string dependencyTypeName, string target, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, string resultCode, bool success);
|
||||
|
||||
/// <summary>
|
||||
/// Logs custom events with extensible named fields.
|
||||
|
@ -50,9 +46,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// <param name="eventName">A name for the event.</param>
|
||||
/// <param name="properties">Named string values you can use to search and classify events.</param>
|
||||
/// <param name="metrics">Measurements associated with this event.</param>
|
||||
public virtual void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
public abstract void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a system exception.
|
||||
|
@ -60,9 +54,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// <param name="exception">The exception to log.</param>
|
||||
/// <param name="properties">Named string values you can use to classify and search for this exception.</param>
|
||||
/// <param name="metrics">Additional values associated with this exception.</param>
|
||||
public virtual void TrackException(Exception exception, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
public abstract void TrackException(Exception exception, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null);
|
||||
|
||||
/// <summary>
|
||||
/// Send a trace message.
|
||||
|
@ -70,25 +62,19 @@ namespace Microsoft.Bot.Builder
|
|||
/// <param name="message">Message to display.</param>
|
||||
/// <param name="severityLevel">Trace severity level <see cref="Severity"/>.</param>
|
||||
/// <param name="properties">Named string values you can use to search and classify events.</param>
|
||||
public virtual void TrackTrace(string message, Severity severityLevel, IDictionary<string, string> properties)
|
||||
{
|
||||
}
|
||||
public abstract void TrackTrace(string message, Severity severityLevel, IDictionary<string, string> properties);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a page view.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the page view to log.</param>
|
||||
/// <param name="name">The name of the dialog view to log.</param>
|
||||
/// <param name="properties">Named string values you can use to search and classify events.</param>
|
||||
/// <param name="metrics">Measurements associated with this event.</param>
|
||||
public virtual void TrackPageView(string name, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
public abstract void TrackDialogView(string name, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null);
|
||||
|
||||
/// <summary>
|
||||
/// Flushes the in-memory buffer and any metrics being pre-aggregated.
|
||||
/// </summary>
|
||||
public virtual void Flush()
|
||||
{
|
||||
}
|
||||
public abstract void Flush();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,36 @@
|
|||
namespace Microsoft.Bot.Builder
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Bot.Builder
|
||||
{
|
||||
public class NullLogTelemetryClient : LogTelemetryClient
|
||||
public class NullLogTelemetryClient : LogTelemetryClientBase
|
||||
{
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
public override void TrackAvailability(string name, DateTimeOffset timeStamp, TimeSpan duration, string runLocation, bool success, string message = null, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void TrackDependency(string dependencyTypeName, string target, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, string resultCode, bool success)
|
||||
{
|
||||
}
|
||||
|
||||
public override void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void TrackException(Exception exception, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void TrackDialogView(string name, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void TrackTrace(string message, Severity severityLevel, IDictionary<string, string> properties)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// </summary>
|
||||
/// <param name="logTelemetryClient">The telemetry client to send telemetry events to.</param>
|
||||
/// <param name="logPersonalInformation">`true` to include personally identifiable information; otherwise, `false`.</param>
|
||||
public TelemetryLoggerMiddleware(LogTelemetryClient logTelemetryClient, bool logPersonalInformation = false)
|
||||
public TelemetryLoggerMiddleware(LogTelemetryClientBase logTelemetryClient, bool logPersonalInformation = false)
|
||||
{
|
||||
LogTelemetryClient = logTelemetryClient ?? new NullLogTelemetryClient();
|
||||
LogPersonalInformation = logPersonalInformation;
|
||||
|
@ -66,7 +66,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// The <see cref="IBotTelemetryClient"/> this middleware uses to log events.
|
||||
/// </value>
|
||||
[JsonIgnore]
|
||||
public LogTelemetryClient LogTelemetryClient { get; }
|
||||
public LogTelemetryClientBase LogTelemetryClient { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Logs events for incoming, outgoing, updated, or deleted message activities, using the <see cref="TelemetryClient"/>.
|
||||
|
|
Загрузка…
Ссылка в новой задаче