public MembershipInstrumentationProvider(bool enabled)
        {
            var factory = new PerformanceCounterFactory(InstrumentationNames.DemoMembershipCategory, InstrumentationNames.InstanceSuffix, enabled);

            authenticationCounter       = factory.Create("Authentication Requests/sec", "Total Authentication Requests");
            authenticationFailedCounter = factory.Create("Authentication Failed Requests/sec", "Total Authentication Failed Requests");
        }
Exemplo n.º 2
0
        public static IList <IResourcePerformanceCounter> GetResourceCounters(this List <IPerformanceCountersByResource> to)
        {
            var res = new List <IResourcePerformanceCounter>();
            var performanceCountersByResources = to.Where(resource => !resource.IsDeleted && !string.IsNullOrEmpty(resource.CounterName));
            var performanceCounterFactory      = new PerformanceCounterFactory();

            foreach (var resourcePerformanceCounter in performanceCountersByResources)
            {
                if (resourcePerformanceCounter.TotalErrors)
                {
                    var counter = new WarewolfNumberOfErrorsByResource(resourcePerformanceCounter.ResourceId, resourcePerformanceCounter.CounterName, performanceCounterFactory);
                    res.Add(counter);
                }
                if (resourcePerformanceCounter.AverageExecutionTime)
                {
                    var counter = new WarewolfAverageExecutionTimePerformanceCounterByResource(resourcePerformanceCounter.ResourceId, resourcePerformanceCounter.CounterName, performanceCounterFactory);
                    res.Add(counter);
                }
                if (resourcePerformanceCounter.ConcurrentRequests)
                {
                    var counter = new WarewolfCurrentExecutionsPerformanceCounterByResource(resourcePerformanceCounter.ResourceId, resourcePerformanceCounter.CounterName, performanceCounterFactory);
                    res.Add(counter);
                }
                if (resourcePerformanceCounter.RequestPerSecond)
                {
                    var counter = new WarewolfRequestsPerSecondPerformanceCounterByResource(resourcePerformanceCounter.ResourceId, resourcePerformanceCounter.CounterName, performanceCounterFactory);
                    res.Add(counter);
                }
            }
            return(res);
        }
Exemplo n.º 3
0
 public CounterListener(string category, string instance, string counterName,
                        PerformanceCounterFactory counterFactory)
 {
     _category       = category;
     _instance       = instance;
     _counterName    = counterName;
     _counterFactory = counterFactory;
     _counter        = CreateCounter(category, instance, counterName);
 }
Exemplo n.º 4
0
        public AppPoolListener(string appPoolName, string category, string counter, CounterInstanceNameCache counterInstanceNameCache, PerformanceCounterFactory counterFactory)
        {
            this.appPoolName          = appPoolName;
            this.category             = category;
            this.counter              = counter;
            _counterInstanceNameCache = counterInstanceNameCache;
            _counterFactory           = counterFactory;

            this.LoadCounterInstanceName();
        }
Exemplo n.º 5
0
        public CaptchaInstrumentationProvider(string category, string instanceNameSuffix, bool enabled)
        {
            var factory = new PerformanceCounterFactory(category, instanceNameSuffix, enabled);

            m_issuedCounter             = factory.Create("Total Captcha Requests", "Captcha Requests/sec");
            m_failedCounter             = factory.Create("Total Captcha Failed Requests", "Captcha Failed Requests/sec");
            m_renderedCounter           = factory.Create("Total Captcha Render Requests", "Captcha Render Requests/sec");
            m_verificationCounter       = factory.Create("Total Captcha Verification Requests", "Captcha Verification Requests/sec");
            m_verificationFailedCounter = factory.Create("Total Captcha Verification Failed Requests", "Captcha Verification Failed Requests/sec");
        }
Exemplo n.º 6
0
        public CachingInstrumentationProvider(string category, string instanceNameSuffix, bool enabled)
        {
            var factory = new PerformanceCounterFactory(category, instanceNameSuffix, enabled);

            m_failedCounter  = factory.Create("Total Cache Failed Requests", "Cache Failed Requests/sec");
            m_hitsCounter    = factory.Create("Total Cache Hits", "Cache Hits/sec");
            m_missesCounter  = factory.Create("Total Cache Misses", "Cache Misses/sec");
            m_storedCounter  = factory.Create("Total Cache Store Requests", "Cache Store Requests/sec");
            m_removedCounter = factory.Create("Total Cache Remove Requests", "Cache Remove Requests/sec");
        }
        protected override void Load(ContainerBuilder builder)
        {
            base.Load(builder);

            builder.RegisterAssemblyTypes(
                Assembly.GetExecutingAssembly())
            .Where(t => !t.IsAbstract && typeof(ApiController).IsAssignableFrom(t))
            .InstancePerMatchingLifetimeScope(AutofacWebApiDependencyResolver.ApiRequestTag);

            builder.Register(c => PerformanceCounterFactory.GetCounters <SampleCounters>()).AsImplementedInterfaces().AsSelf().SingleInstance();
            builder.Register(c => PerformanceCounterFactory.GetCounters <ClrMemoryCounters>()).AsImplementedInterfaces().AsSelf().SingleInstance();

            builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
        }
 public SampleCountersInstaller()
 {
     Installers.Add(PerformanceCounterFactory.GetInstallerFor <SampleCounters>());
 }