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:
Soam Vasani
2019-04-30 15:48:04 -07:00
committed by GitHub
parent 9a3cc517d0
commit 23f3585245
5 changed files with 82 additions and 0 deletions
+5
View File
@@ -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