private void GetActivityInfo(ref ServiceModelActivity activity, ref Activity boundOperation) { if (TraceUtility.MessageFlowTracingOnly) { if (OperationContext.Current != null) { Guid receivedActivityId = TraceUtility.GetReceivedActivityId(OperationContext.Current); if (receivedActivityId != Guid.Empty) { DiagnosticTrace.ActivityId = receivedActivityId; } } } else if (DiagnosticUtility.ShouldUseActivity || TraceUtility.ShouldPropagateActivity) { object obj2 = TraceUtility.ExtractAsyncOperationContextActivity(); if (obj2 != null) { if (DiagnosticUtility.ShouldUseActivity) { activity = obj2 as ServiceModelActivity; boundOperation = ServiceModelActivity.BoundOperation(activity, true); } else if (TraceUtility.ShouldPropagateActivity && (obj2 is Guid)) { Guid activityId = (Guid) obj2; boundOperation = Activity.CreateActivity(activityId); } } } }
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); } }
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); } }
internal static Activity CreateActivity(Guid activityId) { Activity activity = null; if (activityId != Guid.Empty) { Guid parentId = DiagnosticTrace.ActivityId; if (activityId != parentId) { activity = new Activity(activityId, parentId); } } return activity; }
internal static Activity CreateActivity(Guid activityId) { Activity retval = null; if (activityId != Guid.Empty) { Guid currentActivityId = DiagnosticTraceBase.ActivityId; if (activityId != currentActivityId) { retval = new Activity(activityId, currentActivityId); } } return retval; }
internal static void GetActivityInfo(ref ServiceModelActivity activity, ref Activity boundOperation) { if (TraceUtility.MessageFlowTracingOnly) { if (null != OperationContext.Current) { Guid activityId = TraceUtility.GetReceivedActivityId(OperationContext.Current); if (activityId != Guid.Empty) { DiagnosticTraceBase.ActivityId = activityId; } } } else if (DiagnosticUtility.ShouldUseActivity || TraceUtility.ShouldPropagateActivity) { object activityInfo = TraceUtility.ExtractAsyncOperationContextActivity(); if (activityInfo != null) { if (DiagnosticUtility.ShouldUseActivity) { activity = activityInfo as ServiceModelActivity; boundOperation = ServiceModelActivity.BoundOperation(activity, true); } else if (TraceUtility.ShouldPropagateActivity) { if (activityInfo is Guid) { Guid activityId = (Guid)activityInfo; boundOperation = Activity.CreateActivity(activityId); } } } } }
void TraceMilestone(TraceEventType type) { if (string.IsNullOrEmpty(this.Name)) { if (null != FxTrace.Trace) { CallEtwMileStoneEvent(type, null); } if (null != DiagnosticUtility.DiagnosticTrace) { TraceUtility.TraceEventNoCheck(type, TraceCode.ActivityBoundary, ServiceModelActivity.ActivityBoundaryDescription, null, ServiceModelActivity.ActivityBoundaryDescription, (Exception)null); } } else { if (null != FxTrace.Trace) { Dictionary <string, string> values = new Dictionary <string, string>(2); values["ActivityName"] = this.Name; values["ActivityType"] = ServiceModelActivity.ActivityTypeNames[(int)this.activityType]; using (DiagnosticUtility.ShouldUseActivity && Guid.Empty == activityId ? null : Activity.CreateActivity(this.Id)) { CallEtwMileStoneEvent(type, new DictionaryTraceRecord(values)); } } if (null != DiagnosticUtility.DiagnosticTrace) { Dictionary <string, string> values = new Dictionary <string, string>(2); values["ActivityName"] = this.Name; values["ActivityType"] = ServiceModelActivity.ActivityTypeNames[(int)this.activityType]; TraceUtility.TraceEventNoCheck(type, TraceCode.ActivityBoundary, ServiceModelActivity.ActivityBoundaryDescription, new DictionaryTraceRecord(values), null, null, this.Id); } } }