Search in sources :

Example 1 with TracingSQLLogger

use of marquez.tracing.TracingSQLLogger in project marquez by MarquezProject.

the class MarquezApp method registerResources.

public void registerResources(@NonNull MarquezConfig config, @NonNull Environment env, @NonNull DataSource source) {
    final JdbiFactory factory = new JdbiFactory();
    final Jdbi jdbi = factory.build(env, config.getDataSourceFactory(), (ManagedDataSource) source, DB_POSTGRES).installPlugin(new SqlObjectPlugin()).installPlugin(new PostgresPlugin());
    SqlLogger sqlLogger = new InstrumentedSqlLogger(env.metrics());
    if (isSentryEnabled(config)) {
        sqlLogger = new TracingSQLLogger(sqlLogger);
    }
    jdbi.setSqlLogger(sqlLogger);
    final MarquezContext context = MarquezContext.builder().jdbi(jdbi).tags(config.getTags()).build();
    if (config.getGraphql().isEnabled()) {
        env.servlets().addServlet("api/v1-beta/graphql", context.getGraphqlServlet()).addMapping("/api/v1-beta/graphql", "/api/v1/schema.json");
    }
    log.debug("Registering resources...");
    for (final Object resource : context.getResources()) {
        env.jersey().register(resource);
    }
}
Also used : Jdbi(org.jdbi.v3.core.Jdbi) JdbiFactory(io.dropwizard.jdbi3.JdbiFactory) TracingSQLLogger(marquez.tracing.TracingSQLLogger) InstrumentedSqlLogger(com.codahale.metrics.jdbi3.InstrumentedSqlLogger) SqlObjectPlugin(org.jdbi.v3.sqlobject.SqlObjectPlugin) SqlLogger(org.jdbi.v3.core.statement.SqlLogger) InstrumentedSqlLogger(com.codahale.metrics.jdbi3.InstrumentedSqlLogger) PostgresPlugin(org.jdbi.v3.postgres.PostgresPlugin)

Aggregations

InstrumentedSqlLogger (com.codahale.metrics.jdbi3.InstrumentedSqlLogger)1 JdbiFactory (io.dropwizard.jdbi3.JdbiFactory)1 TracingSQLLogger (marquez.tracing.TracingSQLLogger)1 Jdbi (org.jdbi.v3.core.Jdbi)1 SqlLogger (org.jdbi.v3.core.statement.SqlLogger)1 PostgresPlugin (org.jdbi.v3.postgres.PostgresPlugin)1 SqlObjectPlugin (org.jdbi.v3.sqlobject.SqlObjectPlugin)1