private void LogHC <T>(IHystrixInvokable command, T response) { if (command is IHystrixInvokableInfo commandInfo) { var metrics = commandInfo.Metrics; Console.WriteLine("cb/error-count/%/total: " + commandInfo.IsCircuitBreakerOpen + " " + metrics.Healthcounts.ErrorCount + " " + metrics.Healthcounts.ErrorPercentage + " " + metrics.Healthcounts.TotalRequests + " => " + response + " " + commandInfo.ExecutionEvents); } }
public override T OnEmit <T>(IHystrixInvokable command, T response) { LogHC(command, response); return(base.OnEmit(command, response)); }
public virtual void OnFallbackSuccess(IHystrixInvokable commandInstance) { // do nothing by default }
public virtual void OnCacheHit(IHystrixInvokable commandInstance) { // do nothing by default }
public virtual T OnFallbackEmit <T>(IHystrixInvokable commandInstance, T value) { return(value); // by default, just pass through }
public virtual Exception OnFallbackError(IHystrixInvokable commandInstance, Exception e) { // by default, just pass through return(e); }
public virtual Exception OnExecutionError(IHystrixInvokable commandInstance, Exception e) { return(e); // by default, just pass through }
public virtual void OnExecutionSuccess(IHystrixInvokable commandInstance) { // do nothing by default }
public override void OnSuccess(IHystrixInvokable commandInstance) { CommandEmissions.Add(Notification.CreateOnCompleted <object>()); RecordHookCall(ExecutionSequence, "onSuccess"); base.OnSuccess(commandInstance); }
public virtual void OnThreadComplete(IHystrixInvokable commandInstance) { // do nothing by default }
public override Exception OnError(IHystrixInvokable commandInstance, FailureType failureType, Exception e) { CommandEmissions.Add(Notification.CreateOnError <object>(e)); RecordHookCall(ExecutionSequence, "onError"); return(base.OnError(commandInstance, failureType, e)); }
public override T OnEmit <T>(IHystrixInvokable commandInstance, T value) { CommandEmissions.Add(Notification.CreateOnNext <object>(value)); RecordHookCall(ExecutionSequence, "onEmit"); return(base.OnEmit(commandInstance, value)); }
public override void OnStart(IHystrixInvokable commandInstance) { base.OnStart(commandInstance); RecordHookCall(ExecutionSequence, "onStart"); }
public override void OnThreadComplete(IHystrixInvokable commandInstance) { base.OnThreadComplete(commandInstance); RecordHookCall(ExecutionSequence, "onThreadComplete"); }
public override Exception OnFallbackError(IHystrixInvokable commandInstance, Exception e) { fallbackEmissions.Add(Notification.CreateOnError <object>(e)); RecordHookCall(executionSequence, "onFallbackError"); return(base.OnFallbackError(commandInstance, e)); }