Editare

Partajați prin


Activity.SetParentId Method

Definition

Overloads

SetParentId(String)

Updates this Activity to indicate that the Activity with an ID of parentId caused this Activity.

SetParentId(ActivityTraceId, ActivitySpanId, ActivityTraceFlags)

Sets the parent ID using the W3C convention of a TraceId and a SpanId.

SetParentId(String)

Source:
Activity.cs
Source:
Activity.cs
Source:
Activity.cs

Updates this Activity to indicate that the Activity with an ID of parentId caused this Activity.

public:
 System::Diagnostics::Activity ^ SetParentId(System::String ^ parentId);
public System.Diagnostics.Activity SetParentId (string parentId);
member this.SetParentId : string -> System.Diagnostics.Activity
Public Function SetParentId (parentId As String) As Activity

Parameters

parentId
String

The ID of the parent operation.

Returns

this for convenient chaining.

Remarks

  • This method should only be used in 'boundary' scenarios where an Activity from another process logically started this Activity. The parentId brings up the Tags (as well as the ParentId property) and can be used to reconstruct the causal tree.
  • This method is only intended for use with Activities created from the Activity constructor. Activities created by calling CreateActivity or StartActivity already have the parent ID set, and invoking this method has no effect.
  • This method should only be used before starting the Activity object. This method has no effect if you call it after the Activity object has started.

Applies to

SetParentId(ActivityTraceId, ActivitySpanId, ActivityTraceFlags)

Source:
Activity.cs
Source:
Activity.cs
Source:
Activity.cs

Sets the parent ID using the W3C convention of a TraceId and a SpanId.

public System.Diagnostics.Activity SetParentId (System.Diagnostics.ActivityTraceId traceId, System.Diagnostics.ActivitySpanId spanId, System.Diagnostics.ActivityTraceFlags activityTraceFlags = System.Diagnostics.ActivityTraceFlags.None);
member this.SetParentId : System.Diagnostics.ActivityTraceId * System.Diagnostics.ActivitySpanId * System.Diagnostics.ActivityTraceFlags -> System.Diagnostics.Activity
Public Function SetParentId (traceId As ActivityTraceId, spanId As ActivitySpanId, Optional activityTraceFlags As ActivityTraceFlags = System.Diagnostics.ActivityTraceFlags.None) As Activity

Parameters

traceId
ActivityTraceId

The parent activity's TraceId.

spanId
ActivitySpanId

The parent activity's SpanId.

activityTraceFlags
ActivityTraceFlags

One of the enumeration values that specifies flags defined by the W3C standard that are associated with an activity.

Returns

this for convenient chaining.

Remarks

  • This method has the advantage that no string manipulation is needed to set the ID.
  • This method should only be used before starting the Activity object. This method has no effect if you call it after the Activity object has started.

Applies to