OpenTracing instrumentation for JDBI.
opentracing-contrib / java-jdbi Goto Github PK
View Code? Open in Web Editor NEWOpenTracing instrumentation for the JDBI database framework
License: Apache License 2.0
OpenTracing instrumentation for the JDBI database framework
License: Apache License 2.0
OpenTracing instrumentation for JDBI.
Having a JDBI3 plugin makes the usage much simpler:
Be sure to call Jdbi.installPlugins()
upon initialization and all requests will be traced.
The plugin can have a customizeJdbi
method that adds the JDBI3 timing collector to the configuration.
JDBI3 deprecated the use of its TimingCollector
.
I created a OpenTracingSqlLogger
on the same principle as the current timing collector and have the following code in my JDBI3 plugin:
public class OpentracingJdbi3Plugin implements JdbiPlugin {
private static final Logger LOGGER = Logger.getLogger(OpentracingJdbi3Plugin.class.getName());
@Override
public void customizeJdbi(Jdbi jdbi) {
try {
OpentracingSqlLogger.configure(jdbi);
} catch (LinkageError sqlLoggerApiUnavailable) {
LOGGER.log(Level.WARNING, sqlLoggerApiUnavailable,
() -> "Could not configure Opentracing SqlLogger implementation. " +
"Are you using JDBI version 3.2 or greater?");
OpentracingTimingCollector.configure(jdbi);
}
}
As you can see it uses the new SqlLogger
JDBI3 api if available but falls back on the (deprecated) TimingCollector
variant without using reflection.
Hi all,
I was looging at the code and noticed that in OpenTracingCollector.java#L101, the span is started but not put in scope.
I have a use case where we are developping a jdbc driver with native opentracing support. Therefore, when a span is created and started in the driver, it does not register as a child of the jdbi span.
Does it make sense to you to have the jdbi span in scope ?
Thanks and great work !
Should we make this contrib repo a multi-module repository to release separate
jdbi-opentracing
andjdbi3-opentracing
maven artifacts?
The split package structure kind of feels 'wrong' and I think having JDBI as provided dependency also feels wrong. JDBI is a transient dependency for this module and ought to be declared as such.
I'm willing to create a PR for this if there is demand for it.
Initializing with
public OpenTracingCollector(Tracer tracer, TimingCollector next)
will result in "next" not being used
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.