/// <summary> /// Post an Operation event. /// An operation performs some work in application and comes with result (e.g., Success, Failure). /// If the operation is invoked by user directly, please use <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" /> or related methods. /// A few examples of operations are, license check, package load, windows layout loading. /// /// This method is used for atomic operation that runs very fast or has little value to analyze the process duration. Caller calls this method when operation is complete. /// For long-time running or async operation, in order to understand what else happened during the time or track if it partially completes because of an error, /// use method <see cref="M:Coding4Fun.VisualStudio.Telemetry.TelemetrySessionExtensions.StartOperation(Coding4Fun.VisualStudio.Telemetry.TelemetrySession,System.String)" /> which tracks both start and end points. /// </summary> /// <param name="session">telemetry session object.</param> /// <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="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"> /// optional parameter. 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> /// <param name="correlatedWith"> /// Specify which events to correlate by using property <see cref="P:Coding4Fun.VisualStudio.Telemetry.TelemetryEvent.Correlation" /> /// Good candidates to correlate with <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> are, /// <see cref="T:Coding4Fun.VisualStudio.Telemetry.FaultEvent" /> /// <see cref="T:Coding4Fun.VisualStudio.Telemetry.AssetEvent" /> /// <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" /> /// </param> /// <returns>The operation event correlation.</returns> public static TelemetryEventCorrelation PostOperation(this TelemetrySession session, string eventName, TelemetryResult result, string resultSummary = null, TelemetryEventCorrelation[] correlatedWith = null) { CodeContract.RequiresArgumentNotNull <TelemetrySession>(session, "session"); return(session.PostOperationHelper(() => new OperationEvent(eventName, result, resultSummary), correlatedWith)); }