public void Sent()
        {
            _totalSent.Increment();
            _sentPerSecond.Increment();

            _sendFaultPercentageBase.Increment();
        }
示例#2
0
        public override bool IsAuthorized(AuthorizationContext context, string resource)
        {
            bool authorized;

            VerifyArgument.IsNotNull("resource", resource);

            var user = Common.Utilities.OrginalExecutingUser ?? ClaimsPrincipal.Current;

            var requestKey = new Tuple <string, string, AuthorizationContext>(user.Identity.Name, resource, context);

            authorized = _cachedRequests.TryGetValue(requestKey, out Tuple <bool, DateTime> authorizedRequest) && DateTime.Now.Subtract(authorizedRequest.Item2) < _timeOutPeriod ? authorizedRequest.Item1 : IsAuthorized(user, context, resource);

            if (!authorized)
            {
                if (ResultsCache.Instance.ContainsPendingRequestForUser(user.Identity.Name))
                {
                    authorized = true;
                }
            }
            else
            {
                if (resource != Guid.Empty.ToString())
                {
                    authorizedRequest = new Tuple <bool, DateTime>(authorized, DateTime.Now);
                    _cachedRequests.AddOrUpdate(requestKey, authorizedRequest, (tuple, tuple1) => authorizedRequest);
                }
            }

            if (!authorized)
            {
                _perfCounter?.Increment();
            }
            return(authorized);
        }
        public void Published()
        {
            _totalPublished.Increment();
            _publishedPerSecond.Increment();

            _publishFaultPercentageBase.Increment();
        }
        public void Consumed(TimeSpan duration)
        {
            _totalMessages.Increment();
            _consumeRate.Increment();

            _duration.IncrementBy((long)duration.TotalMilliseconds);
            _durationBase.Increment();

            _faultPercentageBase.Increment();
        }
        public void Consumed(TimeSpan duration)
        {
            _totalConsumed.Increment();
            _consumedPerSecond.Increment();

            _consumeDuration.IncrementBy((long)duration.TotalMilliseconds);
            _consumeDurationBase.Increment();

            _faultPercentageBase.Increment();
        }
示例#6
0
 public void FireIssued(bool succeed)
 {
     if (succeed)
     {
         m_issuedCounter.Increment();
     }
     else
     {
         m_failedCounter.Increment();
     }
 }
示例#7
0
        public IResource GetResource(Guid workspaceID, Guid resourceID)
        {
            IResource foundResource = null;

            try
            {
                if (_workspaceResources.TryGetValue(workspaceID, out List <IResource> resources))
                {
                    foundResource = resources.AsParallel().FirstOrDefault(resource => resource.ResourceID == resourceID);
                }

                if (foundResource == null && workspaceID != GlobalConstants.ServerWorkspaceID && _workspaceResources.TryGetValue(GlobalConstants.ServerWorkspaceID, out resources))
                {
                    foundResource = resources.AsParallel().FirstOrDefault(resource => resource.ResourceID == resourceID);
                }
            }
            catch (Exception e)
            {
                Dev2Logger.Error(ErrorResource.ErrorGettingResources, e, GlobalConstants.WarewolfError);
            }
            if (foundResource == null)
            {
                _perfCounter?.Increment();
            }
            return(foundResource);
        }
        public Guid Execute(out ErrorResultTO errors, int update)
        {
            var start = _stopwatch.ElapsedTicks;
            var errorsInstanceCounter     = _locater.GetCounter(GetDataObject().ResourceID, WarewolfPerfCounterType.ExecutionErrors);
            var concurrentInstanceCounter = _locater.GetCounter(GetDataObject().ResourceID, WarewolfPerfCounterType.ConcurrentRequests);
            var avgExecutionsInstance     = _locater.GetCounter(GetDataObject().ResourceID, WarewolfPerfCounterType.AverageExecutionTime);
            var reqPerSecond = _locater.GetCounter(GetDataObject().ResourceID, WarewolfPerfCounterType.RequestsPerSecond);
            var outErrors    = new ErrorResultTO();

            try
            {
                _recPerSecondCounter.Increment();
                _currentConnections.Increment();
                reqPerSecond.Increment();
                concurrentInstanceCounter.Increment();
                var ret = Container.Execute(out outErrors, update);
                errors = outErrors;
                return(ret);
            }
            finally
            {
                _currentConnections.Decrement();
                concurrentInstanceCounter.Decrement();
                var time = _stopwatch.ElapsedTicks - start;
                _avgTime.IncrementBy(time);
                avgExecutionsInstance.IncrementBy(time);
                if (outErrors != null)
                {
                    _totalErrors.IncrementBy(outErrors.FetchErrors().Count);
                    errorsInstanceCounter.IncrementBy(outErrors.FetchErrors().Count);
                }
            }
        }
 public void FireAuthentication(bool succeed)
 {
     authenticationCounter.Increment();
     if (!succeed)
     {
         authenticationFailedCounter.Increment();
     }
 }
        public void ConsumeFaulted(TimeSpan duration)
        {
            _totalConsumed.Increment();
            _consumedPerSecond.Increment();

            _faulted.Increment();

            _faultPercentage.Increment();
            _faultPercentageBase.Increment();
        }
        public void Faulted()
        {
            _totalMessages.Increment();
            _consumeRate.Increment();

            _totalFaults.Increment();

            _faultPercentage.Increment();
            _faultPercentageBase.Increment();
        }
