@Test void testMessagesWithoutTags() { MockClock testClock = new MockClock(); SimpleMeterRegistry meterRegistry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, testClock); EventMessage<Object> foo = asEventMessage(1); EventMessage<Object> bar = asEventMessage("bar"); EventMessage<Object> baz = asEventMessage("baz"); MessageTimerMonitor testSubject = MessageTimerMonitor.buildMonitor(PROCESSOR_NAME, meterRegistry, testClock); Map<? super Message<?>, MessageMonitor.MonitorCallback> callbacks = testSubject .onMessagesIngested(Arrays.asList(foo, bar, baz)); testClock.addSeconds(1); callbacks.get(foo).reportSuccess(); callbacks.get(bar).reportFailure(null); callbacks.get(baz).reportIgnored(); Timer all = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".allTimer").timer()); Timer successTimer = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".successTimer").timer()); Timer failureTimer = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".failureTimer").timer()); Timer ignoredTimer = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".ignoredTimer").timer()); assertEquals(3, all.totalTime(TimeUnit.SECONDS), 0); assertEquals(1, successTimer.totalTime(TimeUnit.SECONDS), 0); assertEquals(1, failureTimer.totalTime(TimeUnit.SECONDS), 0); assertEquals(1, ignoredTimer.totalTime(TimeUnit.SECONDS), 0); }
public static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return buildMonitor(meterNamePrefix, meterRegistry, Clock.SYSTEM); }
MessageTimerMonitor implements MessageMonitor<Message<?>> { public static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return buildMonitor(meterNamePrefix, meterRegistry, Clock.SYSTEM); } }
MessageTimerMonitor implements MessageMonitor<Message<?>> { public static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return buildMonitor(meterNamePrefix, meterRegistry, Clock.SYSTEM); } private  MessageTimerMonitor(String meterNamePrefix,
                                MeterRegistry meterRegistry,
                                Function<Message<?>, Iterable<Tag>> tagsBuilder,
                                Clock clock); private  MessageTimerMonitor(String meterNamePrefix,
                                MeterRegistry meterRegistry,
                                Clock clock); }
MessageTimerMonitor implements MessageMonitor<Message<?>> { public static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return buildMonitor(meterNamePrefix, meterRegistry, Clock.SYSTEM); } private  MessageTimerMonitor(String meterNamePrefix,
                                MeterRegistry meterRegistry,
                                Function<Message<?>, Iterable<Tag>> tagsBuilder,
                                Clock clock); private  MessageTimerMonitor(String meterNamePrefix,
                                MeterRegistry meterRegistry,
                                Clock clock); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                                   Function<Message<?>, Iterable<Tag>> tagsBuilder); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry, Clock clock); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry, Clock clock,
                                                   Function<Message<?>, Iterable<Tag>> tagsBuilder); @Override MonitorCallback onMessageIngested(Message<?> message); }
MessageTimerMonitor implements MessageMonitor<Message<?>> { public static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return buildMonitor(meterNamePrefix, meterRegistry, Clock.SYSTEM); } private  MessageTimerMonitor(String meterNamePrefix,
                                MeterRegistry meterRegistry,
                                Function<Message<?>, Iterable<Tag>> tagsBuilder,
                                Clock clock); private  MessageTimerMonitor(String meterNamePrefix,
                                MeterRegistry meterRegistry,
                                Clock clock); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                                   Function<Message<?>, Iterable<Tag>> tagsBuilder); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry, Clock clock); static MessageTimerMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry, Clock clock,
                                                   Function<Message<?>, Iterable<Tag>> tagsBuilder); @Override MonitorCallback onMessageIngested(Message<?> message);  }