Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Trivial func and var naming changes (golint)
Browse files Browse the repository at this point in the history
This makes to code at little more idiomatic and fixes:

server_metrics.go:140:6: func streamRpcType should be streamRPCType
server_test.go:97:6: range var testId should be testID
  • Loading branch information
knweiss committed Apr 18, 2018
1 parent 3a0e610 commit b1a7263
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions server_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (m *ServerMetrics) UnaryServerInterceptor() func(ctx context.Context, req i
// StreamServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Streaming RPCs.
func (m *ServerMetrics) StreamServerInterceptor() func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
monitor := newServerReporter(m, streamRpcType(info), info.FullMethod)
monitor := newServerReporter(m, streamRPCType(info), info.FullMethod)
err := handler(srv, &monitoredServerStream{ss, monitor})
st, _ := status.FromError(err)
monitor.Handled(st.Code())
Expand All @@ -137,7 +137,7 @@ func (m *ServerMetrics) InitializeMetrics(server *grpc.Server) {
}
}

func streamRpcType(info *grpc.StreamServerInfo) grpcType {
func streamRPCType(info *grpc.StreamServerInfo) grpcType {
if info.IsClientStream && !info.IsServerStream {
return ClientStream
} else if !info.IsClientStream && info.IsServerStream {
Expand Down
4 changes: 2 additions & 2 deletions server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (s *ServerInterceptorTestSuite) TearDownSuite() {
}

func (s *ServerInterceptorTestSuite) TestRegisterPresetsStuff() {
for testId, testCase := range []struct {
for testID, testCase := range []struct {
metricName string
existingLabels []string
}{
Expand All @@ -110,7 +110,7 @@ func (s *ServerInterceptorTestSuite) TestRegisterPresetsStuff() {
{"grpc_server_handled_total", []string{"mwitkow.testproto.TestService", "PingEmpty", "unary", "ResourceExhausted"}},
} {
lineCount := len(fetchPrometheusLines(s.T(), testCase.metricName, testCase.existingLabels...))
assert.NotEqual(s.T(), 0, lineCount, "metrics must exist for test case %d", testId)
assert.NotEqual(s.T(), 0, lineCount, "metrics must exist for test case %d", testID)
}
}

Expand Down

0 comments on commit b1a7263

Please sign in to comment.