use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.
the class UdpTransportTest method receiveBufferSizeIsNotLimited.
@Test
public void receiveBufferSizeIsNotLimited() {
final int recvBufferSize = Ints.saturatedCast(Size.megabytes(1L).toBytes());
ImmutableMap<String, Object> source = ImmutableMap.of(NettyTransport.CK_BIND_ADDRESS, BIND_ADDRESS, NettyTransport.CK_PORT, PORT, NettyTransport.CK_RECV_BUFFER_SIZE, recvBufferSize);
Configuration config = new Configuration(source);
UdpTransport udpTransport = new UdpTransport(config, eventLoopGroupFactory, nettyTransportConfiguration, throughputCounter, new LocalMetricRegistry());
assertThat(udpTransport.getBootstrap(mock(MessageInput.class)).config().options().get(ChannelOption.SO_RCVBUF)).isEqualTo(recvBufferSize);
}
use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.
the class UdpTransportTest method launchTransportForBootStrapTest.
private UdpTransport launchTransportForBootStrapTest(final ChannelHandler channelHandler) throws MisfireException {
final UdpTransport transport = new UdpTransport(CONFIGURATION, throughputCounter, new LocalMetricRegistry()) {
@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getBaseChannelHandlers(MessageInput input) {
final LinkedHashMap<String, Callable<? extends ChannelHandler>> handlers = new LinkedHashMap<>();
handlers.put("counter", Callables.returning(channelHandler));
handlers.putAll(super.getFinalChannelHandlers(input));
return handlers;
}
};
final MessageInput messageInput = mock(MessageInput.class);
when(messageInput.getId()).thenReturn("TEST");
when(messageInput.getName()).thenReturn("TEST");
transport.launch(messageInput);
return transport;
}
use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.
the class GrokExtractorTest method makeExtractor.
@SuppressForbidden("Allow using default thread factory")
private GrokExtractor makeExtractor(String pattern, Map<String, Object> config) {
config.put("grok_pattern", pattern);
final ClusterEventBus clusterEventBus = new ClusterEventBus("cluster-event-bus", Executors.newSingleThreadExecutor());
final EventBus clusterBus = new EventBus();
final GrokPatternService grokPatternService = new InMemoryGrokPatternService(clusterEventBus);
try {
grokPatternService.saveAll(patternSet, DROP_ALL_EXISTING);
} catch (Exception e) {
fail("Could not save grok patter: " + e.getMessage());
}
final GrokPatternRegistry grokPatternRegistry = new GrokPatternRegistry(clusterBus, grokPatternService, Executors.newScheduledThreadPool(1));
try {
return new GrokExtractor(new LocalMetricRegistry(), grokPatternRegistry, "id", "title", 0, Extractor.CursorStrategy.COPY, "message", "message", config, "admin", Lists.newArrayList(), Extractor.ConditionType.NONE, null);
} catch (Extractor.ReservedFieldException | ConfigurationException e) {
fail("Test setup is wrong: " + e.getMessage());
throw new RuntimeException(e);
}
}
use of org.graylog2.plugin.LocalMetricRegistry in project graylog2-server by Graylog2.
the class AbstractTcpTransportTest method setUp.
@Before
public void setUp() {
eventLoopGroup = new NioEventLoopGroup();
eventLoopGroupFactory = new EventLoopGroupFactory(nettyTransportConfiguration);
throughputCounter = new ThroughputCounter(eventLoopGroup);
localRegistry = new LocalMetricRegistry();
}
Aggregations