// ReSharper disable once SuggestBaseTypeForParameter
 internal InstrumentorRequiredEventArgs(string categoryName, IInstrumentationInfo info)
 {
     CategoryName = categoryName;
     // TODO: TBD: ICloneable would be better but for potential snag with the custom Attributes
     Info = new InstrumentationInfo(info);
     _lazyInstrumentor = new Lazy <SimpleInstrumentor>(GetDefaultInstrumentor);
 }
Пример #2
0
 public TraceData(IInstrumentationInfo info, long timeTakenMilli,
                  string correlationId, InstrumentationContext context)
 {
     TimeTakenMilli = timeTakenMilli;
     Info           = info;
     Context        = context;
     CorrelationId  = correlationId;
 }
Пример #3
0
        public SimpleInstrumentor(IInstrumentationInfo info)
        {
            _info = info;
            if (info.CorrelationIdKey == null)
            {
                _info.CorrelationIdKey = Correlation.CorrelationIdKey;
            }

            PublishInstrumentationCallback = InstrumentationEventSource.Instance.WriteInstrumentationEvent;
        }
Пример #4
0
        public SimpleInstrumentor(IInstrumentationInfo info, 
            bool publishCounters = true, 
            bool publishEvent = true,
            bool raisePublishErrors = false)
        {
            _info = info;

            PublishCounters = publishCounters;
            RaisePublishErrors = raisePublishErrors;
            PublishEvent = publishEvent;
        }
Пример #5
0
 /// <summary>
 /// Copy Constructor
 /// </summary>
 /// <param name="other"></param>
 public InstrumentationInfo(IInstrumentationInfo other)
 {
     CategoryName       = other.CategoryName;
     Counters           = other.Counters.ToArray();
     Description        = other.Description;
     InstanceName       = other.InstanceName;
     PublishCounters    = other.PublishCounters;
     PublishEvent       = other.PublishEvent;
     RaisePublishErrors = other.RaisePublishErrors;
     SamplingRate       = other.SamplingRate;
 }
Пример #6
0
        public SimpleInstrumentor(IInstrumentationInfo info,
                                  bool publishCounters    = true,
                                  bool publishEvent       = true,
                                  bool raisePublishErrors = false)
        {
            _info = info;

            PublishCounters    = publishCounters;
            RaisePublishErrors = raisePublishErrors;
            PublishEvent       = publishEvent;
        }
Пример #7
0
        /// <summary>
        /// ProtectedConstructor.
        /// </summary>
        /// <param name="categoryName"></param>
        /// <param name="description"></param>
        protected InstrumentationInfoAttributeBase(string categoryName, string description = null)
        {
            /* Decorator should wrap the Info instead of being an Info. That gets us
             * away from Reflection overhead as early as possible. */

            Info = new InstrumentationInfo
            {
                CategoryName = categoryName,
                Description  = description ?? string.Empty
            };
        }
Пример #8
0
        public SimpleInstrumentor(IInstrumentationInfo info)
        {
            _info = info;
            _info.CorrelationIdKey = _info.CorrelationIdKey ?? Correlation.CorrelationIdKey;
            _tracers.Add("EventSourceTracer", new EventSourceTracer());
#if NET452
            if (_info.PublishCounters)
            {
                _tracers.Add("PerformanceCounterTracer", new PerformanceCounterTracer(info));
            }
#endif
            PerfItRuntime.OnInstrumentorCreated(new InstrumentorCreatedArgs(this, info));
        }
Пример #9
0
        public TimedInstrumentationInfo(IInstrumentationInfo info)
        {
            this.CategoryName       = info.CategoryName;
            this.CorrelationIdKey   = info.CorrelationIdKey;
            this.Description        = info.Description;
            this.InstanceName       = info.InstanceName;
            this.Name               = info.Name;
            this.RaisePublishErrors = info.RaisePublishErrors;
            this.SamplingRate       = info.SamplingRate;

#if NET452
            this.PublishCounters = info.PublishCounters;
            this.Counters        = info.Counters;
#endif
        }
Пример #10
0
        public object Start(IInstrumentationInfo info)
        {
            var trace    = Trace.Current;
            var newTrace = trace == null?Trace.Create() : trace.Child();

            Trace.Current = newTrace;
            var span = new Span(newTrace.CurrentSpan, DateTime.UtcNow)
            {
                ServiceName = info.CategoryName,
                Name        = info.InstanceName
            };

            OnStarting(span);

            return(new Tuple <IInstrumentationInfo, Span, Stopwatch>(info, span, Stopwatch.StartNew()));
        }
Пример #11
0
        public SimpleInstrumentor(IInstrumentationInfo info)
        {
            _info = info;

            PublishInstrumentationCallback = InstrumentationEventSource.Instance.WriteInstrumentationEvent;
        }
Пример #12
0
 public object Start(IInstrumentationInfo info)
 {
     return(BuildContexts());
 }
Пример #13
0
 public PerformanceCounterTracer(IInstrumentationInfo instrumentationInfo)
 {
     _info = instrumentationInfo;
 }
Пример #14
0
 public PerfItFilterAttribute(string categoryName)
 {
     Info = new InstrumentationInfo {
         CategoryName = categoryName
     };
 }
Пример #15
0
 public object Start(IInstrumentationInfo info)
 {
     return(info);
 }
Пример #16
0
 public InstrumentorCreatedArgs(IInstrumentor instrumentor, IInstrumentationInfo info)
 {
     Info         = info;
     Instrumentor = instrumentor;
 }