コード例 #1
0
        static internal void TraceTransfer(Guid newId)
        {
            Guid oldId = DiagnosticTrace.GetActivityId();

            if (DiagnosticTrace.ShouldCorrelate && newId != oldId)
            {
                if (DiagnosticTrace.HaveListeners)
                {
                    try
                    {
                        if (newId != oldId)
                        {
                            DiagnosticTrace.TraceSource.TraceTransfer(0, null, newId);
                        }
                    }
                    catch (OutOfMemoryException)
                    {
                        throw;
                    }
                    catch (StackOverflowException)
                    {
                        throw;
                    }
                    catch (ThreadAbortException)
                    {
                        throw;
                    }
                    catch (Exception e)
                    {
                        LogTraceFailure(null, e);
                    }
                }
            }
        }
コード例 #2
0
 static internal void GetActivityId(ref Guid guid)
 {
     //If activity id propagation is disabled for performance, we return nothing avoiding CallContext access.
     if (DiagnosticTrace.ShouldCorrelate)
     {
         guid = DiagnosticTrace.GetActivityId();
     }
 }
コード例 #3
0
        internal static Activity CreateActivity(Guid newGuid, bool emitTransfer)
        {
            Activity retval = null;

            if (DiagnosticTrace.ShouldCorrelate &&
                (newGuid != Guid.Empty) &&
                (newGuid != DiagnosticTrace.GetActivityId()))
            {
                retval = new Activity(ref newGuid, emitTransfer);
            }
            return(retval);
        }
コード例 #4
0
 private Activity(ref Guid newGuid, bool emitTransfer)
 {
     this.emitTransfer = emitTransfer;
     if (DiagnosticTrace.ShouldCorrelate && (newGuid != Guid.Empty))
     {
         this.newGuid = newGuid;
         this.oldGuid = DiagnosticTrace.GetActivityId();
         if (this.oldGuid != newGuid)
         {
             this.mustDispose = true;
             if (this.emitTransfer)
             {
                 DiagnosticTrace.TraceTransfer(newGuid);
             }
             DiagnosticTrace.SetActivityId(newGuid);
         }
     }
 }