func (r *RollingMeter) ObserveResponse(req request.Request, lastAttempt request.Attempt) { if lastAttempt == nil || lastAttempt.GetEndpoint() != r.endpoint { return } if r.isError(lastAttempt) { r.errors.Inc() } else { r.successes.Inc() } }
func (c *CircuitBreaker) ProcessResponse(r request.Request, a request.Attempt) { // We should not record metrics for the requests intercepted by circuit breaker // otherwise our metrics would be incorrect if c.shouldRecordMetrics(r) { c.metrics.RecordMetrics(a) } // Note that this call is less expensive than it looks -- checkCondition only performs the real check // periodically. Because of that we can afford to call it here on every single response. if c.checkCondition(r) { c.setTripped(a.GetEndpoint()) } }
func (rr *RoundRobin) ObserveResponse(req request.Request, a request.Attempt) { rr.mutex.Lock() defer rr.mutex.Unlock() if a == nil || a.GetEndpoint() == nil { return } we, _ := rr.findEndpointByUrl(a.GetEndpoint().GetUrl()) if we == nil { return } // Update endpoint stats: failure count and request roundtrip we.meter.ObserveResponse(req, a) }