Add simple anonymous usage metrics (#1167)
This change reports total function call count to an analytics url once a day. It's done behind the existing analytics flag.
This commit is contained in:
@@ -2,11 +2,14 @@ package router
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
var globalFunctionCallCount uint64
|
||||
|
||||
type (
|
||||
// functionLabels is the set of metrics labels that relate to
|
||||
// functions.
|
||||
@@ -116,6 +119,8 @@ func labelsToStrings(f *functionLabels, h *httpLabels) []string {
|
||||
}
|
||||
|
||||
func functionCallCompleted(f *functionLabels, h *httpLabels, overhead, duration time.Duration, respSize int64) {
|
||||
atomic.AddUint64(&globalFunctionCallCount, 1)
|
||||
|
||||
l := labelsToStrings(f, h)
|
||||
|
||||
// overhead: time from request ingress into router upto proxing into function pod
|
||||
|
||||
Reference in New Issue
Block a user