mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: lb-agent: Add Runner Scheduler/Execution Stats (#1107)
LB agent reports lb placer latency. It should also report how long it took for the runner to initiate the call as well as execution time inside the container if the runner has accepted (committed) to the call.
This commit is contained in:
@@ -38,18 +38,18 @@ func newAttemptTracker(ctx context.Context) *attemptTracker {
|
||||
}
|
||||
}
|
||||
|
||||
func (data *attemptTracker) finalizeAttempts(isSuccess bool) {
|
||||
func (data *attemptTracker) finalizeAttempts(isCommited bool) {
|
||||
stats.Record(data.ctx, attemptCountMeasure.M(data.attemptCount))
|
||||
|
||||
// IMPORTANT: here we use (lastAttemptTime - startTime). We want to exclude TryExec
|
||||
// latency *if* TryExec() goes through with success. Placer latency metric only shows
|
||||
// latency *if* TryExec() goes through with commit. Placer latency metric only shows
|
||||
// how much time are spending in Placer loop/retries. The metric includes rtt/latency of
|
||||
// *all* unsuccessful NACK (retriable) responses from runners as well. For example, if
|
||||
// Placer loop here retries 4 runners (which takes 5 msecs each) and then 5th runner
|
||||
// succeeds (but takes 35 seconds to finish execution), we report 20 msecs as our LB
|
||||
// latency.
|
||||
endTime := data.lastAttemptTime
|
||||
if !isSuccess {
|
||||
if !isCommited {
|
||||
endTime = time.Now()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user