Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

metrics-jdbi3

A Dropwizard module for instrumenting JDBI3

Description

This module provides a way to instrument JDBI3 applications and report metrics to a MetricRegistry from dropwizard-metrics.

The main abstraction is the InstrumentedTimingCollector class that extends JDBI's TimingCollector and accepts MetricRegistry. It registers a Timer with a name provided by the user specified StatementNameStrategy. The user can choose several strategies:

  • NaiveNameStrategy uses the name of the SQL query (select name from users).
  • BasicSqlNameStrategy uses the name of the SQL object under which it was executed (com.acme.UserDao.getUsers)
  • ContextNameStrategy uses the name name of the context group and statement name.
  • SmartNameStrategy uses the ContextNameStrategy strategy, if not applicable then BasicSqlNameStrategy, if it's not, then uses the constant sql.raw.

Use

Jdbi jdbi = Jdbi.create(dataSource);
jdbi.setTimingCollector(new InstrumentedTimingCollector(new MetricRegistry(), new SmartNameStrategy()));

Maven

<dependency>
     <groupId>com.github.arteam</groupId>
     <artifactId>metrics-jdbi3</artifactId>
     <version>1.0-rc2</version>
</dependency>

About

A Dropwizard module for instrumenting JDBI3

Resources

License

Packages

No packages published

Languages