mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-13 17:17:43 +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")
|
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")
|
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{
|
GRPCServerRequestCountView = &view.View{
|
||||||
Name: grpcServerRequestCount.Name(),
|
Name: grpcServerRequestCount.Name(),
|
||||||
Measure: grpcServerRequestCount,
|
Measure: grpcServerRequestCount,
|
||||||
|
@ -31,6 +32,7 @@ var (
|
||||||
Aggregation: view.Count(),
|
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{
|
GRPCServerRequestDurationView = &view.View{
|
||||||
Name: grpcServerRequestDuration.Name(),
|
Name: grpcServerRequestDuration.Name(),
|
||||||
Measure: grpcServerRequestDuration,
|
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{
|
GRPCServerResponseSizeView = &view.View{
|
||||||
Name: grpcServerResponseSize.Name(),
|
Name: grpcServerResponseSize.Name(),
|
||||||
Measure: grpcServerResponseSize,
|
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{
|
GRPCClientRequestCountView = &view.View{
|
||||||
Name: grpcClientRequestCount.Name(),
|
Name: grpcClientRequestCount.Name(),
|
||||||
Measure: grpcClientRequestCount,
|
Measure: grpcClientRequestCount,
|
||||||
|
@ -63,6 +67,8 @@ var (
|
||||||
TagKeys: []tag.Key{keyService, keyHost, keyMethod, keyStatus, keyGRPCService},
|
TagKeys: []tag.Key{keyService, keyHost, keyMethod, keyStatus, keyGRPCService},
|
||||||
Aggregation: view.Count(),
|
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{
|
GRPCClientRequestDurationView = &view.View{
|
||||||
Name: grpcClientRequestDuration.Name(),
|
Name: grpcClientRequestDuration.Name(),
|
||||||
Measure: grpcClientRequestDuration,
|
Measure: grpcClientRequestDuration,
|
||||||
|
@ -76,6 +82,8 @@ var (
|
||||||
100000,
|
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{
|
GRPCClientResponseSizeView = &view.View{
|
||||||
Name: grpcClientResponseSize.Name(),
|
Name: grpcClientResponseSize.Name(),
|
||||||
Measure: grpcClientResponseSize,
|
Measure: grpcClientResponseSize,
|
||||||
|
|
|
@ -24,6 +24,7 @@ var (
|
||||||
httpClientResponseSize = stats.Int64("http_client_response_size_bytes", "HTTP Client Response Size in bytes", "bytes")
|
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")
|
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{
|
HTTPServerRequestCountView = &view.View{
|
||||||
Name: httpServerRequestCount.Name(),
|
Name: httpServerRequestCount.Name(),
|
||||||
Measure: httpServerRequestCount,
|
Measure: httpServerRequestCount,
|
||||||
|
@ -32,6 +33,7 @@ var (
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPServerRequestDurationView is an OpenCensus view that tracks HTTP server request duration by pomerium service, host, method and status
|
||||||
HTTPServerRequestDurationView = &view.View{
|
HTTPServerRequestDurationView = &view.View{
|
||||||
Name: httpServerRequestDuration.Name(),
|
Name: httpServerRequestDuration.Name(),
|
||||||
Measure: httpServerRequestDuration,
|
Measure: httpServerRequestDuration,
|
||||||
|
@ -45,6 +47,8 @@ var (
|
||||||
100000,
|
100000,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPServerRequestSizeView is an OpenCensus view that tracks HTTP server request duration by pomerium service, host, method and status
|
||||||
HTTPServerRequestSizeView = &view.View{
|
HTTPServerRequestSizeView = &view.View{
|
||||||
Name: httpServerResponseSize.Name(),
|
Name: httpServerResponseSize.Name(),
|
||||||
Measure: httpServerResponseSize,
|
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{
|
HTTPClientRequestCountView = &view.View{
|
||||||
Name: httpClientRequestCount.Name(),
|
Name: httpClientRequestCount.Name(),
|
||||||
Measure: httpClientRequestCount,
|
Measure: httpClientRequestCount,
|
||||||
|
@ -63,6 +68,8 @@ var (
|
||||||
TagKeys: []tag.Key{keyService, keyHost, keyMethod, keyStatus},
|
TagKeys: []tag.Key{keyService, keyHost, keyMethod, keyStatus},
|
||||||
Aggregation: view.Count(),
|
Aggregation: view.Count(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPClientRequestDurationView is an OpenCensus view that tracks HTTP client request duration by pomerium service, host, method and status
|
||||||
HTTPClientRequestDurationView = &view.View{
|
HTTPClientRequestDurationView = &view.View{
|
||||||
Name: httpClientRequestDuration.Name(),
|
Name: httpClientRequestDuration.Name(),
|
||||||
Measure: httpClientRequestDuration,
|
Measure: httpClientRequestDuration,
|
||||||
|
@ -76,7 +83,9 @@ var (
|
||||||
100000,
|
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(),
|
Name: httpClientResponseSize.Name(),
|
||||||
Measure: httpClientResponseSize,
|
Measure: httpClientResponseSize,
|
||||||
Description: httpClientResponseSize.Description(),
|
Description: httpClientResponseSize.Description(),
|
||||||
|
|
|
@ -143,8 +143,8 @@ func Test_HTTPMetricsRoundTripper(t *testing.T) {
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
view.Unregister(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientRequestSizeView)
|
view.Unregister(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientResponseSizeView)
|
||||||
view.Register(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientRequestSizeView)
|
view.Register(HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientResponseSizeView)
|
||||||
|
|
||||||
req, _ := http.NewRequest(tt.verb, tt.url, new(bytes.Buffer))
|
req, _ := http.NewRequest(tt.verb, tt.url, new(bytes.Buffer))
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
// RegisterHTTPClientView registers the standard HTTPClient view.
|
// RegisterHTTPClientView registers the standard HTTPClient view.
|
||||||
// It must be called to see metrics in the configured exporters
|
// It must be called to see metrics in the configured exporters
|
||||||
func RegisterHTTPClientView() {
|
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")
|
log.Warn().Err(err).Msg("Could not register HTTPClientView")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
func Test_RegisterHTTPClientView(t *testing.T) {
|
func Test_RegisterHTTPClientView(t *testing.T) {
|
||||||
RegisterHTTPClientView()
|
RegisterHTTPClientView()
|
||||||
for _, v := range []*view.View{HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientRequestSizeView} {
|
for _, v := range []*view.View{HTTPClientRequestCountView, HTTPClientRequestDurationView, HTTPClientResponseSizeView} {
|
||||||
if view.Find(v.Name) != v {
|
if view.Find(v.Name) != v {
|
||||||
t.Errorf("Failed to find registered view %s", v.Name)
|
t.Errorf("Failed to find registered view %s", v.Name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue