mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-08 16:06:47 +00:00
Fix issue with provider metrics
https://github.com/openfaas/faas-provider/pull/66 Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
parent
6dbc33d045
commit
9564e64980
4
go.mod
4
go.mod
@ -12,12 +12,11 @@ require (
|
|||||||
github.com/docker/cli v0.0.0-20191105005515-99c5edceb48d
|
github.com/docker/cli v0.0.0-20191105005515-99c5edceb48d
|
||||||
github.com/docker/distribution v2.8.1+incompatible
|
github.com/docker/distribution v2.8.1+incompatible
|
||||||
github.com/docker/docker v17.12.0-ce-rc1.0.20191113042239-ea84732a7725+incompatible // indirect
|
github.com/docker/docker v17.12.0-ce-rc1.0.20191113042239-ea84732a7725+incompatible // indirect
|
||||||
github.com/docker/docker-credential-helpers v0.6.3 // indirect
|
|
||||||
github.com/docker/go-units v0.4.0
|
github.com/docker/go-units v0.4.0
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/morikuni/aec v1.0.0
|
github.com/morikuni/aec v1.0.0
|
||||||
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
|
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
|
||||||
github.com/openfaas/faas-provider v0.19.0
|
github.com/openfaas/faas-provider v0.19.1
|
||||||
github.com/openfaas/faas/gateway v0.0.0-20220509091830-4e868f5f9d81
|
github.com/openfaas/faas/gateway v0.0.0-20220509091830-4e868f5f9d81
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/sethvargo/go-password v0.2.0
|
github.com/sethvargo/go-password v0.2.0
|
||||||
@ -40,6 +39,7 @@ require (
|
|||||||
github.com/containerd/ttrpc v1.1.0 // indirect
|
github.com/containerd/ttrpc v1.1.0 // indirect
|
||||||
github.com/containerd/typeurl v1.0.2 // indirect
|
github.com/containerd/typeurl v1.0.2 // indirect
|
||||||
github.com/containernetworking/cni v1.1.1 // indirect
|
github.com/containernetworking/cni v1.1.1 // indirect
|
||||||
|
github.com/docker/docker-credential-helpers v0.6.3 // indirect
|
||||||
github.com/docker/go-connections v0.4.0 // indirect
|
github.com/docker/go-connections v0.4.0 // indirect
|
||||||
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
|
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
|
||||||
github.com/gogo/googleapis v1.4.0 // indirect
|
github.com/gogo/googleapis v1.4.0 // indirect
|
||||||
|
4
go.sum
4
go.sum
@ -652,8 +652,8 @@ github.com/opencontainers/selinux v1.10.1 h1:09LIPVRP3uuZGQvgR+SgMSNBd1Eb3vlRbGq
|
|||||||
github.com/opencontainers/selinux v1.10.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
|
github.com/opencontainers/selinux v1.10.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
|
||||||
github.com/openfaas/faas-provider v0.18.6/go.mod h1:fq1JL0mX4rNvVVvRLaLRJ3H6o667sHuyP5p/7SZEe98=
|
github.com/openfaas/faas-provider v0.18.6/go.mod h1:fq1JL0mX4rNvVVvRLaLRJ3H6o667sHuyP5p/7SZEe98=
|
||||||
github.com/openfaas/faas-provider v0.18.7/go.mod h1:S217qfIaMrv+XKJxgbhBzJzCfyFvoIF+BvYdDo6XIDQ=
|
github.com/openfaas/faas-provider v0.18.7/go.mod h1:S217qfIaMrv+XKJxgbhBzJzCfyFvoIF+BvYdDo6XIDQ=
|
||||||
github.com/openfaas/faas-provider v0.19.0 h1:1dv4HDkWa9/yVkUll23/06y9lf8+tISOxYoHwBXZaJI=
|
github.com/openfaas/faas-provider v0.19.1 h1:xH8lTWabfDZwzIvC0u1AO48ghD3BNw6Vo231DLqTeI0=
|
||||||
github.com/openfaas/faas-provider v0.19.0/go.mod h1:Farrp+9Med8LeK3aoYpqplMP8f5ebTILbCSLg2LPLZk=
|
github.com/openfaas/faas-provider v0.19.1/go.mod h1:Farrp+9Med8LeK3aoYpqplMP8f5ebTILbCSLg2LPLZk=
|
||||||
github.com/openfaas/faas/gateway v0.0.0-20220509091830-4e868f5f9d81 h1:vWFZEznP2EbynX0uMygpFLAmKwv2uUAdCABnjARr7Wo=
|
github.com/openfaas/faas/gateway v0.0.0-20220509091830-4e868f5f9d81 h1:vWFZEznP2EbynX0uMygpFLAmKwv2uUAdCABnjARr7Wo=
|
||||||
github.com/openfaas/faas/gateway v0.0.0-20220509091830-4e868f5f9d81/go.mod h1:EFFnEVTvUdC9Bulh6rcKIq6e+XwDCG106gVzLKcj/+M=
|
github.com/openfaas/faas/gateway v0.0.0-20220509091830-4e868f5f9d81/go.mod h1:EFFnEVTvUdC9Bulh6rcKIq6e+XwDCG106gVzLKcj/+M=
|
||||||
github.com/openfaas/nats-queue-worker v0.0.0-20210726161954-ada9a31504c9/go.mod h1:ajlN2z+D8JPBq3kWNv4WLT6mtKPqlgeE3dYEx39d1tk=
|
github.com/openfaas/nats-queue-worker v0.0.0-20210726161954-ada9a31504c9/go.mod h1:ajlN2z+D8JPBq3kWNv4WLT6mtKPqlgeE3dYEx39d1tk=
|
||||||
|
11
vendor/github.com/openfaas/faas-provider/httputil/write_interceptor.go
generated
vendored
11
vendor/github.com/openfaas/faas-provider/httputil/write_interceptor.go
generated
vendored
@ -12,14 +12,14 @@ func NewHttpWriteInterceptor(w http.ResponseWriter) *HttpWriteInterceptor {
|
|||||||
|
|
||||||
type HttpWriteInterceptor struct {
|
type HttpWriteInterceptor struct {
|
||||||
http.ResponseWriter
|
http.ResponseWriter
|
||||||
StatusCode int
|
statusCode int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HttpWriteInterceptor) Status() int {
|
func (c *HttpWriteInterceptor) Status() int {
|
||||||
if c.StatusCode == 0 {
|
if c.statusCode == 0 {
|
||||||
return http.StatusOK
|
return http.StatusOK
|
||||||
}
|
}
|
||||||
return c.StatusCode
|
return c.statusCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HttpWriteInterceptor) Header() http.Header {
|
func (c *HttpWriteInterceptor) Header() http.Header {
|
||||||
@ -27,11 +27,14 @@ func (c *HttpWriteInterceptor) Header() http.Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *HttpWriteInterceptor) Write(data []byte) (int, error) {
|
func (c *HttpWriteInterceptor) Write(data []byte) (int, error) {
|
||||||
|
if c.statusCode == 0 {
|
||||||
|
c.WriteHeader(http.StatusOK)
|
||||||
|
}
|
||||||
return c.ResponseWriter.Write(data)
|
return c.ResponseWriter.Write(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HttpWriteInterceptor) WriteHeader(code int) {
|
func (c *HttpWriteInterceptor) WriteHeader(code int) {
|
||||||
c.StatusCode = code
|
c.statusCode = code
|
||||||
c.ResponseWriter.WriteHeader(code)
|
c.ResponseWriter.WriteHeader(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
vendor/github.com/openfaas/faas-provider/metrics.go
generated
vendored
4
vendor/github.com/openfaas/faas-provider/metrics.go
generated
vendored
@ -53,7 +53,7 @@ func (hm *httpMetrics) InstrumentHandler(next http.Handler, pathOverride string)
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
hm.RequestsTotal.With(
|
hm.RequestsTotal.With(
|
||||||
prometheus.Labels{"code": strconv.Itoa(ww.StatusCode),
|
prometheus.Labels{"code": strconv.Itoa(ww.Status()),
|
||||||
"method": r.Method,
|
"method": r.Method,
|
||||||
"path": path,
|
"path": path,
|
||||||
}).
|
}).
|
||||||
@ -62,7 +62,7 @@ func (hm *httpMetrics) InstrumentHandler(next http.Handler, pathOverride string)
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
hm.RequestDurationHistogram.With(
|
hm.RequestDurationHistogram.With(
|
||||||
prometheus.Labels{"code": strconv.Itoa(ww.StatusCode),
|
prometheus.Labels{"code": strconv.Itoa(ww.Status()),
|
||||||
"method": r.Method,
|
"method": r.Method,
|
||||||
"path": path,
|
"path": path,
|
||||||
}).
|
}).
|
||||||
|
2
vendor/modules.txt
generated
vendored
2
vendor/modules.txt
generated
vendored
@ -255,7 +255,7 @@ github.com/opencontainers/selinux/go-selinux
|
|||||||
github.com/opencontainers/selinux/go-selinux/label
|
github.com/opencontainers/selinux/go-selinux/label
|
||||||
github.com/opencontainers/selinux/pkg/pwalk
|
github.com/opencontainers/selinux/pkg/pwalk
|
||||||
github.com/opencontainers/selinux/pkg/pwalkdir
|
github.com/opencontainers/selinux/pkg/pwalkdir
|
||||||
# github.com/openfaas/faas-provider v0.19.0
|
# github.com/openfaas/faas-provider v0.19.1
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/openfaas/faas-provider
|
github.com/openfaas/faas-provider
|
||||||
github.com/openfaas/faas-provider/auth
|
github.com/openfaas/faas-provider/auth
|
||||||
|
Loading…
x
Reference in New Issue
Block a user