Closed DNVindhya closed 5 months ago
The client implementation uses an interceptor to register this tracer. Does the server need that as well?
No, ServerStreamTracer.Factory
cannot be added using ServerInterceptor
. Unlike client, RPC flow for server is started at network i.e network -> stream tracer -> server interceptor. Instead GrpcServerConfigurer
can be used to add ServerStreamTracer.Factory
. For example,
public GrpcServerConfigurer streamTracerFactoryConfigurer(final MeterRegistry registry) {
return builder -> builder.addStreamTracerFactory(
new MetricsServerStreamTracers().getMetricsServerTracerFactory(registry));
}
This PR adds server metrics defined in gRFC A66: OpenTelemetry Metrics to gRPC-Spring. Even though the gRFC mentions OpenTelmetry, to keep it in sync with existing metrics, this PR as well as future ones will use Micrometer for instrumentation.
Instrumentations to collect following server metrics are being introduced :
grpc.server.call.started
grpc.server.call.sent_total_compressed_message_size
grpc.server.call.rcvd_total_compressed_message_size
grpc.server.call.duration
These metrics are not enabled yet. These can be enabled using
GrpcServerConfigurer
.Related PR to add client metric #1021.