@Test void testMessagesWithoutTags() { EventProcessorLatencyMonitor testSubject = EventProcessorLatencyMonitor.buildMonitor(METER_NAME_PREFIX, meterRegistry); EventMessage<String> firstEventMessage = mock(EventMessage.class); when(firstEventMessage.getTimestamp()).thenReturn(Instant.ofEpochMilli(0)); when(firstEventMessage.getPayloadType()).thenReturn(String.class); EventMessage<Integer> secondEventMessage = mock(EventMessage.class); when(secondEventMessage.getTimestamp()).thenReturn(Instant.ofEpochMilli(1000)); when(secondEventMessage.getPayloadType()).thenReturn(Integer.class); Map<? super EventMessage<?>, MessageMonitor.MonitorCallback> callbacks = testSubject .onMessagesIngested(Arrays.asList(firstEventMessage, secondEventMessage)); callbacks.get(firstEventMessage).reportSuccess(); Gauge latencyGauge = Objects.requireNonNull(meterRegistry.find(METER_NAME_PREFIX + ".latency").gauge()); assertEquals(1000, latencyGauge.value(), 0); }
public static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new EventProcessorLatencyMonitor(meterNamePrefix, meterRegistry); }
EventProcessorLatencyMonitor implements MessageMonitor<EventMessage<?>> { public static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new EventProcessorLatencyMonitor(meterNamePrefix, meterRegistry); } }
EventProcessorLatencyMonitor implements MessageMonitor<EventMessage<?>> { public static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new EventProcessorLatencyMonitor(meterNamePrefix, meterRegistry); } private  EventProcessorLatencyMonitor(String meterNamePrefix, MeterRegistry meterRegistry); private  EventProcessorLatencyMonitor(String meterNamePrefix,
                                         MeterRegistry meterRegistry,
                                         Function<Message<?>, Iterable<Tag>> tagsBuilder); }
EventProcessorLatencyMonitor implements MessageMonitor<EventMessage<?>> { public static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new EventProcessorLatencyMonitor(meterNamePrefix, meterRegistry); } private  EventProcessorLatencyMonitor(String meterNamePrefix, MeterRegistry meterRegistry); private  EventProcessorLatencyMonitor(String meterNamePrefix,
                                         MeterRegistry meterRegistry,
                                         Function<Message<?>, Iterable<Tag>> tagsBuilder); static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry); static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                                            Function<Message<?>, Iterable<Tag>> tagsBuilder); @Override MonitorCallback onMessageIngested(EventMessage<?> message); }
EventProcessorLatencyMonitor implements MessageMonitor<EventMessage<?>> { public static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new EventProcessorLatencyMonitor(meterNamePrefix, meterRegistry); } private  EventProcessorLatencyMonitor(String meterNamePrefix, MeterRegistry meterRegistry); private  EventProcessorLatencyMonitor(String meterNamePrefix,
                                         MeterRegistry meterRegistry,
                                         Function<Message<?>, Iterable<Tag>> tagsBuilder); static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry); static EventProcessorLatencyMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                                            Function<Message<?>, Iterable<Tag>> tagsBuilder); @Override MonitorCallback onMessageIngested(EventMessage<?> message);  }