Пример #1
0
 /// <summary>
 /// Invoke ClearSlowHealthReportCallback if isHealthReportEnabled in FabricMonitoringParameters.
 /// Invoke stopTraceCallback if isApiLifeCycleTraceEnabled is true in FabricMonitoringParameters
 /// </summary>
 private void TraceFabricApiStopMonitoringIfEnabled(FabricApiCallDescription description)
 {
     if (description.MonitoringParameters.IsApiLifeCycleTraceEnabled)
     {
         this.apiStopTraceCallback.Invoke(description);
     }
 }
Пример #2
0
 /// <summary>
 /// Add API call to store.
 /// Throw if the FabricApiCallDescription has already been added.
 /// </summary>
 /// <param name="description"></param>
 private void AddApiCallToStore(FabricApiCallDescription description)
 {
     if (!this.store.TryAdd(description, byte.MinValue))
     {
         throw new FabricElementAlreadyExistsException("FabricApiCallDescription already exists");
     }
 }
Пример #3
0
 private void DefaultApiStartTraceCallback(FabricApiCallDescription apiCall)
 {
     FabricEvents.Events.FabricApiStartMonitoring(
         ApiStartTraceType,
         apiCall.MonitoringData.ApiName,
         apiCall.MonitoringData.Partitionid,
         apiCall.MonitoringData.ReplicaId);
 }
Пример #4
0
        /// <summary>
        /// Begin monitoring an API call. If monitoring has not started, timer is set and enabled in StartTimerIfNeeded.
        /// Verify that the FabricMonitoringParameters object has a value greater than zero before calling start monitoring.
        /// Refer to the ValidateSettings method in the ReplicatorApiMonitor for implementation examples.
        /// </summary>
        /// <param name="description"></param>
        public void StartMonitoring(FabricApiCallDescription description)
        {
            // Add new description to store
            this.AddApiCallToStore(description);

            this.StartTimerIfNeeded();

            this.TraceFabricApiStartMonitoringIfEnabled(description);
        }
Пример #5
0
 private void DefaultApiStopTraceCallback(FabricApiCallDescription apiCall)
 {
     FabricEvents.Events.FabricApiStopMonitoring(
         ApiStopTraceType,
         apiCall.MonitoringData.ApiName,
         apiCall.MonitoringData.Partitionid,
         apiCall.MonitoringData.ReplicaId,
         apiCall.MonitoringData.StartTime.Elapsed.TotalMilliseconds);
 }
Пример #6
0
        /// <summary>
        /// End monitoring for an API call.
        /// Invokes the ClearSlowHealthReportCallback provided to remove warning HealthReports in the HM.
        /// If there are no remaining FabricApiCallDescriptions being monitored the timer is closed and wil be reopened by the next StartMonitoring method call.
        /// </summary>
        /// <param name="description"></param>
        public void StopMonitoring(FabricApiCallDescription description)
        {
            byte removedData;

            if (!this.store.TryRemove(description, out removedData))
            {
                return;
            }

            if (description.MonitoringParameters.IsHealthReportEnabled)
            {
                this.componentParameters.ClearSlowHealthReportCallback(description);
            }

            this.TraceFabricApiStopMonitoringIfEnabled(description);

            this.StopTimerIfNeeded();
        }