Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for subsystem in grpc prometheus counter and histogram metrics #639

Closed
wants to merge 2 commits into from

Conversation

rohsaini
Copy link
Contributor

Changes

Introduction of apis: WithSubsystem() and WithHistogramSubsystem()

Verification

Tested locally with this new package of go-grpc-middleware

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests that exercises this option and checks that the output contains the subsystem?

providers/prometheus/options.go Outdated Show resolved Hide resolved
providers/prometheus/options.go Outdated Show resolved Hide resolved
@rohsaini
Copy link
Contributor Author

Can you add some tests that exercises this option and checks that the output contains the subsystem?

added new test cases for client and server metrics both.

cd /home/ubuntu/datadisk/CLONES/go-grpc-middleware-subsystem/providers/prometheus && go test -v -race ./...
=== RUN TestClientInterceptorSuite
=== RUN TestClientInterceptorSuite/TestStartedStreamingIncrementsStarted
=== RUN TestClientInterceptorSuite/TestStreamingIncrementsMetrics
=== RUN TestClientInterceptorSuite/TestUnaryIncrementsMetrics
=== RUN TestClientInterceptorSuite/TestWithSubsystem
=== NAME TestClientInterceptorSuite
interceptor_suite.go:154: stopped grpc.Server at: 127.0.0.1:40133
--- PASS: TestClientInterceptorSuite (0.24s)
--- PASS: TestClientInterceptorSuite/TestStartedStreamingIncrementsStarted (0.00s)
--- PASS: TestClientInterceptorSuite/TestStreamingIncrementsMetrics (0.01s)
--- PASS: TestClientInterceptorSuite/TestUnaryIncrementsMetrics (0.00s)
--- PASS: TestClientInterceptorSuite/TestWithSubsystem (0.00s) <<<<<<<<
=== RUN TestServerInterceptorSuite
=== RUN TestServerInterceptorSuite/TestContextCancelledTreatedAsStatus
=== RUN TestServerInterceptorSuite/TestRegisterPresetsStuff
=== RUN TestServerInterceptorSuite/TestStartedStreamingIncrementsStarted
=== RUN TestServerInterceptorSuite/TestStreamingIncrementsMetrics
=== RUN TestServerInterceptorSuite/TestUnaryIncrementsMetrics
=== RUN TestServerInterceptorSuite/TestWithSubsystem
=== NAME TestServerInterceptorSuite
interceptor_suite.go:154: stopped grpc.Server at: 127.0.0.1:38755
--- PASS: TestServerInterceptorSuite (0.73s)
--- PASS: TestServerInterceptorSuite/TestContextCancelledTreatedAsStatus (0.10s)
--- PASS: TestServerInterceptorSuite/TestRegisterPresetsStuff (0.03s)
--- PASS: TestServerInterceptorSuite/TestStartedStreamingIncrementsStarted (0.20s)
--- PASS: TestServerInterceptorSuite/TestStreamingIncrementsMetrics (0.11s)
--- PASS: TestServerInterceptorSuite/TestUnaryIncrementsMetrics (0.00s)
--- PASS: TestServerInterceptorSuite/TestWithSubsystem (0.00s) <<<<<<<<
PASS
ok github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus 1.006s

@rohsaini
Copy link
Contributor Author

Will raise it again. Closing due to some CLA issues.

@rohsaini rohsaini closed this Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants