Export gRPC client and server metrics #6

Merged
fyrchik merged 1 commit from acid-ant/frostfs-observability:feature/4-export-grpc-metrics into master 2023-10-19 15:39:51 +00:00
Member

Close #4

Description for gRPC metrics copied from open repositories, but this code licensed under Apache 2.0.
@fyrchik, @realloc could this be an obstacle for us?

Links to sources:
https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/providers/prometheus/server_metrics.go
https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/providers/prometheus/client_metrics.go

Signed-off-by: Anton Nikiforov an.nikiforov@yadro.com

Close #4 Description for gRPC metrics copied from open repositories, but this code licensed under Apache 2.0. @fyrchik, @realloc could this be an obstacle for us? Links to sources: https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/providers/prometheus/server_metrics.go https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/providers/prometheus/client_metrics.go Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
acid-ant requested review from storage-core-committers 2023-10-17 16:00:01 +00:00
acid-ant requested review from storage-core-developers 2023-10-17 16:00:01 +00:00
fyrchik reviewed 2023-10-19 06:43:35 +00:00
@ -21,0 +58,4 @@
VariableLabels: []string{"grpc_type", "grpc_service", "grpc_method"},
},
}
metrics.MustRegister(clientMetrics, descs...)
Owner

Why export MustRegister instead of using our New* wrappers? Not saying this is a bad thing.

Why export `MustRegister` instead of using our `New*` wrappers? Not saying this is a bad thing.
Author
Member

Because all methods in grpcprom.ServerMetrics are private, there are no possibility to initialize them.

Because all methods in `grpcprom.ServerMetrics` are private, there are no possibility to initialize them.
fyrchik marked this conversation as resolved
@ -8,3 +9,3 @@
)
var serverMetrics *grpcprom.ServerMetrics = grpcprom.NewServerMetrics(
var serverMetrics = grpcprom.NewServerMetrics(
Owner

How is it different from what was before? We register metric descriptions, but the implementation is still in the imported package?

How is it different from what was before? We register metric descriptions, but the implementation is still in the imported package?
Author
Member

Didn't catch your question. You propose to create our own metrics instead of predefined?

Didn't catch your question. You propose to create our own metrics instead of predefined?
Owner

Yes, but ok, let's do it in a separate task. It is not ideal currently -- definitions are decoupled from the actual metrics, so it is easy to miss something.

Yes, but ok, let's do it in a separate task. It is not ideal currently -- definitions are decoupled from the actual metrics, so it is easy to miss something.
@ -16,2 +17,3 @@
func init() {
metrics.Register(serverMetrics)
// Description copied from grpc-ecosystem:
// https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/providers/prometheus/server_metrics.go
Owner

Can we use a permalink here (replace main with a tag)?

Can we use a permalink here (replace `main` with a tag)?
Author
Member

Updated.

Updated.
fyrchik marked this conversation as resolved
acid-ant force-pushed feature/4-export-grpc-metrics from 607c7db018 to 6349e91b1b 2023-10-19 07:47:57 +00:00 Compare
dstepanov-yadro approved these changes 2023-10-19 07:49:46 +00:00
acid-ant force-pushed feature/4-export-grpc-metrics from 6349e91b1b to 7960099809 2023-10-19 07:51:36 +00:00 Compare
aarifullin approved these changes 2023-10-19 08:58:17 +00:00
fyrchik merged commit 7960099809 into master 2023-10-19 15:39:51 +00:00
Sign in to join this conversation.
No description provided.