use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class EmbeddedKsql method main.
public static void main(final String[] args) {
final KsqlContext ksqlContext = KsqlContext.create(new KsqlConfig(Collections.emptyMap()), ProcessingLogContext.create(), new MetricCollectors());
ksqlContext.sql("REGISTER TOPIC orders_topic WITH (format = 'json', " + "kafka_topic='orders_topic_json');");
ksqlContext.sql("CREATE STREAM orders (orderid bigint KEY, ordertime bigint, itemid varchar, " + "orderunits double, arraycol array<double>, mapcol map<varchar, double>) " + "WITH (topicname = 'orders_topic' );\n");
ksqlContext.sql("CREATE STREAM BIGORDERS AS SELECT * FROM ORDERS WHERE ORDERUNITS > 5;");
ksqlContext.sql("SELECT * FROM ORDERS;");
ksqlContext.sql("CREATE TABLE ORDERSUMS AS select itemid, sum(orderunits) from orders window " + "TUMBLING ( size 30 second) group by itemid;");
System.out.println("Queries are running!");
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class KsqlAuthorizationValidatorImplTest method setUp.
@Before
public void setUp() {
metaStore = new MetaStoreImpl(new InternalFunctionRegistry());
ksqlEngine = KsqlEngineTestUtil.createKsqlEngine(serviceContext, metaStore, new MetricCollectors());
authorizationValidator = new KsqlAuthorizationValidatorImpl(accessValidator);
securityContext = new KsqlSecurityContext(Optional.empty(), serviceContext);
givenStreamWithTopic(KAFKA_STREAM_TOPIC, KAFKA_KSQL_TOPIC);
givenStreamWithTopic(AVRO_STREAM_TOPIC, AVRO_KSQL_TOPIC);
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class StandaloneExecutorFactory method create.
public static StandaloneExecutor create(final Map<String, String> properties, final String queriesFile, final String installDir, final MetricCollectors metricCollectors) {
final KsqlConfig tempConfig = new KsqlConfig(properties);
final Function<KsqlConfig, ServiceContext> serviceContextFactory = config -> ServiceContextFactory.create(config, DisabledKsqlClient::instance);
final ServiceContext tempServiceContext = serviceContextFactory.apply(tempConfig);
final String kafkaClusterId = KafkaClusterUtil.getKafkaClusterId(tempServiceContext);
final String ksqlServerId = tempConfig.getString(KsqlConfig.KSQL_SERVICE_ID_CONFIG);
final Map<String, Object> updatedProperties = tempConfig.originals();
updatedProperties.putAll(metricCollectors.addConfluentMetricsContextConfigs(ksqlServerId, kafkaClusterId));
return create(updatedProperties, queriesFile, installDir, serviceContextFactory, KafkaConfigStore::new, KsqlVersionCheckerAgent::new, StandaloneExecutor::new, metricCollectors);
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class KsqlEngineMetricsTest method setUp.
@Before
public void setUp() {
when(ksqlEngine.getServiceId()).thenReturn(KSQL_SERVICE_ID);
metricCollectors = new MetricCollectors();
engineMetrics = new KsqlEngineMetrics(METRIC_GROUP, ksqlEngine, metricCollectors, CUSTOM_TAGS, Optional.of(new TestKsqlMetricsExtension()));
}
use of io.confluent.ksql.metrics.MetricCollectors in project ksql by confluentinc.
the class SecureIntegrationTest method givenTestSetupWithConfig.
private void givenTestSetupWithConfig(final Map<String, Object> ksqlConfigs) {
ksqlConfig = new KsqlConfig(ksqlConfigs);
serviceContext = ServiceContextFactory.create(ksqlConfig, DisabledKsqlClient::instance);
ksqlEngine = new KsqlEngine(serviceContext, ProcessingLogContext.create(), new InternalFunctionRegistry(), ServiceInfo.create(ksqlConfig), new SequentialQueryIdGenerator(), ksqlConfig, Collections.emptyList(), new MetricCollectors());
execInitCreateStreamQueries();
}
Aggregations