Search in sources :

Example 1 with Configuration

use of kieker.common.configuration.Configuration in project iobserve-analysis by research-iobserve.

the class TcpProbeController method createNewTcpWriter.

private SingleSocketTcpWriter createNewTcpWriter(final String hostname, final int port) throws RemoteControlFailedException {
    final Configuration configuration = new Configuration();
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_HOSTNAME, hostname);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_PORT, port);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_CONN_TIMEOUT_IN_MS, TcpProbeController.CONN_TIMEOUT_IN_MS);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_FLUSH, true);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_BUFFERSIZE, 65535);
    final SingleSocketTcpWriter tcpWriter;
    try {
        tcpWriter = new SingleSocketTcpWriter(configuration);
        tcpWriter.onStarting();
    } catch (final IOException | ConnectionTimeoutException e) {
        // runtime exception is thrown after timeout
        if (TcpProbeController.LOGGER.isDebugEnabled()) {
            TcpProbeController.LOGGER.debug("Could not create TCP connections to " + hostname + " on port " + port, e);
        }
        throw new RemoteControlFailedException("Could not create TCP connections to " + hostname + " on port " + port + ", writer was not created ");
    }
    return tcpWriter;
}
Also used : ConnectionTimeoutException(kieker.monitoring.writer.tcp.ConnectionTimeoutException) Configuration(kieker.common.configuration.Configuration) SingleSocketTcpWriter(kieker.monitoring.writer.tcp.SingleSocketTcpWriter) IOException(java.io.IOException)

Example 2 with Configuration

use of kieker.common.configuration.Configuration in project iobserve-analysis by research-iobserve.

the class TestSend method main.

/**
 * Execute send test.
 *
 * @param args
 *            arguments are ignored.
 */
public static void main(final String[] args) {
    TestSend.LOGGER.debug("Sender");
    final Configuration configuration = ConfigurationFactory.createDefaultConfiguration();
    configuration.setProperty(ConfigurationKeys.CONTROLLER_NAME, "Kieker-Test");
    configuration.setProperty(ConfigurationKeys.WRITER_CLASSNAME, TestSend.WRITER_NAME);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_HOSTNAME, "localhost");
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_PORT, "9876");
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_BUFFERSIZE, "1024");
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_FLUSH, "true");
    // add ignored values
    configuration.setProperty(ConfigurationKeys.PREFIX + "test", "true");
    configuration.setProperty(TestSend.WRITER_NAME + ".test", "true");
    TestSend.LOGGER.debug("Configuration complete");
    final IMonitoringController ctrl = MonitoringController.createInstance(configuration);
    TestSend.LOGGER.debug("Controller active");
    TestSend.LOGGER.debug("Send first record");
    IMonitoringRecord record = new TraceMetadata(1, 2, "demo", "hostname", 0, 0);
    ctrl.newMonitoringRecord(record);
    TestSend.LOGGER.debug("Send second record");
    record = new BeforeOperationEvent(0, 1, 0, "Send", "main");
    ctrl.newMonitoringRecord(record);
    TestSend.LOGGER.debug("Done");
}
Also used : IMonitoringController(kieker.monitoring.core.controller.IMonitoringController) Configuration(kieker.common.configuration.Configuration) IMonitoringRecord(kieker.common.record.IMonitoringRecord) TraceMetadata(kieker.common.record.flow.trace.TraceMetadata) BeforeOperationEvent(kieker.common.record.flow.trace.operation.BeforeOperationEvent)

Aggregations

Configuration (kieker.common.configuration.Configuration)2 IOException (java.io.IOException)1 IMonitoringRecord (kieker.common.record.IMonitoringRecord)1 TraceMetadata (kieker.common.record.flow.trace.TraceMetadata)1 BeforeOperationEvent (kieker.common.record.flow.trace.operation.BeforeOperationEvent)1 IMonitoringController (kieker.monitoring.core.controller.IMonitoringController)1 ConnectionTimeoutException (kieker.monitoring.writer.tcp.ConnectionTimeoutException)1 SingleSocketTcpWriter (kieker.monitoring.writer.tcp.SingleSocketTcpWriter)1