private void Init(ActionExecutingContext actionContext)
        {
            SetEventPolicy();
            SetPublishCounterPolicy();
            SetErrorPolicy();

            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            var instanceName = InstanceName;

            if (_instanceNameProvider != null)
            {
                instanceName = _instanceNameProvider.GetInstanceName(actionContext);
            }

            if (instanceName == null)
            {
                InstanceName = PerfItRuntime.GetCounterInstanceName(
                    actionContext.ActionDescriptor.ControllerDescriptor.ControllerType,
                    actionContext.ActionDescriptor.ActionName);
            }

            _instrumentor = new SimpleInstrumentor(Info);
        }
Beispiel #2
0
        private void Init(ActionExecutingContext actionContext)
        {
            SetEventPolicy();
            SetPublishCounterPolicy();
            SetErrorPolicy();
            SetSamplingRate();

            if (SamplingRate == default(double))
            {
                SamplingRate = Constants.DefaultSamplingRate;
            }

            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            if (Counters == null || Counters.Length == 0)
            {
                Counters = CounterTypes.StandardCounters;
            }

            var instanceName = InstanceName;

            if (_instanceNameProvider != null)
            {
                instanceName = _instanceNameProvider.GetInstanceName(actionContext);
            }

            if (instanceName == null)
            {
                instanceName =
                    PerfItRuntime.GetCounterInstanceName(actionContext.ActionDescriptor.ControllerDescriptor.ControllerType,
                                                         actionContext.ActionDescriptor.ActionName);
            }

            _instrumentor = new SimpleInstrumentor(new InstrumentationInfo()
            {
                Description        = Description,
                Counters           = Counters,
                InstanceName       = instanceName,
                CategoryName       = CategoryName,
                SamplingRate       = SamplingRate,
                PublishCounters    = PublishCounters,
                PublishEvent       = PublishEvent,
                RaisePublishErrors = RaisePublishErrors,
                CorrelationIdKey   = CorrelationIdKey
            });
        }
        private void Init(ActionExecutingContext actionContext)
        {
            SetErrorPolicy();
            SetSamplingRate();

            if (SamplingRate == default(double))
            {
                SamplingRate = Constants.DefaultSamplingRate;
            }

            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            _instanceNameProvider = _instanceNameProvider ??
                                    (IInstanceNameProvider)actionContext.HttpContext.RequestServices.GetService(typeof(IInstanceNameProvider));

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            _instrumentationContextProvider = _instrumentationContextProvider ??
                                              (IInstrumentationContextProvider)actionContext.HttpContext.RequestServices.GetService(typeof(IInstrumentationContextProvider));

            var instanceName = InstanceName;

            if (_instanceNameProvider != null)
            {
                instanceName = _instanceNameProvider.GetInstanceName(actionContext);
            }

            if (instanceName == null)
            {
                instanceName =
                    PerfItRuntime.GetCounterInstanceName(actionContext.Controller.GetType(),
                                                         actionContext.ActionDescriptor.DisplayName);
            }

            var inst = new SimpleInstrumentor(new InstrumentationInfo()
            {
                Description        = Description,
                InstanceName       = instanceName,
                CategoryName       = CategoryName,
                SamplingRate       = SamplingRate,
                RaisePublishErrors = RaisePublishErrors
            });

            _instrumentor = inst;
        }
Beispiel #4
0
        private void Init(HttpActionContext actionContext)
        {
            SetEventPolicy();
            SetPublish();
            SetErrorPolicy();

            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            if (Counters == null || Counters.Length == 0)
            {
                Counters = CounterTypes.StandardCounters;
            }

            var instanceName = InstanceName;

            if (_instanceNameProvider != null)
            {
                instanceName = _instanceNameProvider.GetInstanceName(actionContext);
            }

            if (instanceName == null)
            {
                instanceName =
                    PerfItRuntime.GetCounterInstanceName(actionContext.ControllerContext.ControllerDescriptor.ControllerType,
                                                         actionContext.ActionDescriptor.ActionName);
            }

            _instrumentor = new SimpleInstrumentor(new InstrumentationInfo()
            {
                Description  = Description,
                Counters     = Counters,
                InstanceName = instanceName,
                CategoryName = CategoryName
            }, PublishCounters, PublishEvent, RaisePublishErrors);
        }
        private void Init()
        {
            _instrumentors = new ConcurrentDictionary <string, SimpleInstrumentor>();


            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            _instrumentationContextProvider = (IInstrumentationContextProvider) new InstrumentationContextProvider();

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            _inited = true;
        }
Beispiel #6
0
        private void Init()
        {
            SetEventPolicy();
            SetPublish();
            SetErrorPolicy();

            _instrumentors = new ConcurrentDictionary<string, SimpleInstrumentor>();

            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            _instrumentationContextProvider = (IInstrumentationContextProvider)new InstrumentationContextProvider();

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            _inited = true;
        }
Beispiel #7
0
        private void Init(ActionExecutingContext actionContext)
        {
            SetPublishCounterPolicy();
            SetErrorPolicy();
            SetSamplingRate();

            if (SamplingRate == default(double))
            {
                SamplingRate = Constants.DefaultSamplingRate;
            }

            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            if (Counters == null || Counters.Length == 0)
            {
                Counters = CounterTypes.StandardCounters;
            }

            var instanceName = InstanceName;

            if (_instanceNameProvider != null)
            {
                instanceName = _instanceNameProvider.GetInstanceName(actionContext);
            }

            if (instanceName == null)
            {
                instanceName =
                    PerfItRuntime.GetCounterInstanceName(actionContext.ActionDescriptor.ControllerDescriptor.ControllerType,
                                                         actionContext.ActionDescriptor.ActionName);
            }

            var inst = new SimpleInstrumentor(new InstrumentationInfo()
            {
                Description        = Description,
                Counters           = Counters,
                InstanceName       = instanceName,
                CategoryName       = CategoryName,
                SamplingRate       = SamplingRate,
                PublishCounters    = PublishCounters,
                RaisePublishErrors = RaisePublishErrors
            });

            _instrumentor = inst;

            if (TracerTypes != null)
            {
                foreach (var tt in TracerTypes)
                {
                    inst.Tracers.Add(tt.FullName, (ITwoStageTracer)Activator.CreateInstance(tt));
                }
            }
        }
        private void Init(HttpActionContext actionContext)
        {
            SetEventPolicy();
            SetPublish();
            SetErrorPolicy();

            if (InstanceNameProviderType != null)
            {
                _instanceNameProvider = (IInstanceNameProvider)Activator.CreateInstance(InstanceNameProviderType);
            }

            if (InstrumentationContextProviderType != null)
            {
                _instrumentationContextProvider = (IInstrumentationContextProvider)Activator.CreateInstance(InstrumentationContextProviderType);
            }

            if (Counters == null || Counters.Length == 0)
            {
                Counters = CounterTypes.StandardCounters;
            }

            var instanceName = InstanceName;
            if (_instanceNameProvider != null)
                instanceName = _instanceNameProvider.GetInstanceName(actionContext);

            if (instanceName == null)
                instanceName =
                    PerfItRuntime.GetCounterInstanceName(actionContext.ControllerContext.ControllerDescriptor.ControllerType,
                        actionContext.ActionDescriptor.ActionName);

            _instrumentor = new SimpleInstrumentor(new InstrumentationInfo()
            {
                Description = Description,
                Counters = Counters,
                InstanceName =  instanceName,
                CategoryName = CategoryName
            }, PublishCounters, PublishEvent, RaisePublishErrors);
        }