Search in sources :

Example 1 with LocalMetricRegistry

use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.

the class StateTest method testMetricName.

@Test
public void testMetricName() {
    final PipelineInterpreter.State state = new PipelineInterpreter.State(null, null, null, new LocalMetricRegistry(), 1, false);
    assertEquals("org.graylog.plugins.pipelineprocessor.processors.PipelineInterpreter.stage-cache", state.getStageCacheMetricName());
}
Also used : LocalMetricRegistry(org.graylog2.plugin.LocalMetricRegistry) Test(org.junit.Test)

Example 2 with LocalMetricRegistry

use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.

the class NetFlowUdpTransportTest method setUp.

@Before
public void setUp() {
    final NettyTransportConfiguration nettyTransportConfiguration = new NettyTransportConfiguration("nio", "jdk", 1);
    eventLoopGroupFactory = new EventLoopGroupFactory(nettyTransportConfiguration);
    eventLoopGroup = new NioEventLoopGroup(1);
    transport = new NetFlowUdpTransport(Configuration.EMPTY_CONFIGURATION, eventLoopGroupFactory, nettyTransportConfiguration, new ThroughputCounter(eventLoopGroup), new LocalMetricRegistry());
    transport.setMessageAggregator(new NetflowV9CodecAggregator());
}
Also used : ThroughputCounter(org.graylog2.plugin.inputs.util.ThroughputCounter) NetflowV9CodecAggregator(org.graylog.plugins.netflow.codecs.NetflowV9CodecAggregator) EventLoopGroupFactory(org.graylog2.inputs.transports.netty.EventLoopGroupFactory) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) NettyTransportConfiguration(org.graylog2.inputs.transports.NettyTransportConfiguration) LocalMetricRegistry(org.graylog2.plugin.LocalMetricRegistry) Before(org.junit.Before)

Example 3 with LocalMetricRegistry

use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.

the class BeatsTransportTest method customChildChannelHandlersContainBeatsHandler.

@Test
public void customChildChannelHandlersContainBeatsHandler() {
    final NettyTransportConfiguration nettyTransportConfiguration = new NettyTransportConfiguration("nio", "jdk", 1);
    final EventLoopGroupFactory eventLoopGroupFactory = new EventLoopGroupFactory(nettyTransportConfiguration);
    final BeatsTransport transport = new BeatsTransport(Configuration.EMPTY_CONFIGURATION, eventLoopGroup, eventLoopGroupFactory, nettyTransportConfiguration, new ThroughputCounter(eventLoopGroup), new LocalMetricRegistry(), tlsConfiguration);
    final MessageInput input = mock(MessageInput.class);
    assertThat(transport.getCustomChildChannelHandlers(input)).containsKey("beats");
}
Also used : ThroughputCounter(org.graylog2.plugin.inputs.util.ThroughputCounter) MessageInput(org.graylog2.plugin.inputs.MessageInput) EventLoopGroupFactory(org.graylog2.inputs.transports.netty.EventLoopGroupFactory) NettyTransportConfiguration(org.graylog2.inputs.transports.NettyTransportConfiguration) LocalMetricRegistry(org.graylog2.plugin.LocalMetricRegistry) Test(org.junit.Test)

Example 4 with LocalMetricRegistry

use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.

the class UdpTransportTest method setUp.

@Before
@SuppressForbidden("Executors#newSingleThreadExecutor() is okay for tests")
public void setUp() throws Exception {
    eventLoopGroupFactory = new EventLoopGroupFactory(nettyTransportConfiguration);
    localMetricRegistry = new LocalMetricRegistry();
    eventLoopGroup = eventLoopGroupFactory.create(1, localMetricRegistry, "test");
    throughputCounter = new ThroughputCounter(eventLoopGroup);
    udpTransport = new UdpTransport(CONFIGURATION, eventLoopGroupFactory, nettyTransportConfiguration, throughputCounter, localMetricRegistry);
}
Also used : ThroughputCounter(org.graylog2.plugin.inputs.util.ThroughputCounter) EventLoopGroupFactory(org.graylog2.inputs.transports.netty.EventLoopGroupFactory) LocalMetricRegistry(org.graylog2.plugin.LocalMetricRegistry) Before(org.junit.Before) SuppressForbidden(org.graylog2.shared.SuppressForbidden)

Example 5 with LocalMetricRegistry

use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.

the class UdpTransportTest method launchTransportForBootStrapTest.

private UdpTransport launchTransportForBootStrapTest(final ChannelInboundHandler channelHandler) throws MisfireException {
    final UdpTransport transport = new UdpTransport(CONFIGURATION, eventLoopGroupFactory, nettyTransportConfiguration, throughputCounter, new LocalMetricRegistry()) {

        @Override
        protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getChannelHandlers(MessageInput input) {
            final LinkedHashMap<String, Callable<? extends ChannelHandler>> handlers = new LinkedHashMap<>();
            handlers.put("logging", () -> new LoggingHandler(LogLevel.INFO));
            handlers.put("counter", () -> channelHandler);
            handlers.putAll(super.getChannelHandlers(input));
            return handlers;
        }
    };
    final MessageInput messageInput = mock(MessageInput.class);
    when(messageInput.getId()).thenReturn("TEST");
    when(messageInput.getName()).thenReturn("TEST");
    transport.launch(messageInput);
    return transport;
}
Also used : LoggingHandler(io.netty.handler.logging.LoggingHandler) MessageInput(org.graylog2.plugin.inputs.MessageInput) ChannelHandler(io.netty.channel.ChannelHandler) Callable(java.util.concurrent.Callable) LocalMetricRegistry(org.graylog2.plugin.LocalMetricRegistry) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

LocalMetricRegistry (org.graylog2.plugin.LocalMetricRegistry)9 EventLoopGroupFactory (org.graylog2.inputs.transports.netty.EventLoopGroupFactory)4 ThroughputCounter (org.graylog2.plugin.inputs.util.ThroughputCounter)4 MessageInput (org.graylog2.plugin.inputs.MessageInput)3 Before (org.junit.Before)3 Test (org.junit.Test)3 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)2 LinkedHashMap (java.util.LinkedHashMap)2 Callable (java.util.concurrent.Callable)2 NettyTransportConfiguration (org.graylog2.inputs.transports.NettyTransportConfiguration)2 SuppressForbidden (org.graylog2.shared.SuppressForbidden)2 EventBus (com.google.common.eventbus.EventBus)1 ChannelHandler (io.netty.channel.ChannelHandler)1 LoggingHandler (io.netty.handler.logging.LoggingHandler)1 NetflowV9CodecAggregator (org.graylog.plugins.netflow.codecs.NetflowV9CodecAggregator)1 ConfigurationException (org.graylog2.ConfigurationException)1 ClusterEventBus (org.graylog2.events.ClusterEventBus)1 GrokPatternRegistry (org.graylog2.grok.GrokPatternRegistry)1 GrokPatternService (org.graylog2.grok.GrokPatternService)1 InMemoryGrokPatternService (org.graylog2.grok.InMemoryGrokPatternService)1