Java Code Examples for io.airlift.log.Logger#info()

The following examples show how to use io.airlift.log.Logger#info() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TpchQueryRunner.java    From presto with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder()
            .setExtraProperties(ImmutableMap.<String, String>builder()
                    .put("http-server.http.port", "8080")
                    .put("sql.default-catalog", "tpch")
                    .put("sql.default-schema", "tiny")
                    .build())
            .build();
    Thread.sleep(10);
    Logger log = Logger.get(TpchQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 2
Source File: SqlServerQueryRunner.java    From presto with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();

    TestingSqlServer testingSqlServer = new TestingSqlServer();
    testingSqlServer.start();

    // SqlServer is using docker container so in case that shutdown hook is not called, developer can easily clean docker container on their own
    Runtime.getRuntime().addShutdownHook(new Thread(testingSqlServer::close));

    DistributedQueryRunner queryRunner = (DistributedQueryRunner) createSqlServerQueryRunner(
            testingSqlServer,
            ImmutableMap.of(),
            ImmutableList.of());

    Logger log = Logger.get(SqlServerQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 3
Source File: ElasticsearchQueryRunner.java    From presto with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    // To start Elasticsearch:
    // docker run -p 9200:9200 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.6.2

    Logging.initialize();

    DistributedQueryRunner queryRunner = createElasticsearchQueryRunner(
            HostAndPort.fromParts("localhost", 9200),
            TpchTable.getTables(),
            ImmutableMap.of("http-server.http.port", "8080"),
            ImmutableMap.of());

    Logger log = Logger.get(ElasticsearchQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 4
Source File: PinotQueryRunner.java    From presto with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    Map<String, String> properties = ImmutableMap.of("http-server.http.port", "8080");
    Map<String, String> pinotProperties = ImmutableMap.<String, String>builder()
            .put("pinot.controller-urls", "localhost:9000")
            .put("pinot.segments-per-split", "10")
            .put("pinot.request-timeout", "3m")
            .build();
    DistributedQueryRunner queryRunner = createPinotQueryRunner(properties, pinotProperties);
    Thread.sleep(10);
    Logger log = Logger.get(PinotQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 5
Source File: Server.java    From presto with Apache License 2.0 5 votes vote down vote up
private static void logLocation(Logger log, String name, Path path)
{
    if (!Files.exists(path, NOFOLLOW_LINKS)) {
        log.info("%s: [does not exist]", name);
        return;
    }
    try {
        path = path.toAbsolutePath().toRealPath();
    }
    catch (IOException e) {
        log.info("%s: [not accessible]", name);
        return;
    }
    log.info("%s: %s", name, path);
}
 
Example 6
Source File: OracleQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();

    DistributedQueryRunner queryRunner = createOracleQueryRunner(
            new TestingOracleServer(),
            TpchTable.getTables());

    Logger log = Logger.get(OracleQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 7
Source File: CassandraQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();

    DistributedQueryRunner queryRunner = createCassandraQueryRunner(
            new CassandraServer(),
            ImmutableMap.of("http-server.http.port", "8080"),
            TpchTable.getTables());

    Logger log = Logger.get(CassandraQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 8
Source File: GeoQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Logger log = Logger.get(GeoQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 9
Source File: BigQueryQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Thread.sleep(10);
    Logger log = Logger.get(BigQueryQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 10
Source File: ThriftQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    Map<String, String> properties = ImmutableMap.of("http-server.http.port", "8080");
    ThriftQueryRunnerWithServers queryRunner = (ThriftQueryRunnerWithServers) createThriftQueryRunner(3, true, properties);
    Thread.sleep(10);
    Logger log = Logger.get(ThriftQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 11
Source File: RaptorQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    Map<String, String> properties = ImmutableMap.of("http-server.http.port", "8080");
    DistributedQueryRunner queryRunner = createRaptorQueryRunner(properties, false, false);
    Thread.sleep(10);
    Logger log = Logger.get(RaptorQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 12
Source File: MongoQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = createMongoQueryRunner(
            new MongoServer(),
            ImmutableMap.of("http-server.http.port", "8080"),
            TpchTable.getTables());
    Thread.sleep(10);
    Logger log = Logger.get(MongoQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 13
Source File: KafkaQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = builder(new TestingKafka())
            .setTables(TpchTable.getTables())
            .build();
    Logger log = Logger.get(KafkaQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 14
Source File: ThriftTpchServer.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
{
    Logger log = Logger.get(ThriftTpchServer.class);
    try {
        start(ImmutableList.of());
        log.info("======== SERVER STARTED ========");
    }
    catch (Throwable t) {
        log.error(t);
        System.exit(1);
    }
}
 
Example 15
Source File: TpcdsQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Thread.sleep(10);
    Logger log = Logger.get(TpcdsQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 16
Source File: PostgreSqlQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();

    DistributedQueryRunner queryRunner = createPostgreSqlQueryRunner(
            new TestingPostgreSqlServer(),
            ImmutableMap.of("http-server.http.port", "8080"),
            ImmutableMap.of(),
            TpchTable.getTables());

    Logger log = Logger.get(PostgreSqlQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 17
Source File: AccumuloQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = createAccumuloQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Thread.sleep(10);
    Logger log = Logger.get(AccumuloQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 18
Source File: BlackHoleQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Thread.sleep(10);
    Logger log = Logger.get(BlackHoleQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 19
Source File: PrometheusQueryRunner.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws Exception
{
    Logging.initialize();
    DistributedQueryRunner queryRunner = createPrometheusQueryRunner(new PrometheusServer());
    Thread.sleep(10);
    Logger log = Logger.get(PrometheusQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
 
Example 20
Source File: TestPrometheusIntegrationTests3.java    From presto with Apache License 2.0 4 votes vote down vote up
@Test
public void testConfirmMetricAvailableAndCheckUp()
        throws Exception
{
    final Integer maxTries = 60;
    final Integer timeBetweenTriesMillis = 1000;
    runner = createQueryRunner();
    session = runner.getDefaultSession();
    int tries = 0;
    final OkHttpClient httpClient = new OkHttpClient.Builder()
            .connectTimeout(120, TimeUnit.SECONDS)
            .readTimeout(120, TimeUnit.SECONDS)
            .build();
    String prometheusServer = server.getAddress().toString();
    HttpUrl.Builder urlBuilder = HttpUrl.parse("http://" + prometheusServer + "/api/v1/query").newBuilder();
    urlBuilder.addQueryParameter("query", "up[1d]");
    String url = urlBuilder.build().toString();
    Request request = new Request.Builder()
            .url(url)
            .build();
    String responseBody;
    // this seems to be a reliable way to ensure Prometheus has `up` metric data
    while (tries < maxTries) {
        responseBody = httpClient.newCall(request).execute().body().string();
        if (responseBody.contains("values")) {
            Logger log = Logger.get(TestPrometheusIntegrationTests3.class);
            log.info("prometheus response: %s", responseBody);
            break;
        }
        Thread.sleep(timeBetweenTriesMillis);
        tries++;
    }
    if (tries == maxTries) {
        assertTrue(false, "Prometheus container not available for metrics query in " + maxTries * timeBetweenTriesMillis + " milliseconds.");
    }
    // now we're making sure the client is ready
    tries = 0;
    while (tries < maxTries) {
        if (session != null && runner.tableExists(session, "up")) {
            break;
        }
        Thread.sleep(timeBetweenTriesMillis);
        tries++;
    }
    if (tries == maxTries) {
        assertTrue(false, "Prometheus container, or client, not available for metrics query in " + maxTries * timeBetweenTriesMillis + " milliseconds.");
    }

    PrometheusTimeMachine.useFixedClockAt(LocalDateTime.now()); // must set time to now() as other tests may have set it
    MaterializedResult results = runner.execute(session, "SELECT * FROM prometheus.default.up LIMIT 1").toTestTypes();
    assertEquals(results.getRowCount(), 1);
    MaterializedRow row = results.getMaterializedRows().get(0);
    assertEquals(row.getField(0).toString(), "{instance=localhost:9090, __name__=up, job=prometheus}");
}