mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-12 00:27:35 +02:00
Appease golint gods
This commit is contained in:
parent
6b9f0d3f57
commit
353b4feaf6
5 changed files with 22 additions and 5 deletions
|
@ -23,6 +23,7 @@ var (
|
|||
grpcClientResponseSize = stats.Int64("grpc_client_response_size_bytes", "grpc Client Response Size in bytes", "bytes")
|
||||
grpcClientRequestDuration = stats.Int64("grpc_client_request_duration_ms", "grpc Client Request duration in ms", "ms")
|
||||
|
||||
// GRPCServerRequestCountView is an OpenCensus view which tracks GRPC Server requests by pomerium service, host, grpc service, grpc method, and status
|
||||
GRPCServerRequestCountView = &view.View{
|
||||
Name: grpcServerRequestCount.Name(),
|
||||
Measure: grpcServerRequestCount,
|
||||
|
@ -31,6 +32,7 @@ var (
|
|||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
// GRPCServerRequestDurationView is an OpenCensus view which tracks GRPC Server request duration by pomerium service, host, grpc service, grpc method, and statu
|
||||
GRPCServerRequestDurationView = &view.View{
|
||||
Name: grpcServerRequestDuration.Name(),
|
||||
Measure: grpcServerRequestDuration,
|
||||
|
@ -45,6 +47,7 @@ var (
|
|||
),
|
||||
}
|
||||
|
||||
// GRPCServerResponseSizeView is an OpenCensus view which tracks GRPC Server request duration by pomerium service, host, grpc service, grpc method, and statu
|
||||
GRPCServerResponseSizeView = &view.View{
|
||||
Name: grpcServerResponseSize.Name(),
|
||||
Measure: grpcServerResponseSize,
|
||||
|
@ -56,6 +59,7 @@ var (
|
|||
),
|
||||
}
|
||||
|
||||
// GRPCClientRequestCountView is an OpenCensus view which tracks GRPC Client requests by pomerium service, target host, grpc service, grpc method, and statu
|
||||
GRPCClientRequestCountView = &view.View{
|
||||
Name: grpcClientRequestCount.Name(),
|
||||
Measure: grpcClientRequestCount,
|
||||
|
@ -63,6 +67,8 @@ var (
|
|||
TagKeys: []tag.Key{keyService, keyHost, keyMethod, keyStatus, keyGRPCService},
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
// GRPCClientRequestDurationView is an OpenCensus view which tracks GRPC Client request duration by pomerium service, target host, grpc service, grpc method, and statu
|
||||
GRPCClientRequestDurationView = &view.View{
|
||||
Name: grpcClientRequestDuration.Name(),
|
||||
Measure: grpcClientRequestDuration,
|
||||
|
@ -76,6 +82,8 @@ var (
|
|||
100000,
|
||||
),
|
||||
}
|
||||
|
||||
// GRPCClientResponseSizeView is an OpenCensus view which tracks GRPC Client response size by pomerium service, target host, grpc service, grpc method, and statu
|
||||
GRPCClientResponseSizeView = &view.View{
|
||||
Name: grpcClientResponseSize.Name(),
|
||||
Measure: grpcClientResponseSize,
|
||||
|
|
|
@ -24,6 +24,7 @@ var (
|
|||
httpClientResponseSize = stats.Int64("http_client_response_size_bytes", "HTTP Client Response Size in bytes", "bytes")
|
||||
httpClientRequestDuration = stats.Int64("http_client_request_duration_ms", "HTTP Client Request duration in ms", "ms")
|
||||
|
||||
// HTTPServerRequestCountView is an OpenCensus View that tracks HTTP server requests by pomerium service, host, method and status
|
||||
HTTPServerRequestCountView = &view.View{
|
||||
Name: httpServerRequestCount.Name(),
|
||||
Measure: httpServerRequestCount,
|
||||
|
@ -32,6 +33,7 @@ var (
|
|||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
// HTTPServerRequestDurationView is an OpenCensus view that tracks HTTP server request duration by pomerium service, host, method and status
|
||||
HTTPServerRequestDurationView = &view.View{
|
||||
Name: httpServerRequestDuration.Name(),
|
||||
Measure: httpServerRequestDuration,
|
||||
|
@ -45,6 +47,8 @@ var (
|
|||
100000,
|
||||
),
|
||||
}
|
||||
|
||||
// HTTPServerRequestSizeView is an OpenCensus view that tracks HTTP server request duration by pomerium service, host, method and status
|
||||
HTTPServerRequestSizeView = &view.View{
|
||||
Name: httpServerResponseSize.Name(),
|
||||
Measure: httpServerResponseSize,
|
||||
|
@ -56,6 +60,7 @@ var (
|
|||
),
|
||||
}
|
||||
|
||||
// HTTPClientRequestCountView is an OpenCensus View that tracks HTTP client requests by pomerium service, host, method and status
|
||||
HTTPClientRequestCountView = &view.View{
|
||||
Name: httpClientRequestCount.Name(),
|
||||
Measure: httpClientRequestCount,
|
||||
|
@ -63,6 +68,8 @@ var (
|
|||
TagKeys: []tag.Key{keyService, keyHost, keyMethod, keyStatus},
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
// HTTPClientRequestDurationView is an OpenCensus view that tracks HTTP client request duration by pomerium service, host, method and status
|
||||
HTTPClientRequestDurationView = &view.View{
|
||||
Name: httpClientRequestDuration.Name(),
|
||||
Measure: httpClientRequestDuration,
|
||||
|
@ -76,7 +83,9 @@ var (
|
|||
100000,
|
||||
),
|
||||
}
|
||||
HTTPClientRequestSizeView = &view.View{
|
||||
|
||||
// HTTPClientResponseSizeView is an OpenCensus view that tracks HTTP client response size by pomerium service, host, method and status
|
||||
HTTPClientResponseSizeView = &view.View{
|
||||
Name: httpClientResponseSize.Name(),
|
||||
Measure: httpClientResponseSize,
|
||||
Description: httpClientResponseSize.Description(),
|
||||
|
|
|
@ -143,8 +143,8 @@ func Test_HTTPMetricsRoundTripper(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
view.Unregister(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientRequestSizeView)
|
||||
view.Register(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientRequestSizeView)
|
||||
view.Unregister(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientResponseSizeView)
|
||||
view.Register(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientResponseSizeView)
|
||||
|
||||
req, _ := http.NewRequest(tt.verb, tt.url, new(bytes.Buffer))
|
||||
resp, err := client.Do(req)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
// RegisterHTTPClientView registers the standard HTTPClient view.
|
||||
// It must be called to see metrics in the configured exporters
|
||||
func RegisterHTTPClientView() {
|
||||
if err := view.Register(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientRequestSizeView); err != nil {
|
||||
if err := view.Register(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientResponseSizeView); err != nil {
|
||||
log.Warn().Err(err).Msg("Could not register HTTPClientView")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
func Test_RegisterHTTPClientView(t *testing.T) {
|
||||
RegisterHTTPClientView()
|
||||
for _, v := range []*view.View{HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientRequestSizeView} {
|
||||
for _, v := range []*view.View{HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientResponseSizeView} {
|
||||
if view.Find(v.Name) != v {
|
||||
t.Errorf("Failed to find registered view %s", v.Name)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue