MicrometerRSocket implements RSocket { @Override public Mono<Void> fireAndForget(Payload payload) { return delegate.fireAndForget(payload).doFinally(requestFireAndForget); } MicrometerRSocket(RSocket delegate, MeterRegistry meterRegistry, Tag... tags); @Override void dispose(); @Override Mono<Void> fireAndForget(Payload payload); @Override Mono<Void> metadataPush(Payload payload); @Override Mono<Void> onClose(); @Override Flux<Payload> requestChannel(Publisher<Payload> payloads); @Override Mono<Payload> requestResponse(Payload payload); @Override Flux<Payload> requestStream(Payload payload);  }
@DisplayName("fireAndForget gathers metrics") @Test void fireAndForget() { Payload payload = DefaultPayload.create("test-metadata", "test-data"); when(delegate.fireAndForget(payload)).thenReturn(Mono.empty()); new MicrometerRSocket(delegate, meterRegistry, Tag.of("test-key", "test-value")) .fireAndForget(payload) .as(StepVerifier::create) .verifyComplete(); assertThat(findCounter("request.fnf", SignalType.ON_COMPLETE).count()).isEqualTo(1); }