io.opentracing.contrib:opentracing-p6spy

OpenTracing P6Spy listener

License

License

Categories

Categories

p6spy Application Layer Libs Logging
GroupId

GroupId

io.opentracing.contrib
ArtifactId

ArtifactId

opentracing-p6spy
Last Version

Last Version

0.5.0
Release Date

Release Date

Type

Type

jar
Description

Description

io.opentracing.contrib:opentracing-p6spy
OpenTracing P6Spy listener
Project URL

Project URL

https://github.com/opentracing-contrib/java-p6spy
Source Code Management

Source Code Management

http://github.com/opentracing-contrib/java-p6spy

Download opentracing-p6spy

How to add to project

<!-- https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-p6spy/ -->
<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-p6spy</artifactId>
    <version>0.5.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-p6spy/
implementation 'io.opentracing.contrib:opentracing-p6spy:0.5.0'
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-p6spy/
implementation ("io.opentracing.contrib:opentracing-p6spy:0.5.0")
'io.opentracing.contrib:opentracing-p6spy:jar:0.5.0'
<dependency org="io.opentracing.contrib" name="opentracing-p6spy" rev="0.5.0">
  <artifact name="opentracing-p6spy" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.contrib', module='opentracing-p6spy', version='0.5.0')
)
libraryDependencies += "io.opentracing.contrib" % "opentracing-p6spy" % "0.5.0"
[io.opentracing.contrib/opentracing-p6spy "0.5.0"]

Dependencies

compile (2)

Group / Artifact Type Version
io.opentracing : opentracing-util jar 0.33.0
p6spy : p6spy jar 3.8.2

test (8)

Group / Artifact Type Version
io.opentracing : opentracing-util test-jar 0.33.0
io.opentracing : opentracing-mock jar 0.33.0
org.hsqldb : hsqldb jar 2.4.1
org.hibernate : hibernate-core jar 5.4.0.Final
org.springframework : spring-jdbc jar 4.3.19.RELEASE
org.apache.commons : commons-dbcp2 jar 2.5.0
org.mockito : mockito-core jar 2.23.4
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Build Status Coverage Status Released Version

opentracing-p6spy

OpenTracing instrumentation for p6spy

Installation

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-p6spy</artifactId>
    <version>0.3.1</version>
</dependency>

build.gradle

compile 'io.opentracing.contrib:opentracing-p6spy:0.3.1'

Usage

If you don't already have one, create a spy.properties file on your resource folder (ie src/main/resources)

Add the tracing module in your list

modulelist=io.opentracing.contrib.p6spy.TracingP6SpyFactory
tracingPeerService=token_database
traceWithActiveSpanOnly=true
traceWithStatementValues=true
  • tracingPeerService is used to set the peer.service value as defined here.
  • traceWithActiveSpanOnly in case you only want to trace calls when there is an active span;
  • traceWithStatementValues in case you want to trace calls with values of prepared statement. ⚠️ this can cause data leaks / security issues;

spy.properties is set globally to all instrumented connections. This can be limitating especially in environment accessing many databases. To overcome this, you can optionally set the tracingPeerService, traceWithActiveSpanOnly and traceWithStatementValues in the jdbc url :

jdbc:p6spy:mysql://localhost/tk_db?tracingPeerService=token_database;traceWithActiveSpanOnly=true;traceWithStatementValues=true

This will override spy.properties.

Beware that some JDBC drivers do not support adding unknown properties.

Tips when using it in JavaEE application servers. If you happen to deploy many applications within the same application server, add the jmxPrefix to avoid jmx name conflict :

modulelist=io.opentracing.contrib.p6spy.TracingP6SpyFactory
tracingPeerService=token_database
traceWithActiveSpanOnly=true
traceWithStatementValues=true
jmxPrefix=authentication_service

You can find more info on p6spy here

Tracing tags

The following tags are added to traces :

Span tag name Notes
span.kind client
component java-p6spy
peer.service if exists, the peer service name set in spy.properties or within the jdbc url using tracingPeerService
error true is any error occurred. false otherwise
db.type if exists, the authoritative part of the jdbc url (ex : mysql in jdbc:mysql://localhost)
db.statement the SQL query. If traceWithStatementValues is true, values from prepared statements will be logged.
db.instance if exists, the connection's catalog (can be a database name or a schema)
db.user if exists, the user name
io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

Versions

Version
0.5.0
0.4.0
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.0
0.1.0-RC2
0.1.0-RC1
0.0.2
0.0.1