Skip to content

Commit 7865e9f

Browse files
Merge pull request #23 from savitaashture/circuiteChanges
Added changes to take the circuite status from hystrix
2 parents 433cb7c + 7891de9 commit 7865e9f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

monitorData.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/ServiceComb/go-chassis/core/lager"
13+
"github.com/ServiceComb/go-chassis/third_party/forked/afex/hystrix-go/hystrix"
1314
"github.com/rcrowley/go-metrics"
1415
)
1516

@@ -91,8 +92,11 @@ func (monitorData *MonitorData) appendInterfaceInfo(name string, i interface{})
9192
interfaceInfo.successCount = metric.Count()
9293
}
9394

94-
if interfaceInfo.ShortCircuited != 0 {
95+
cb, _, _ := hystrix.GetCircuit(getInterfaceName(name))
96+
if cb.IsOpen() {
9597
interfaceInfo.IsCircuitBreakerOpen = true
98+
} else {
99+
interfaceInfo.IsCircuitBreakerOpen = false
96100
}
97101

98102
qps := (float64(interfaceInfo.Total) * (1 - math.Exp(-5.0/60.0/1)))

0 commit comments

Comments
 (0)