-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
deps: upgrade grpc-ecosystem/go-grpc-middleware to v2 and migrate to grpc-ecosystem/go-grpc-middleware/providers/prometheus #17884
Conversation
upgrades grpc-ecosystem/go-grpc-middleware to v2 migrates grpc-ecosystem/go-grpc-prometheus to grpc-ecosystem/go-grpc-middleware/providers/prometheus Signed-off-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Hi @marefr. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
grpcChainStreamList = append(grpcChainStreamList, | ||
grpc_ctxtags.StreamServerInterceptor(), | ||
grpc_zap.PayloadStreamServerInterceptor(lg, alwaysLoggingDeciderServer), | ||
grpc_logging.StreamServerInterceptor(interceptorLogger(lg), opts...), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the old grpc_ctxtags.StreamServerInterceptor
added a field for peer.address
, https://github.com/grpc-ecosystem/go-grpc-middleware/blob/d42ae9d517069c2bd7f9339147a0eafa86b3d4a3/tags/interceptors.go#L70-L76.
The new logging interceptor adds this field as well, hence why I've removed the old grpc_ctxtags interceptors:
https://github.com/grpc-ecosystem/go-grpc-middleware/blob/7da22cf3f3d3ae190467d9c7a3ea749b3d0e63b5/interceptors/logging/interceptors.go#L168-L170
if e.cfg.Metrics == "extensive" { | ||
grpc_prometheus.EnableHandlingTimeHistogram() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part I struggled the most with. For now I'm passing this config down to v3rpc.Server
as a string argument which doesn't feel great.
if metrics == "extensive" { | ||
promOpts = append(promOpts, grpc_prometheus.WithServerHandlingTimeHistogram()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This moved from server/embed/etcd.go, see the other comment.
@@ -151,3 +153,94 @@ func NewClient(t testing.TB, cfg clientv3.Config) (*clientv3.Client, error) { | |||
} | |||
return clientv3.New(cfg) | |||
} | |||
|
|||
// SettableLoggerV2 is thread-safe. | |||
type SettableLoggerV2 interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect this code to land in some logutil
package. We have one for client client/pkg/logutil
. I expect it's in client due to legacy, we could move it to pkg/logutil
/ok-to-test |
We need to make sure we don't drop or change any non-experimental metrics. Major version upgrades might come with larger changes including changes to metrics. However as user facing application we should still avoid breaking change in metrics if possible. For this kind of PR I expect to see:
|
Thanks @marefr for raising this PR. Is it possible to breakdown this PR into two?
|
@ahrtr yes that sounds like a good plan 👍 |
I'll close this and open a new PR for upgrading grpc-ecosystem/go-grpc-middleware to v2 as a first step. |
Upgrades github.com/grpc-ecosystem/go-grpc-middleware to v2 and migrates the deprecated github.com/grpc-ecosystem/go-grpc-prometheus to github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus.
This is my first contribution to this project and tried to follow the contribution guidelines as good as I could. Please let me know if I missed something and/or suggested changes.
Closes #17883