@Override
    public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
            MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {

        /*
         * This is a per call ClientStreamTracer.Factory which creates a new stream tracer for each attempt under the
         * same call. Each call needs a dedicated factory as they share the same method descriptor.
         */
        final MetricsClientStreamTracers.CallAttemptsTracerFactory tracerFactory =
                new MetricsClientStreamTracers.CallAttemptsTracerFactory(
                        new MetricsClientStreamTracers(stopwatchSupplier),
                        method.getFullMethodName(),
                        metricsClientMeters);

        ClientCall<ReqT, RespT> call =
                next.newCall(method, callOptions.withStreamTracerFactory(tracerFactory));

        return new SimpleForwardingClientCall<ReqT, RespT>(call) {
            @Override
            public void start(Listener<RespT> responseListener, Metadata headers) {
                delegate().start(
                        new SimpleForwardingClientCallListener<RespT>(responseListener) {
                            @Override
                            public void onClose(Status status, Metadata trailers) {
                                tracerFactory.callEnded(status);
                                super.onClose(status, trailers);
                            }
                        },
                        headers);
            }
        };
    }
Creates a new gRPC client interceptor that collects metrics into the given
{@link io.micrometer.core.instrument.MeterRegistry}.

@param registry The MeterRegistry to use.
grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/metrics/MetricsClientInterceptor.java