Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
integrations/sql: update JDBC import path
Browse files Browse the repository at this point in the history
Update the JDBC integration path from
   "io.opencensus.integration.ocjdbc"
to
   "io.orijtech.integrations.ocjdbc"

because the old publishing was a little bureaucratic
and stalled for more than 3 months; publishing it
under "io.orijtech.integrations.ocjdbc" is just a flexible
way for maintaining the integration but also for putting
it into the hands of users without quarter long stalls.

Fixes #527
Retrofit by orijtech/opencensus-java-jdbc#1
  • Loading branch information
odeke-em committed Jan 11, 2019
1 parent bca8d44 commit cd19969
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions content/guides/integrations/sql/java_sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,46 @@ Github at https://github.com/opencensus-integrations/ocjdbc
but also distributed as a Maven artifact as you'll shortly see below.

## Installing it
Using Apache Maven, please add the following to your pom.xml file

```xml
{{<tabs Maven Gradle Ivy Buildr>}}
{{<highlight xml>}}
<dependency>
<groupId>io.opencensus.integration</groupId>
<artifactId>opencensus-ocjdbc</artifactId>
<groupId>io.orijtech.integrations</groupId>
<artifactId>ocjdbc</artifactId>
<version>0.0.2</version>
</dependency>
```
{{</highlight>}}

{{<highlight gradle>}}
// https://mvnrepository.com/artifact/io.orijtech.integrations/ocjdbc
compile group: 'io.orijtech.integrations', name: 'ocjdbc', version: '0.0.2'
{{</highlight>}}

{{<highlight xml>}}
<!-- https://mvnrepository.com/artifact/io.orijtech.integrations/ocjdbc -->
<dependency org="io.orijtech.integrations" name="ocjdbc" rev="0.0.2"/>
{{</highlight>}}

{{<highlight python>}}
# https://mvnrepository.com/artifact/io.orijtech.integrations/ocjdbc
'io.orijtech.integrations:ocjdbc:jar:0.0.2'
{{</highlight>}}
{{</tabs>}}

## Using it
Using it simply requires you to just wrap your already created JDBC connection and it wraps every method
to provide observability by metrics and tracing. For example
```java
import io.opencensus.integration.ocjdbc.Connection;
import io.opencensus.integration.ocjdbc.Observability;
import io.orijtech.integrations.ocjdbc.Connection;
import io.orijtech.integrations.ocjdbc.Observability;

public static void main(String ...args) {
// Load and use the MySQL Connector/J driver.
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();

java.sql.Connection originalConn = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/test?useSSL=false&serverTimezone=UTC");

// Then create/wrap it with the instrumented Connection from "io.opencensus.integration.ocjdbc".
// Then create/wrap it with the instrumented Connection from "io.orijtech.integrations.ocjdbc".
java.sql.Connection conn = new Connection(originalConn);

// Use conn like you would normally below as per your original program
Expand Down Expand Up @@ -138,8 +154,8 @@ In this example, we'll just wrap a MySQL Connector/J app as below. Please place
// Please place the file in: src/main/java/io/opencensus/tutorial/ocjdbc/App.java
package io.opencensus.tutorial.ocjdbc;

import io.opencensus.integration.ocjdbc.Connection;
import io.opencensus.integration.ocjdbc.Observability;
import io.orijtech.integrations.ocjdbc.Connection;
import io.orijtech.integrations.ocjdbc.Observability;

import io.opencensus.exporter.trace.jaeger.JaegerTraceExporter;
import io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector;
Expand Down Expand Up @@ -171,7 +187,7 @@ public class App {
Observability.OPTION_ANNOTATE_TRACES_WITH_SQL);
*/

// Then create/wrap it with the instrumented Connection from "io.opencensus.integration.ocjdbc".
// Then create/wrap it with the instrumented Connection from "io.orijtech.integrations.ocjdbc".
java.sql.Connection conn = new Connection(originalConn);
doWork(conn);
} catch (Exception e) {
Expand Down Expand Up @@ -248,8 +264,8 @@ public class App {
</dependency>

<dependency>
<groupId>io.opencensus.integration</groupId>
<artifactId>opencensus-ocjdbc</artifactId>
<groupId>io.orijtech.integrations</groupId>
<artifactId>ocjdbc</artifactId>
<version>0.0.2</version>
</dependency>

Expand Down

0 comments on commit cd19969

Please sign in to comment.