public void Sent() { _totalSent.Increment(); _sentPerSecond.Increment(); _sendFaultPercentageBase.Increment(); }
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(); }
public void FireIssued(bool succeed) { if (succeed) { m_issuedCounter.Increment(); } else { m_failedCounter.Increment(); } }
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(); }
public void Faulted() { _totalConsumed.Increment(); _consumedPerSecond.Increment(); _faulted.Increment(); _faultPercentage.Increment(); _faultPercentageBase.Increment(); }
public void Increment() { try { _innerCounter.Increment(); } catch { ChangeCounter(_nullPerformanceCounter); } }
public void FireAccessed(bool hit) { if (hit) { m_hitsCounter.Increment(); } else { m_missesCounter.Increment(); } }
public void FireStored(bool succeed) { if (succeed) { m_storedCounter.Increment(); } else { m_failedCounter.Increment(); } }
public void FireRendered(bool succeed) { if (succeed) { m_renderedCounter.Increment(); } else { m_failedCounter.Increment(); } }
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); }
public void Increment() { try { if (_counter.IsActive) { _counter.Setup(); _counter.Increment(); } } catch (Exception e) { Dev2Logger.Error(e, GlobalConstants.WarewolfError); } }
public void Increment() { try { if (_counter.IsActive) { _counter.Setup(); _counter.Increment(); } } catch (Exception e) { Dev2Logger.Error(e); } }
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); }
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(); }
public void FireFailed() { m_failedCounter.Increment(); }