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 namespace in grpc prometheus counter and histogram metrics #718

Merged
merged 2 commits into from
May 28, 2024

Conversation

hyungi
Copy link
Contributor

@hyungi hyungi commented May 28, 2024

Changes

Introduction of apis: WithNamespace() and WithHistogramNamespace()

Verification

Test cases are newly added in client side and server side.

$ cd providers/prometheus
$ go test -v -race ./...
=== RUN   TestClientInterceptorSuite
=== RUN   TestClientInterceptorSuite/TestStartedStreamingIncrementsStarted
=== RUN   TestClientInterceptorSuite/TestStreamingIncrementsMetrics
=== RUN   TestClientInterceptorSuite/TestUnaryIncrementsMetrics
=== RUN   TestClientInterceptorSuite/TestWithNamespace
=== RUN   TestClientInterceptorSuite/TestWithSubsystem
=== NAME  TestClientInterceptorSuite
    interceptor_suite.go:155: stopped grpc.Server at: 127.0.0.1:46203
--- PASS: TestClientInterceptorSuite (0.31s)
    --- PASS: TestClientInterceptorSuite/TestStartedStreamingIncrementsStarted (0.00s)
    --- PASS: TestClientInterceptorSuite/TestStreamingIncrementsMetrics (0.00s)
    --- PASS: TestClientInterceptorSuite/TestUnaryIncrementsMetrics (0.00s)
    --- PASS: TestClientInterceptorSuite/TestWithNamespace (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:155: stopped grpc.Server at: 127.0.0.1:36147
--- PASS: TestServerInterceptorSuite (0.66s)
    --- PASS: TestServerInterceptorSuite/TestContextCancelledTreatedAsStatus (0.10s)
    --- PASS: TestServerInterceptorSuite/TestRegisterPresetsStuff (0.02s)
    --- PASS: TestServerInterceptorSuite/TestStartedStreamingIncrementsStarted (0.20s)
    --- PASS: TestServerInterceptorSuite/TestStreamingIncrementsMetrics (0.10s)
    --- PASS: TestServerInterceptorSuite/TestUnaryIncrementsMetrics (0.00s)
    --- PASS: TestServerInterceptorSuite/TestWithSubsystem (0.00s)
PASS
ok      github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus       1.982s

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.

Seems like a reasonable parallel to WithSubsystem to me, thanks!

providers/prometheus/options.go Outdated Show resolved Hide resolved
Co-authored-by: Johan Brandhorst-Satzkorn <[email protected]>
@hyungi
Copy link
Contributor Author

hyungi commented May 28, 2024

I've updated comment as you mentioned. Thanks @johanbrandhorst :-)

@johanbrandhorst johanbrandhorst merged commit 62b7de5 into grpc-ecosystem:main May 28, 2024
5 checks passed
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