internal static void CreateActivityInfo(ref ServiceModelActivity activity, ref Activity boundActivity)
 {
     if (DiagnosticUtility.ShouldUseActivity)
     {
         activity = ServiceModelActivity.CreateAsyncActivity();
         TraceUtility.UpdateAsyncOperationContextWithActivity(activity);
         boundActivity = ServiceModelActivity.BoundOperation(activity, true);
     }
     else if (TraceUtility.MessageFlowTracingOnly)
     {
         Guid activityId = TraceUtility.GetReceivedActivityId(OperationContext.Current);
         if (activityId != Guid.Empty)
         {
             DiagnosticTraceBase.ActivityId = activityId;
         }
     }
     else if (TraceUtility.ShouldPropagateActivity)
     {
         //Message flow tracing only scenarios use a light-weight ActivityID management logic
         Guid activityId = ActivityIdHeader.ExtractActivityId(OperationContext.Current.IncomingMessage);
         if (activityId != Guid.Empty)
         {
             boundActivity = Activity.CreateActivity(activityId);
         }
         TraceUtility.UpdateAsyncOperationContextWithActivity(activityId);
     }
 }
예제 #2
0
 private void CreateActivityInfo(ref ServiceModelActivity activity, ref Activity boundActivity)
 {
     if (DiagnosticUtility.ShouldUseActivity)
     {
         activity = ServiceModelActivity.CreateAsyncActivity();
         TraceUtility.UpdateAsyncOperationContextWithActivity(activity);
         boundActivity = ServiceModelActivity.BoundOperation(activity, true);
     }
     else if (TraceUtility.MessageFlowTracingOnly)
     {
         Guid receivedActivityId = TraceUtility.GetReceivedActivityId(OperationContext.Current);
         if (receivedActivityId != Guid.Empty)
         {
             DiagnosticTrace.ActivityId = receivedActivityId;
         }
     }
     else if (TraceUtility.ShouldPropagateActivity)
     {
         Guid activityId = ActivityIdHeader.ExtractActivityId(OperationContext.Current.IncomingMessage);
         if (activityId != Guid.Empty)
         {
             boundActivity = Activity.CreateActivity(activityId);
         }
         TraceUtility.UpdateAsyncOperationContextWithActivity(activityId);
     }
 }