public ServerStreamTracer.Factory getMetricsServerTracerFactory(MeterRegistry registry) {
        return new MetricsServerTracerFactory(registry);
    }
@Test
    void serverBasicMetrics() {
        MetricsServerStreamTracers localServerStreamTracers =
                new MetricsServerStreamTracers(fakeClock.getStopwatchSupplier());
        ServerStreamTracer.Factory tracerFactory =
                localServerStreamTracers.getMetricsServerTracerFactory(meterRegistry);
        ServerStreamTracer tracer = tracerFactory.newServerStreamTracer(method.getFullMethodName(), new Metadata());
        tracer.serverCallStarted(
                new CallInfo<>(method, Attributes.EMPTY, null));

        assertThat(meterRegistry.get(SERVER_CALL_STARTED)
                .tag(GRPC_METHOD_TAG_KEY, FULL_METHOD_NAME)
                .tag(INSTRUMENTATION_SOURCE_TAG_KEY, INSTRUMENTATION_SOURCE_TAG_VALUE)
                .tag(INSTRUMENTATION_VERSION_TAG_KEY, INSTRUMENTATION_VERSION_TAG_VALUE)
                .counter()
                .count()).isEqualTo(1);

        tracer.inboundWireSize(34);

        fakeClock.forwardTime(26, MILLISECONDS);

        tracer.outboundWireSize(1028);

        tracer.inboundWireSize(154);

        tracer.outboundWireSize(99);

        fakeClock.forwardTime(14, MILLISECONDS);

        tracer.streamClosed(Status.CANCELLED);

        HistogramSnapshot sentMessageSizeSnapShot = meterRegistry.get(SERVER_SENT_COMPRESSED_MESSAGE_SIZE)
                .tag(GRPC_METHOD_TAG_KEY, FULL_METHOD_NAME)
                .tag(GRPC_STATUS_TAG_KEY, Status.Code.CANCELLED.toString())
                .tag(INSTRUMENTATION_SOURCE_TAG_KEY, INSTRUMENTATION_SOURCE_TAG_VALUE)
                .tag(INSTRUMENTATION_VERSION_TAG_KEY, INSTRUMENTATION_VERSION_TAG_VALUE)
                .summary()
                .takeSnapshot();
        HistogramSnapshot expectedSentMessageSizeHistogram = HistogramSnapshot.empty(1L, 1127L, 1127L);
        assertThat(sentMessageSizeSnapShot.count()).isEqualTo(expectedSentMessageSizeHistogram.count());
        assertThat(sentMessageSizeSnapShot.total()).isEqualTo(expectedSentMessageSizeHistogram.total());
        assertThat(sentMessageSizeSnapShot.histogramCounts()).contains(new CountAtBucket(2048.0, 1));

        HistogramSnapshot receivedMessageSizeSnapShot =
                meterRegistry.get(SERVER_RECEIVED_COMPRESSED_MESSAGE_SIZE)
                        .tag(GRPC_METHOD_TAG_KEY, FULL_METHOD_NAME)
                        .tag(GRPC_STATUS_TAG_KEY, Status.Code.CANCELLED.toString())
                        .tag(INSTRUMENTATION_SOURCE_TAG_KEY, INSTRUMENTATION_SOURCE_TAG_VALUE)
                        .tag(INSTRUMENTATION_VERSION_TAG_KEY, INSTRUMENTATION_VERSION_TAG_VALUE)
                        .summary()
                        .takeSnapshot();
        HistogramSnapshot expectedReceivedMessageSizeHistogram = HistogramSnapshot.empty(1L, 188L, 188L);
        assertThat(receivedMessageSizeSnapShot.count()).isEqualTo(expectedReceivedMessageSizeHistogram.count());
        assertThat(receivedMessageSizeSnapShot.total()).isEqualTo(expectedReceivedMessageSizeHistogram.total());
        assertThat(receivedMessageSizeSnapShot.histogramCounts()).contains(new CountAtBucket(1024.0, 1));
        // TODO(dnvindhya) : Figure out a way to generate normal histogram instead of cumulative histogram
        // with fixed buckets
        /*
         * assertThat(receivedMessageSizeSnapShot.histogramCounts()).contains(new CountAtBucket(1024.0, 1), new
         * CountAtBucket(2048.0, 0));
         */

        HistogramSnapshot callDurationSnapshot = meterRegistry.get(SERVER_CALL_DURATION)
                .tag(GRPC_METHOD_TAG_KEY, FULL_METHOD_NAME)
                .tag(GRPC_STATUS_TAG_KEY, Status.Code.CANCELLED.toString())
                .tag(INSTRUMENTATION_SOURCE_TAG_KEY, INSTRUMENTATION_SOURCE_TAG_VALUE)
                .tag(INSTRUMENTATION_VERSION_TAG_KEY, INSTRUMENTATION_VERSION_TAG_VALUE)
                .timer()
                .takeSnapshot();
        HistogramSnapshot expectedCallDurationHistogram = HistogramSnapshot.empty(1L, 40L, 40);
        assertThat(callDurationSnapshot.count()).isEqualTo(expectedCallDurationHistogram.count());
        assertThat(callDurationSnapshot.total(MILLISECONDS)).isEqualTo(expectedCallDurationHistogram.total());
        assertThat(callDurationSnapshot.histogramCounts()).contains(new CountAtBucket(4.0E7, 1));
    }