Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 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
            });
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
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));
                }
            }
        }
Ejemplo n.º 6
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);
        }