Esempio n. 1
0
 internal void UpdateCounterValue(ActorMethodDiagnosticData methodData)
 {
     if (null != methodData.Exception)
     {
         this.Counter.Increment();
     }
 }
Esempio n. 2
0
 private void OnActorMethodFinish(ActorMethodDiagnosticData methodData)
 {
     if (null == methodData.Exception)
     {
         if (this.writer.IsActorMethodStopEventEnabled())
         {
             var actorId    = methodData.ActorId;
             var methodInfo = this.GetActorMethodInfo(methodData.InterfaceMethodKey, methodData.RemotingListener);
             this.writer.ActorMethodStop(
                 methodData.MethodExecutionTime.Value.Ticks,
                 methodInfo.MethodName,
                 methodInfo.MethodSignature,
                 this.actorType,
                 actorId,
                 this.serviceContext);
         }
     }
     else
     {
         var actorId    = methodData.ActorId;
         var methodInfo = this.GetActorMethodInfo(methodData.InterfaceMethodKey, methodData.RemotingListener);
         this.writer.ActorMethodThrewException(
             methodData.Exception.ToString(),
             methodData.MethodExecutionTime.Value.Ticks,
             methodInfo.MethodName,
             methodInfo.MethodSignature,
             this.actorType,
             actorId,
             this.serviceContext);
     }
 }
Esempio n. 3
0
 internal void UpdateCounterValue(ActorMethodDiagnosticData methodData)
 {
     if (methodData.MethodExecutionTime != null)
     {
         this.Counter.IncrementBy((long)methodData.MethodExecutionTime.Value.TotalMilliseconds);
         this.CounterBase.Increment();
     }
 }
Esempio n. 4
0
 private void OnActorMethodStart(ActorMethodDiagnosticData methodData)
 {
     if (this.writer.IsActorMethodStartEventEnabled())
     {
         var actorId    = methodData.ActorId;
         var methodInfo = this.GetActorMethodInfo(methodData.InterfaceMethodKey, methodData.RemotingListener);
         this.writer.ActorMethodStart(
             methodInfo.MethodName,
             methodInfo.MethodSignature,
             this.actorType,
             actorId,
             this.serviceContext);
     }
 }
Esempio n. 5
0
        private void OnActorMethodFinish(ActorMethodDiagnosticData methodData)
        {
            var interfaceMethodKey = methodData.InterfaceMethodKey;

            var counterWriters = this.GetMethodSpecificCounterWriters(interfaceMethodKey, methodData.RemotingListener);


            // Call the counter writers to update the counter values
            if (null != counterWriters.ActorMethodFrequencyCounterWriter)
            {
                counterWriters.ActorMethodFrequencyCounterWriter.UpdateCounterValue();
            }
            if (null != counterWriters.ActorMethodExceptionFrequencyCounterWriter)
            {
                counterWriters.ActorMethodExceptionFrequencyCounterWriter.UpdateCounterValue(methodData);
            }
            if (null != counterWriters.ActorMethodExecTimeCounterWriter)
            {
                counterWriters.ActorMethodExecTimeCounterWriter.UpdateCounterValue(methodData);
            }
        }
Esempio n. 6
0
        private void OnActorMethodFinish(ActorMethodDiagnosticData methodData)
        {
            long interfaceMethodKey = methodData.InterfaceMethodKey;
            MethodSpecificCounterWriters counterWriters = this.actorMethodCounterInstanceData[interfaceMethodKey].CounterWriters;

            if (!AvaiableFabricCounterSet.TryGetValue(ActorPerformanceCounters.ActorMethodCategoryName, out ActorMethodCounterSet))
            {
                return;
            }

            if (counterWriters == null)
            {
                bool logCounterWriterCreation = false;
                lock (this.actorMethodCounterInstanceData[interfaceMethodKey])
                {
                    if (this.actorMethodCounterInstanceData[interfaceMethodKey].CounterWriters == null)
                    {
                        // We have not yet created the objects that write the counter values. So build
                        // up the list of counter writers now.
                        string instanceName = this.actorMethodCounterInstanceData[interfaceMethodKey].InstanceName;

                        var tempCounterWriters = new MethodSpecificCounterWriters();

                        try
                        {
                            tempCounterWriters.ActorMethodCounterSetInstance =
                                ActorMethodCounterSet.CreateCounterSetInstance(instanceName);
                        }
                        catch (Exception ex)
                        {
                            //Instance creation failed, Be done.
                            AppTrace.TraceSource.WriteWarning(
                                TraceType,
                                "Data for performance counter instance {0} of category {1} will not be provided because an exception occurred during its initialization. Exception info: {2}",
                                instanceName, ActorPerformanceCounters.ActorMethodCategoryName, ex);
                            return;
                        }

                        tempCounterWriters.ActorMethodFrequencyCounterWriter = this.CreateMethodCounterWriter(
                            instanceName,
                            typeof(ActorMethodFrequencyCounterWriter),
                            tempCounterWriters.ActorMethodCounterSetInstance,
                            inst => new ActorMethodFrequencyCounterWriter(inst));
                        tempCounterWriters.ActorMethodExceptionFrequencyCounterWriter = this.CreateMethodCounterWriter(
                            instanceName,
                            typeof(ActorMethodExceptionFrequencyCounterWriter),
                            tempCounterWriters.ActorMethodCounterSetInstance,
                            inst => new ActorMethodExceptionFrequencyCounterWriter(inst));
                        tempCounterWriters.ActorMethodExecTimeCounterWriter = this.CreateMethodCounterWriter(
                            instanceName,
                            typeof(ActorMethodExecTimeCounterWriter),
                            tempCounterWriters.ActorMethodCounterSetInstance,
                            inst => new ActorMethodExecTimeCounterWriter(inst));
                        logCounterWriterCreation = true;

                        this.actorMethodCounterInstanceData[interfaceMethodKey].CounterWriters = tempCounterWriters;
                    }
                }
                counterWriters = this.actorMethodCounterInstanceData[interfaceMethodKey].CounterWriters;

                if (logCounterWriterCreation)
                {
                    object[] newlyCreatedCounterWriters =
                    {
                        counterWriters.ActorMethodFrequencyCounterWriter,
                        counterWriters.ActorMethodExceptionFrequencyCounterWriter,
                        counterWriters.ActorMethodExecTimeCounterWriter
                    };
                    foreach (var newlyCreatedCounterWriter in newlyCreatedCounterWriters)
                    {
                        if (null != newlyCreatedCounterWriter)
                        {
                            this.LogCounterInstanceCreationResult(
                                newlyCreatedCounterWriter.GetType(),
                                this.actorMethodCounterInstanceData[interfaceMethodKey].InstanceName,
                                null);
                        }
                    }
                }
            }

            // Call the counter writers to update the counter values
            if (null != counterWriters.ActorMethodFrequencyCounterWriter)
            {
                counterWriters.ActorMethodFrequencyCounterWriter.UpdateCounterValue();
            }
            if (null != counterWriters.ActorMethodExceptionFrequencyCounterWriter)
            {
                counterWriters.ActorMethodExceptionFrequencyCounterWriter.UpdateCounterValue(methodData);
            }
            if (null != counterWriters.ActorMethodExecTimeCounterWriter)
            {
                counterWriters.ActorMethodExecTimeCounterWriter.UpdateCounterValue(methodData);
            }
        }