Break request metrics in apiserver by client.

This commit is contained in:
Filip Grzadkowski
2015-04-22 16:51:08 +02:00
parent fc50201f89
commit 8b755c805b
5 changed files with 24 additions and 11 deletions

View File

@@ -24,6 +24,7 @@ import (
"io"
"io/ioutil"
"net"
"net/http"
"os"
"path"
"reflect"
@@ -491,3 +492,12 @@ func chooseHostInterfaceFromRoute(inFile io.Reader, nw networkInterfacer) (net.I
}
return nil, nil
}
func GetClient(req *http.Request) string {
if userAgent, ok := req.Header["User-Agent"]; ok {
if len(userAgent) > 0 {
return userAgent[0]
}
}
return "unknown"
}