次の方法で共有


TelemetrySessionExtensions.PostOperation Method

Definition

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 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 StartOperation(TelemetrySession, String) which tracks both start and end points.

public static Microsoft.VisualStudio.Telemetry.TelemetryEventCorrelation PostOperation (this Microsoft.VisualStudio.Telemetry.TelemetrySession session, string eventName, Microsoft.VisualStudio.Telemetry.TelemetryResult result, string resultSummary = default, Microsoft.VisualStudio.Telemetry.TelemetryEventCorrelation[] correlatedWith = default);
static member PostOperation : Microsoft.VisualStudio.Telemetry.TelemetrySession * string * Microsoft.VisualStudio.Telemetry.TelemetryResult * string * Microsoft.VisualStudio.Telemetry.TelemetryEventCorrelation[] -> Microsoft.VisualStudio.Telemetry.TelemetryEventCorrelation
<Extension()>
Public Function PostOperation (session As TelemetrySession, eventName As String, result As TelemetryResult, Optional resultSummary As String = Nothing, Optional correlatedWith As TelemetryEventCorrelation() = Nothing) As TelemetryEventCorrelation

Parameters

session
TelemetrySession

telemetry session object.

eventName
String

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;

result
TelemetryResult

the result of this user task. If the result is Failure, recommend correlate with FaultEvent.

resultSummary
String

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 FaultEvent. E.g., "sign in failed because of wrong credential", "user cancelled azure deployment". Default value is null.

correlatedWith
TelemetryEventCorrelation[]

Specify which events to correlate by using property Correlation Good candidates to correlate with OperationEvent are, FaultEventAssetEventUserTaskEvent

Returns

The operation event correlation.

Applies to