@Test void createMonitorForUnknownComponentWithTags() { MessageMonitor<? extends Message<?>> actual = subject.registerComponentWithDefaultTags(String.class, "test"); assertSame(NoOpMessageMonitor.instance(), actual); }
public MessageMonitor<? extends Message<?>> registerComponentWithDefaultTags(Class<?> componentType, String componentName) { if (EventProcessor.class.isAssignableFrom(componentType)) { return registerEventProcessor( EVENT_PROCESSOR_METRICS_NAME, message -> Tags.of( PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(), PROCESSOR_NAME_TAG, componentName ) ); } if (CommandBus.class.isAssignableFrom(componentType)) { return registerCommandBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (EventBus.class.isAssignableFrom(componentType)) { return registerEventBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryBus.class.isAssignableFrom(componentType)) { return registerQueryBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryUpdateEmitter.class.isAssignableFrom(componentType)) { return registerQueryUpdateEmitter(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } logger.warn("Cannot provide MessageMonitor for component [{}] of type [{}]. Returning No-Op instance.", componentName, componentType.getSimpleName()); return NoOpMessageMonitor.instance(); }
GlobalMetricRegistry { public MessageMonitor<? extends Message<?>> registerComponentWithDefaultTags(Class<?> componentType, String componentName) { if (EventProcessor.class.isAssignableFrom(componentType)) { return registerEventProcessor( EVENT_PROCESSOR_METRICS_NAME, message -> Tags.of( PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(), PROCESSOR_NAME_TAG, componentName ) ); } if (CommandBus.class.isAssignableFrom(componentType)) { return registerCommandBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (EventBus.class.isAssignableFrom(componentType)) { return registerEventBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryBus.class.isAssignableFrom(componentType)) { return registerQueryBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryUpdateEmitter.class.isAssignableFrom(componentType)) { return registerQueryUpdateEmitter(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } logger.warn("Cannot provide MessageMonitor for component [{}] of type [{}]. Returning No-Op instance.", componentName, componentType.getSimpleName()); return NoOpMessageMonitor.instance(); } }
GlobalMetricRegistry { public MessageMonitor<? extends Message<?>> registerComponentWithDefaultTags(Class<?> componentType, String componentName) { if (EventProcessor.class.isAssignableFrom(componentType)) { return registerEventProcessor( EVENT_PROCESSOR_METRICS_NAME, message -> Tags.of( PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(), PROCESSOR_NAME_TAG, componentName ) ); } if (CommandBus.class.isAssignableFrom(componentType)) { return registerCommandBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (EventBus.class.isAssignableFrom(componentType)) { return registerEventBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryBus.class.isAssignableFrom(componentType)) { return registerQueryBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryUpdateEmitter.class.isAssignableFrom(componentType)) { return registerQueryUpdateEmitter(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } logger.warn("Cannot provide MessageMonitor for component [{}] of type [{}]. Returning No-Op instance.", componentName, componentType.getSimpleName()); return NoOpMessageMonitor.instance(); } GlobalMetricRegistry();  GlobalMetricRegistry(MeterRegistry meterRegistry); }
GlobalMetricRegistry { public MessageMonitor<? extends Message<?>> registerComponentWithDefaultTags(Class<?> componentType, String componentName) { if (EventProcessor.class.isAssignableFrom(componentType)) { return registerEventProcessor( EVENT_PROCESSOR_METRICS_NAME, message -> Tags.of( PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(), PROCESSOR_NAME_TAG, componentName ) ); } if (CommandBus.class.isAssignableFrom(componentType)) { return registerCommandBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (EventBus.class.isAssignableFrom(componentType)) { return registerEventBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryBus.class.isAssignableFrom(componentType)) { return registerQueryBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryUpdateEmitter.class.isAssignableFrom(componentType)) { return registerQueryUpdateEmitter(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } logger.warn("Cannot provide MessageMonitor for component [{}] of type [{}]. Returning No-Op instance.", componentName, componentType.getSimpleName()); return NoOpMessageMonitor.instance(); } GlobalMetricRegistry();  GlobalMetricRegistry(MeterRegistry meterRegistry); @SuppressWarnings("unchecked") Configurer registerWithConfigurer(Configurer configurer); @SuppressWarnings("unchecked") Configurer registerWithConfigurerWithDefaultTags(Configurer configurer); MessageMonitor<? extends Message<?>> registerComponent(Class<?> componentType, String componentName); MessageMonitor<? super EventMessage<?>> registerEventProcessor(String eventProcessorName); MessageMonitor<? super CommandMessage<?>> registerCommandBus(String commandBusName); MessageMonitor<? super EventMessage<?>> registerEventBus(String eventBusName); MessageMonitor<? super QueryMessage<?, ?>> registerQueryBus(String queryBusName); MessageMonitor<? extends Message<?>> registerComponentWithDefaultTags(Class<?> componentType,
                                                                                 String componentName); MessageMonitor<? super EventMessage<?>> registerEventProcessor(String eventProcessorName,
                                                                          Function<Message<?>, Iterable<Tag>> tagsBuilder); MessageMonitor<? super CommandMessage<?>> registerCommandBus(String commandBusName,
                                                                        Function<Message<?>, Iterable<Tag>> tagsBuilder); MessageMonitor<? super EventMessage<?>> registerEventBus(String eventBusName,
                                                                    Function<Message<?>, Iterable<Tag>> tagsBuilder); MessageMonitor<? super QueryMessage<?, ?>> registerQueryBus(String queryBusName,
                                                                       Function<Message<?>, Iterable<Tag>> tagsBuilder); MeterRegistry getRegistry(); }
GlobalMetricRegistry { public MessageMonitor<? extends Message<?>> registerComponentWithDefaultTags(Class<?> componentType, String componentName) { if (EventProcessor.class.isAssignableFrom(componentType)) { return registerEventProcessor( EVENT_PROCESSOR_METRICS_NAME, message -> Tags.of( PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(), PROCESSOR_NAME_TAG, componentName ) ); } if (CommandBus.class.isAssignableFrom(componentType)) { return registerCommandBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (EventBus.class.isAssignableFrom(componentType)) { return registerEventBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryBus.class.isAssignableFrom(componentType)) { return registerQueryBus(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } if (QueryUpdateEmitter.class.isAssignableFrom(componentType)) { return registerQueryUpdateEmitter(componentName, PAYLOAD_TYPE_TAGGER_FUNCTION); } logger.warn("Cannot provide MessageMonitor for component [{}] of type [{}]. Returning No-Op instance.", componentName, componentType.getSimpleName()); return NoOpMessageMonitor.instance(); } GlobalMetricRegistry();  GlobalMetricRegistry(MeterRegistry meterRegistry); @SuppressWarnings("unchecked") Configurer registerWithConfigurer(Configurer configurer); @SuppressWarnings("unchecked") Configurer registerWithConfigurerWithDefaultTags(Configurer configurer); MessageMonitor<? extends Message<?>> registerComponent(Class<?> componentType, String componentName); MessageMonitor<? super EventMessage<?>> registerEventProcessor(String eventProcessorName); MessageMonitor<? super CommandMessage<?>> registerCommandBus(String commandBusName); MessageMonitor<? super EventMessage<?>> registerEventBus(String eventBusName); MessageMonitor<? super QueryMessage<?, ?>> registerQueryBus(String queryBusName); MessageMonitor<? extends Message<?>> registerComponentWithDefaultTags(Class<?> componentType,
                                                                                 String componentName); MessageMonitor<? super EventMessage<?>> registerEventProcessor(String eventProcessorName,
                                                                          Function<Message<?>, Iterable<Tag>> tagsBuilder); MessageMonitor<? super CommandMessage<?>> registerCommandBus(String commandBusName,
                                                                        Function<Message<?>, Iterable<Tag>> tagsBuilder); MessageMonitor<? super EventMessage<?>> registerEventBus(String eventBusName,
                                                                    Function<Message<?>, Iterable<Tag>> tagsBuilder); MessageMonitor<? super QueryMessage<?, ?>> registerQueryBus(String queryBusName,
                                                                       Function<Message<?>, Iterable<Tag>> tagsBuilder); MeterRegistry getRegistry();  }