Dropwizard Metrics for JDBI3

Support for instrumentation of JDBI3 code with Dropwizard Metrics

License

License

Categories

Categories

JDBI Data Databases Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

com.github.arteam
ArtifactId

ArtifactId

metrics-jdbi3
Last Version

Last Version

1.0-rc3
Release Date

Release Date

Type

Type

jar
Description

Description

Dropwizard Metrics for JDBI3
Support for instrumentation of JDBI3 code with Dropwizard Metrics
Project URL

Project URL

https://github.com/arteam/metrics-jdbi3
Source Code Management

Source Code Management

https://github.com/arteam/metrics-jdbi3

Download metrics-jdbi3

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.arteam/metrics-jdbi3/ -->
<dependency>
    <groupId>com.github.arteam</groupId>
    <artifactId>metrics-jdbi3</artifactId>
    <version>1.0-rc3</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.arteam/metrics-jdbi3/
implementation 'com.github.arteam:metrics-jdbi3:1.0-rc3'
// https://jarcasting.com/artifacts/com.github.arteam/metrics-jdbi3/
implementation ("com.github.arteam:metrics-jdbi3:1.0-rc3")
'com.github.arteam:metrics-jdbi3:jar:1.0-rc3'
<dependency org="com.github.arteam" name="metrics-jdbi3" rev="1.0-rc3">
  <artifact name="metrics-jdbi3" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.arteam', module='metrics-jdbi3', version='1.0-rc3')
)
libraryDependencies += "com.github.arteam" % "metrics-jdbi3" % "1.0-rc3"
[com.github.arteam/metrics-jdbi3 "1.0-rc3"]

Dependencies

compile (4)

Group / Artifact Type Version
io.dropwizard.metrics : metrics-core jar 3.2.5
io.dropwizard.metrics : metrics-annotation jar 3.2.5
org.jdbi : jdbi3-core jar 3.0.0-rc1
org.slf4j : slf4j-api jar 1.7.21

test (4)

Group / Artifact Type Version
junit : junit jar 4.12
org.assertj : assertj-core jar 3.5.2
org.mockito : mockito-core jar 2.2.3
org.slf4j : slf4j-simple jar 1.7.21

Project Modules

There are no modules declared in this project.

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>

Versions

Version
1.0-rc3
1.0-rc2
1.0-rc1