use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OTelTraceSource method createAuthenticationProvider.
private GrpcAuthenticationProvider createAuthenticationProvider(final PluginFactory pluginFactory) {
final PluginModel authenticationConfiguration = oTelTraceSourceConfig.getAuthentication();
if (authenticationConfiguration == null || authenticationConfiguration.getPluginName().equals(GrpcAuthenticationProvider.UNAUTHENTICATED_PLUGIN_NAME)) {
LOG.warn("Creating otel-trace-source without authentication. This is not secure.");
LOG.warn("In order to set up Http Basic authentication for the otel-trace-source, go here: https://github.com/opensearch-project/data-prepper/tree/main/data-prepper-plugins/otel-trace-source#authentication-configurations");
}
final PluginSetting authenticationPluginSetting;
if (authenticationConfiguration != null) {
authenticationPluginSetting = new PluginSetting(authenticationConfiguration.getPluginName(), authenticationConfiguration.getPluginSettings());
} else {
authenticationPluginSetting = new PluginSetting(GrpcAuthenticationProvider.UNAUTHENTICATED_PLUGIN_NAME, Collections.emptyMap());
}
return pluginFactory.loadPlugin(GrpcAuthenticationProvider.class, authenticationPluginSetting);
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class AbstractBufferTest method setUp.
@BeforeEach
public void setUp() {
MetricsTestUtil.initMetrics();
testPluginSetting = new PluginSetting(BUFFER_NAME, Collections.emptyMap());
testPluginSetting.setPipelineName(PIPELINE_NAME);
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class AbstractProcessorTest method testMetricsWithPluginSettingsConstructor.
@Test
public void testMetricsWithPluginSettingsConstructor() {
final String processorName = "testProcessor";
final String pipelineName = "testPipeline";
MetricsTestUtil.initMetrics();
PluginSetting pluginSetting = new PluginSetting(processorName, Collections.emptyMap());
pluginSetting.setPipelineName(pipelineName);
AbstractProcessor<Record<String>, Record<String>> processor = new ProcessorImpl(pluginSetting);
processor.execute(Arrays.asList(new Record<>("Value1"), new Record<>("Value2"), new Record<>("Value3")));
final List<Measurement> recordsInMeasurements = MetricsTestUtil.getMeasurementList(new StringJoiner(MetricNames.DELIMITER).add(pipelineName).add(processorName).add(MetricNames.RECORDS_IN).toString());
final List<Measurement> recordsOutMeasurements = MetricsTestUtil.getMeasurementList(new StringJoiner(MetricNames.DELIMITER).add(pipelineName).add(processorName).add(MetricNames.RECORDS_OUT).toString());
final List<Measurement> elapsedTimeMeasurements = MetricsTestUtil.getMeasurementList(new StringJoiner(MetricNames.DELIMITER).add(pipelineName).add(processorName).add(MetricNames.TIME_ELAPSED).toString());
Assertions.assertEquals(1, recordsInMeasurements.size());
Assertions.assertEquals(3.0, recordsInMeasurements.get(0).getValue(), 0);
Assertions.assertEquals(1, recordsOutMeasurements.size());
Assertions.assertEquals(6.0, recordsOutMeasurements.get(0).getValue(), 0);
Assertions.assertEquals(3, elapsedTimeMeasurements.size());
Assertions.assertEquals(1.0, MetricsTestUtil.getMeasurementFromList(elapsedTimeMeasurements, Statistic.COUNT).getValue(), 0);
Assertions.assertTrue(MetricsTestUtil.isBetween(MetricsTestUtil.getMeasurementFromList(elapsedTimeMeasurements, Statistic.TOTAL_TIME).getValue(), 0.1, 0.2));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class AbstractSinkTest method testMetrics.
@Test
public void testMetrics() {
final String sinkName = "testSink";
final String pipelineName = "pipelineName";
MetricsTestUtil.initMetrics();
PluginSetting pluginSetting = new PluginSetting(sinkName, Collections.emptyMap());
pluginSetting.setPipelineName(pipelineName);
AbstractSink<Record<String>> abstractSink = new AbstractSinkImpl(pluginSetting);
abstractSink.output(Arrays.asList(new Record<>(UUID.randomUUID().toString()), new Record<>(UUID.randomUUID().toString()), new Record<>(UUID.randomUUID().toString()), new Record<>(UUID.randomUUID().toString()), new Record<>(UUID.randomUUID().toString())));
final List<Measurement> recordsInMeasurements = MetricsTestUtil.getMeasurementList(new StringJoiner(MetricNames.DELIMITER).add(pipelineName).add(sinkName).add(MetricNames.RECORDS_IN).toString());
final List<Measurement> elapsedTimeMeasurements = MetricsTestUtil.getMeasurementList(new StringJoiner(MetricNames.DELIMITER).add(pipelineName).add(sinkName).add(MetricNames.TIME_ELAPSED).toString());
Assert.assertEquals(1, recordsInMeasurements.size());
Assert.assertEquals(5.0, recordsInMeasurements.get(0).getValue(), 0);
Assert.assertEquals(3, elapsedTimeMeasurements.size());
Assert.assertEquals(1.0, MetricsTestUtil.getMeasurementFromList(elapsedTimeMeasurements, Statistic.COUNT).getValue(), 0);
Assert.assertTrue(MetricsTestUtil.isBetween(MetricsTestUtil.getMeasurementFromList(elapsedTimeMeasurements, Statistic.TOTAL_TIME).getValue(), 0.5, 0.6));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class ServiceMapStatefulPrepperBenchmarks method setupServiceMapStatefulPrepper.
@Setup(Level.Trial)
public void setupServiceMapStatefulPrepper() {
final PluginSetting pluginSetting = new PluginSetting("plugin", Collections.singletonMap("window_duration", windowDurationSeconds * 1000));
serviceMapStatefulPrepper = new ServiceMapStatefulPrepper(pluginSetting);
}
Aggregations