示例#12
0
        public void Faulted()
        {
            _totalConsumed.Increment();
            _consumedPerSecond.Increment();

            _faulted.Increment();

            _faultPercentage.Increment();
            _faultPercentageBase.Increment();
        }
示例#13
0
 public void Increment()
 {
     try
     {
         _innerCounter.Increment();
     }
     catch
     {
         ChangeCounter(_nullPerformanceCounter);
     }
 }
示例#14
0
 public void FireAccessed(bool hit)
 {
     if (hit)
     {
         m_hitsCounter.Increment();
     }
     else
     {
         m_missesCounter.Increment();
     }
 }
示例#15
0
 public void FireStored(bool succeed)
 {
     if (succeed)
     {
         m_storedCounter.Increment();
     }
     else
     {
         m_failedCounter.Increment();
     }
 }
示例#16
0
 public void FireRendered(bool succeed)
 {
     if (succeed)
     {
         m_renderedCounter.Increment();
     }
     else
     {
         m_failedCounter.Increment();
     }
 }
示例#17
0
 public void FireVerified(bool succeed)
 {
     if (succeed)
     {
         m_verificationCounter.Increment();
     }
     else
     {
         m_verificationFailedCounter.Increment();
     }
 }
        /// <summary>
        /// Finds the service by name
        /// </summary>
        /// <param name="serviceName">Name of the service.</param>
        /// <param name="workspaceID">The workspace ID.</param>
        /// <exception cref="System.IO.InvalidDataException">Empty or null service passed in</exception>
        /// <exception cref="System.Runtime.Serialization.InvalidDataContractException">Null workspace</exception>
        public DynamicService FindService(string serviceName, Guid workspaceID)
        {
            if (string.IsNullOrEmpty(serviceName))
            {
                throw new InvalidDataException(ErrorResource.ServiceIsNull);
            }
            var            res = _resourceCatalog.GetResource(workspaceID, serviceName);
            DynamicService ret = null;

            if (res != null)
            {
                ret = ServiceActionRepo.Instance.ReadCache(res.ResourceID);
            }
            if (ret == null)
            {
                ret = _resourceCatalog.GetDynamicObjects <DynamicService>(workspaceID, serviceName).FirstOrDefault();
                if (ret == null)
                {
                    _perfCounter.Increment();
                }
            }
            return(ret);
        }
示例#19
0
 public void Increment()
 {
     try
     {
         if (_counter.IsActive)
         {
             _counter.Setup();
             _counter.Increment();
         }
     }
     catch (Exception e)
     {
         Dev2Logger.Error(e, GlobalConstants.WarewolfError);
     }
 }
示例#20
0
 public void Increment()
 {
     try
     {
         if (_counter.IsActive)
         {
             _counter.Setup();
             _counter.Increment();
         }
     }
     catch (Exception e)
     {
         Dev2Logger.Error(e);
     }
 }
示例#21
0
        public sealed override bool IsAuthorized(AuthorizationContext context, Guid resourceId)
        {
            bool authorized;

            VerifyArgument.IsNotNull("resourceId", resourceId);

            var user = Common.Utilities.OrginalExecutingUser ?? ClaimsPrincipal.Current;

            authorized = IsAuthorized(user, context, resourceId);

            if (!authorized)
            {
                if (ResultsCache.Instance.ContainsPendingRequestForUser(user.Identity.Name))
                {
                    authorized = true;
                }
            }

            if (!authorized)
            {
                _perfCounter?.Increment();
            }
            return(authorized);
        }
示例#22
0
 public virtual void Track(object instance, Burden burden)
 {
     if (burden.RequiresPolicyRelease == false)
     {
         var lifestyle = ((object)burden.Model.CustomLifestyle) ?? burden.Model.LifestyleType;
         throw new ArgumentException(
                   string.Format(
                       "Release policy was asked to track object '{0}', but its burden has 'RequiresPolicyRelease' set to false. If object is to be tracked the flag must be true. This is likely a bug in the lifetime manager '{1}'.",
                       instance, lifestyle));
         ;
     }
     using (@lock.ForWriting())
     {
         instance2Burden.Add(instance, burden);
         burden.Released += OnInstanceReleased;
     }
     countOfTrackedInstances.Increment();
 }
示例#23
0
 public void FireFailed()
 {
     m_failedCounter.Increment();
 }