use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class QueryBuilderTest method shouldBuildTransientQueryCorrectly.
@Test
public void shouldBuildTransientQueryCorrectly() {
// Given:
givenTransientQuery();
// When:
final TransientQueryMetadata queryMetadata = queryBuilder.buildTransientQuery(STATEMENT_TEXT, QUERY_ID, SOURCES.stream().map(DataSource::getName).collect(Collectors.toSet()), physicalPlan, SUMMARY, TRANSIENT_SINK_SCHEMA, LIMIT, Optional.empty(), false, queryListener, streamsBuilder, Optional.empty(), new MetricCollectors());
queryMetadata.initialize();
// Then:
assertThat(queryMetadata.getStatementString(), equalTo(STATEMENT_TEXT));
assertThat(queryMetadata.getSourceNames(), equalTo(SOURCES.stream().map(DataSource::getName).collect(Collectors.toSet())));
assertThat(queryMetadata.getExecutionPlan(), equalTo(SUMMARY));
assertThat(queryMetadata.getTopology(), is(topology));
assertThat(queryMetadata.getOverriddenProperties(), equalTo(OVERRIDES));
verify(kafkaStreamsBuilder).build(any(), propertyCaptor.capture());
assertThat(queryMetadata.getStreamsProperties(), equalTo(propertyCaptor.getValue()));
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class KsqlServerMain method main.
public static void main(final String[] args) {
try {
final ServerOptions serverOptions = ServerOptions.parse(args);
if (serverOptions == null) {
return;
}
final Map<String, String> properties = PropertiesUtil.applyOverrides(PropertiesUtil.loadProperties(serverOptions.getPropertiesFile()), System.getProperties());
final String installDir = properties.getOrDefault("ksql.server.install.dir", "");
final KsqlConfig ksqlConfig = new KsqlConfig(properties);
validateConfig(ksqlConfig);
QueryLogger.configure(ksqlConfig);
final Optional<String> queriesFile = serverOptions.getQueriesFile(properties);
final MetricCollectors metricCollectors = new MetricCollectors();
final Executable executable = createExecutable(properties, queriesFile, installDir, ksqlConfig, metricCollectors);
new KsqlServerMain(executable, r -> Runtime.getRuntime().addShutdownHook(new Thread(r))).tryStartApp();
} catch (final Exception e) {
log.error("Failed to start KSQL", e);
System.exit(-1);
}
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class KsqlResourceTest method shouldDescribeStreamsExtended.
@Test
public void shouldDescribeStreamsExtended() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
givenSource(DataSourceType.KSTREAM, "new_stream", "new_topic", schema);
// When:
final SourceDescriptionList descriptionList = makeSingleRequest("DESCRIBE STREAMS EXTENDED;", SourceDescriptionList.class);
// Then:
assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_STREAM")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_2")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_stream")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class KsqlResourceTest method shouldDescribeTablesExtended.
@Test
public void shouldDescribeTablesExtended() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
givenSource(DataSourceType.KTABLE, "new_table", "new_topic", schema, ImmutableSet.of(SourceName.of("TEST_TABLE")));
// When:
final SourceDescriptionList descriptionList = makeSingleRequest("DESCRIBE TABLES EXTENDED;", SourceDescriptionList.class);
// Then:
assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_TABLE")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_1")), Collections.emptyList(), ImmutableList.of("new_table"), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_table")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class KsqlResourceTest method shouldShowTablesExtended.
@Test
public void shouldShowTablesExtended() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
givenSource(DataSourceType.KTABLE, "new_table", "new_topic", schema, ImmutableSet.of(SourceName.of("TEST_TABLE")));
// When:
final SourceDescriptionList descriptionList = makeSingleRequest("SHOW TABLES EXTENDED;", SourceDescriptionList.class);
// Then:
assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_TABLE")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_1")), Collections.emptyList(), ImmutableList.of("new_table"), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_table")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
Aggregations