Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTelemetry JDBC instrumentation library #3367

Merged
merged 76 commits into from
Jul 1, 2021
Merged
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
5bf3376
Added jdbc library with ported version of OpenTracing JDBC Instrument…
donbeave Jun 18, 2021
e3df35b
Gradle 7.1.
donbeave Jun 18, 2021
af12c2a
Revert "Gradle 7.1."
donbeave Jun 18, 2021
ca929fc
Code style fixes.
donbeave Jun 18, 2021
464cbb7
Code style fixes.
donbeave Jun 18, 2021
e4fe822
Moved some JDBC utilities classes to the library module.
donbeave Jun 19, 2021
91e6b9a
javax.annotation.Nullable -> org.checkerframework.checker.nullness.qu…
donbeave Jun 19, 2021
7c903f3
Build fix.
donbeave Jun 19, 2021
573d3ce
Spotless fixes.
donbeave Jun 19, 2021
c357a57
Cache prepared statements.
donbeave Jun 19, 2021
1229c5f
Cache connection info.
donbeave Jun 19, 2021
d163b42
Tracing for JDBC statement and prepared statement.
donbeave Jun 19, 2021
8afb87d
Added some API dependencies.
donbeave Jun 19, 2021
034b537
Fixed ending the span.
donbeave Jun 19, 2021
f45f3f9
Removed proxy usage.
donbeave Jun 21, 2021
343643a
Cleanup.
donbeave Jun 21, 2021
95bfe7b
Implemented datasource with tracing support.
donbeave Jun 21, 2021
375b7ac
Renamed Tracing prefix with OpenTelemetry.
donbeave Jun 21, 2021
a124016
Renamed Tracing prefix with OpenTelemetry.
donbeave Jun 21, 2021
397bc4b
Moved utilities classes to io.opentelemetry.instrumentation.jdbc.inte…
donbeave Jun 21, 2021
09ce33f
Build fix.
donbeave Jun 21, 2021
2a9ce6c
Build fix.
donbeave Jun 21, 2021
751ddb4
Cleanup.
donbeave Jun 21, 2021
a2ae147
Moved some shared classes to instrumentation-api module.
donbeave Jun 22, 2021
2212831
Code review fixes.
donbeave Jun 22, 2021
a8f1553
Make OpenTelemetryDriver final.
donbeave Jun 22, 2021
5699f89
Spotless fixes.
donbeave Jun 22, 2021
60f6f23
Moved test classes from javaagent-unit-tests module to library module.
donbeave Jun 23, 2021
6997669
Removed javaagent-unit-tests module.
donbeave Jun 23, 2021
a89ffc5
Covered OpenTelemetryDriver with tests.
donbeave Jun 23, 2021
fb14f11
Cleanup.
donbeave Jun 23, 2021
0ef50c7
Covered OpenTelemetryDataSource with tests.
donbeave Jun 24, 2021
07e1ab7
Covered OpenTelemetryConnection with tests.
donbeave Jun 24, 2021
4112488
Revert TestPreparedStatement.
donbeave Jun 24, 2021
d6538bd
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
donbeave Jun 24, 2021
62e91fa
Merge branch 'open-telemetry-main'
donbeave Jun 24, 2021
fa9c60c
Added README.
donbeave Jun 24, 2021
02b73a4
Build fix.
donbeave Jun 24, 2021
53151f5
Checkstyle fixes.
donbeave Jun 24, 2021
edcb7f9
Spotless fixes.
donbeave Jun 24, 2021
11038fa
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
Jun 25, 2021
3acc14a
Rename to build.gradle
Jun 25, 2021
df40e80
Fix build.gradle format.
donbeave Jun 25, 2021
141bece
INSTANCE package scope.
donbeave Jun 25, 2021
f51900e
Documented OpenTelemetryDataSource usage.
donbeave Jun 25, 2021
f25ba73
Renamed CheckedCallable to ThrowingSupplier.
donbeave Jun 25, 2021
f189b5f
Update instrumentation/jdbc/library/README.md
donbeave Jun 25, 2021
66d34aa
Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/in…
donbeave Jun 25, 2021
97b8b71
Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/in…
donbeave Jun 25, 2021
dc76975
Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/in…
donbeave Jun 25, 2021
b15f9c9
Update instrumentation/jdbc/library/README.md
donbeave Jun 25, 2021
0dd1178
Update instrumentation/jdbc/library/README.md
donbeave Jun 25, 2021
41e9561
Update instrumentation/jdbc/library/README.md
donbeave Jun 25, 2021
18beece
Removed javaagent-api module usage.
donbeave Jun 25, 2021
327d26f
Removed useless checking.
donbeave Jun 25, 2021
e6b7925
Moved javaagent test classes to testing module.
donbeave Jun 25, 2021
e14ac6a
Move common JDBC test classes to testing module.
donbeave Jun 25, 2021
bbbef33
Spotless fixes.
donbeave Jun 25, 2021
b35f6bb
Code format.
donbeave Jun 25, 2021
402637b
Moved PeerServiceAttributesExtractor back to javaagent-api module.
donbeave Jun 25, 2021
d0266d3
Rename JavaAgentJdbcSingletons to JdbcSingletons.
donbeave Jun 25, 2021
7e86a5a
Fixed JdbcSingletons import.
donbeave Jun 25, 2021
1720575
Cleanup.
donbeave Jun 27, 2021
d178c34
Codenarc fixes.
donbeave Jun 27, 2021
09851dc
Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/in…
donbeave Jun 28, 2021
3f89463
Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/in…
donbeave Jun 28, 2021
fc5299d
Parse InstrumentationVersion.VERSION.
donbeave Jun 28, 2021
de70de1
Store major and minor version in private static fields.
donbeave Jun 28, 2021
6e7d15a
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
Jun 28, 2021
6abe892
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
donbeave Jul 1, 2021
286f48d
Make the datasource way a preferred way.
donbeave Jul 1, 2021
7e7ce1f
Removed interceptor mode.
donbeave Jul 1, 2021
4473948
Rename build.gradle -> build.gradle.kts.
donbeave Jul 1, 2021
df12ddc
Switch to Gradle Kotlin DSL.
donbeave Jul 1, 2021
da8d9e0
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
donbeave Jul 1, 2021
a7a2557
Merge pull request #3 from open-telemetry/main
donbeave Jul 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package io.opentelemetry.instrumentation.jdbc;

