Class TelemetryHelper
Provides support for sending Telemetry information to Application Insights.
Inheritance
Inherited Members
Namespace: CrashCABN.Shared
Assembly: CrashCABN.Shared.dll
Syntax
public static class TelemetryHelper
Properties
View SourceInvocationId
Gets or sets the InvocationId.
Declaration
public static Guid InvocationId { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
Logger
Gets or sets the optional additional logger.
Declaration
public static ILogger? Logger { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<ILogger> |
Methods
View SourceFlush()
Flushes the in-memory and any metrics gathering data.
Declaration
public static void Flush()
MonitorDiskSpace()
Creates a timer to monitor and report disk usage.
Declaration
public static void MonitorDiskSpace()
TrackCrashDownloadSize(Int64, Guid, Boolean, String)
Sends metric and text information about the worker host's working drive to Application Insights.
Declaration
public static void TrackCrashDownloadSize(long cabBytes, Guid crashId, bool passedDiskSpaceCheck, string driveLetter = "C:\\")
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | cabBytes | Cab size in bytes. |
System.Guid | crashId | The GUID for this crash. |
System.Boolean | passedDiskSpaceCheck | Boolean flag indicating whether the check for sufficient disk space passed. |
System.String | driveLetter | Drive letter for cab download. |
TrackDiskPercentUsed(String)
Sends metric and text information about the worker host's working drive to Application Insights.
Declaration
public static void TrackDiskPercentUsed(string driveLetter = "C:\\")
Parameters
Type | Name | Description |
---|---|---|
System.String | driveLetter | Drive letter for drive to report on. |
TrackEvent(TelemetryHelper.Events, String, String)
Sends a standard event message to Application Insights.
Declaration
public static void TrackEvent(TelemetryHelper.Events telemetryEvent, string eventData, string result = null)
Parameters
Type | Name | Description |
---|---|---|
TelemetryHelper.Events | telemetryEvent | Telemetry Event from events Enum. |
System.String | eventData | Event Information to send with telemetry event. |
System.String | result | Any specific results that correspond to the event data. (such as the result of the operation). |
TrackException(Exception, String)
Sends an exception to Application Insights.
Declaration
public static void TrackException(Exception exception, string extendedMessage = null)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | Exception to report. |
System.String | extendedMessage | Extended message to include with the exception in Application Insights. |
TrackTrace(String, SeverityLevel)
Send a trace message for display in Diagnostic Search.
Declaration
public static void TrackTrace(string msg, SeverityLevel sevLvl = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | msg | The trace message to send. |
SeverityLevel | sevLvl | The severity level. Default: SeverityLevel.Information When provided, the message is logged to AppInsights as well as Azure logs. |