/// <summary> /// Create a FaultEvent. /// The pattern: /// 1. FEvent = new FaultEvent(...) /// 2. tsession.PostEvent(FEvent) //posts the event to Watson and AI /// External users should call the TelemetrySession extension methods "PostFault" (which calls PostEvent) /// It becomes more useful when correlated with <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" /> or <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> which may have led to the fault occurence. /// </summary> /// <param name="eventName"> /// An event name following data model schema. /// It requires that event name is a unique, not null or empty string. /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/". /// For examples, /// vs/platform/opensolution; /// vs/platform/editor/lightbulb/fixerror; /// </param> /// <param name="description"></param> /// <param name="faultSeverity">The severity of the fault, used to identify actionable or important faults in divisional tools and reporting.</param> /// <param name="exceptionObject"></param> /// <param name="gatherEventDetails">This delegate is called to gather expensive details (like jscript call stacks) only when not sampled. /// The callback parameter can be cast to to a FaultEvent or (IVsFaultEvent in native) which inherits from TelemetryEvent (IVsTelemetryEvent in native) /// <seealso cref="T:Coding4Fun.VisualStudio.Telemetry.IFaultUtility" /> /// </param> public FaultEvent(string eventName, string description, FaultSeverity faultSeverity, Exception exceptionObject = null, Func <IFaultUtility, int> gatherEventDetails = null) : base(eventName, TelemetrySeverity.High, DataModelEventType.Fault) { Description = (description ?? string.Empty); ExceptionObject = exceptionObject; GatherEventDetails = gatherEventDetails; FaultSeverity = faultSeverity; UserOptInToWatson = FaultEventWatsonOptIn.Unspecified; DataModelEventNameHelper.SetProductFeatureEntityName(this); }
/// <summary> /// Initializes a new instance of the <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> class. /// </summary> /// <param name="eventName"> /// An event name following data model schema. /// It requires that event name is a unique, not null or empty string. /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/". /// For examples, /// vs/platform/opensolution; /// vs/platform/editor/lightbulb/fixerror; /// </param> /// <param name="eventType">The type of event.</param> /// <param name="stageType">The type of operation.</param> /// <param name="result">the result of this user task. If the result is Failure, recommend correlate with <see cref="T:Coding4Fun.VisualStudio.Telemetry.FaultEvent" />.</param> /// <param name="resultSummary"> /// a summary description for the result. /// it provides a little bit more details about the result without digging into it. /// when correlated with fault event, use this parameter to summarize the additional information stored in <see cref="T:Coding4Fun.VisualStudio.Telemetry.FaultEvent" />. /// E.g., "sign in failed because of wrong credential", "user cancelled azure deployment". /// Default value is null. /// </param> internal OperationEvent(string eventName, DataModelEventType eventType, OperationStageType stageType, TelemetryResult result, string resultSummary = null) : base(eventName, TelemetrySeverity.Normal, eventType) { if (eventType != 0 && eventType != DataModelEventType.Operation) { throw new ArgumentException("Expect DataModelEventType UserTask or Operation only.", "eventType"); } DataModelEventNameHelper.SetProductFeatureEntityName(this); StageType = stageType; SetResultProperties(result, resultSummary); }
/// <summary> /// Initializes a new instance of the <see cref="T:Coding4Fun.VisualStudio.Telemetry.AssetEvent" /> class. /// </summary> /// <param name="eventName"> /// An event name following data model schema. /// It requires that event name is a unique, not null or empty string. /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/". /// For examples, /// vs/platform/opensolution; /// vs/platform/editor/lightbulb/fixerror; /// </param> /// <param name="assetId"> /// Used to identify the asset. The id should be immutable in the asset life cycle, even if the status or content changes over time. /// E.g., project guid is generated during project creation and will never change. This makes it a good candidate for asset id of Project asset. /// </param> /// <param name="assetEventVersion"> /// Used for customized properties versioning. /// E.g., project asset posts event with name "vs/platform/project". /// If the event is updated, uses this parameter to increment the version. /// </param> /// <param name="correlation"> /// Correlation value for this event. /// </param> public AssetEvent(string eventName, string assetId, int assetEventVersion, TelemetryEventCorrelation correlation) : base(eventName, TelemetrySeverity.Normal, correlation) { if (correlation.EventType != DataModelEventType.Asset) { throw new ArgumentException("Property EventType should be AssetEvent.", "correlation"); } DataModelEventNameHelper.SetProductFeatureEntityName(this); AssetId = assetId; base.ReservedProperties["DataModel.Asset.AssetId"] = assetId; AssetEventVersion = assetEventVersion; base.ReservedProperties["DataModel.Asset.SchemaVersion"] = assetEventVersion; }