import io.opentelemetry.instrumentation.api.InstrumentationVersion;
import io.opentelemetry.instrumentation.jdbc.internal.DbInfo;
import io.opentelemetry.instrumentation.jdbc.internal.JdbcConnectionUrlParser;
import io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryConnection;
Expand Down Expand Up @@ -162,6 +163,22 @@ private static String extractRealUrl(String url) {
: url;
}

private static int[] parseInstrumentationVersion() {
String[] parts = InstrumentationVersion.VERSION.split("\\.");
if (parts.length >= 2) {
try {
int majorVersion = Integer.parseInt(parts[0]);
donbeave marked this conversation as resolved.
Show resolved Hide resolved
int minorVersion = Integer.parseInt(parts[1]);

return new int[] {majorVersion, minorVersion};
} catch (NumberFormatException ignored) {
// ignore incorrect version
}
}
// return 0.0 as a fallback
return new int[] {0, 0};
}

@Nullable
@Override
public Connection connect(String url, Properties info) throws SQLException {
Expand Down Expand Up @@ -209,12 +226,12 @@ public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws

@Override
public int getMajorVersion() {
donbeave marked this conversation as resolved.
Show resolved Hide resolved
return 1;
return parseInstrumentationVersion()[0];
}

@Override
public int getMinorVersion() {
return 4;
return parseInstrumentationVersion()[1];
}

/** Returns {@literal false} because not all delegated drivers are JDBC compliant. */
Expand Down