Пример #1
0
        static bool SampleFilter(ref ActivityScope scope)
        {
            if (scope.TraceId.ToString().EndsWith("00", StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }

            return(false);
        }
 internal void OnScopeStopped(ref ActivityScope activityScope)
 {
     // This array is immutable once assigned to _listeners
     // TODO: If this is in a final implementation we'd want
     // to confirm .NET gives us the memory model guarantees to
     // do this without a lock or an explicit read barrier, but
     // I this it does.
     IActivityListener[] listeners = _listeners;
     if (listeners == null)
     {
         return;
     }
     for (int i = 0; i < listeners.Length; i++)
     {
         listeners[i].ActivityScopeStopped(this, ref activityScope);
     }
 }
Пример #3
0
 static void FourActivityWorkItem()
 {
     using (var scope = new ActivityScope(_httpIn, ParseActivityTraceId, incomingActivityId))
     {
         scope.AddTag("route", "/foo/bar");
         scope.AddTag("usedid", "1239");
         using (var scope2 = new ActivityScope(_fooBar))
         {
             scope2.AddTag("one", "1");
             scope2.AddTag("two", "2");
             using (var scope3 = new ActivityScope(_clientRequest1))
             {
                 scope3.AddTag("one", "1");
                 scope3.AddTag("two", "2");
             }
             using (var scope4 = new ActivityScope(_clientRequest2))
             {
                 scope4.AddTag("one", "1");
                 scope4.AddTag("two", "2");
             }
         }
     }
 }