Commit Graph

118 Commits

Author SHA1 Message Date
Nikita Salnikov-Tarnovski a48bd9de3f
Move PeerServiceAttributesExtractor from javaagent api to instrumentation api (#4235)
* Move PeerServiceAttributesExtractor from javaagent api to instrumentation api

* spotless
2021-10-06 12:42:55 -07:00
Lauri Tulmin 95651a4f1b
Intern db info (#4263) 2021-10-03 19:47:40 -07:00
Mateusz Rzeszutek c11b96e4d0
Make it possible to use InstrumentationContext (now VirtualField) fro… (#4218)
* Make it possible to use InstrumentationContext (now VirtualField) from library instrumentation

* fix tests

* fix javadocs

* fix some more tests

* code review comments

* setIfNull, computeIfNull
2021-10-01 11:13:11 +02:00
Matthew Ho 6967484a97
Update groovy import order to match default IntelliJ (#1708) (#4047)
* Update groovy import order to match default IntelliJ (#1708)

* organized imports for .groovy files to follow default IntelliJ import settings

* updated intellij-setup.md

* Spotless

* drift

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-09-11 11:53:08 -07:00
Lauri Tulmin b61113fef6
JDBC: use ContextStore when running as agent (#3987)
* JDBC: use ContextStore when running as agent

* address review comments

* use singular
2021-08-27 14:14:40 -07:00
Anuraag Agrawal e0cb216610
Remove remaining usages of basic span asserts (#3616) 2021-07-19 10:09:44 -07:00
Anuraag Agrawal f5ce4c03f8
Inline basic usages of basicSpan (#3583)
* Inline basic usages of basicSpan

* spock
2021-07-18 21:15:51 +03:00
Anuraag Agrawal d3b62de8a5
Replace most uses of TraceUtils with testRunner runWithSpan. (#3582) 2021-07-15 10:30:34 -07:00
Mateusz Rzeszutek 9b56fc9051
Clean up AgentElementMatchers (#3527)
* Clean up AgentElementMatchers

* remove a TODO

* moved method
2021-07-09 10:02:21 +03:00
Trask Stalnaker b304cc2912
Deprecate CallDepth.reset() and get() (#3511)
* Deprecate CallDepth.reset() and get()

* Don't pass CallDepth around
2021-07-07 09:24:50 -07:00
Mateusz Rzeszutek c5ba5c3a71
Use local variable for passing CallDepth between advice enter/exit me… (#3504)
* Use local variable for passing CallDepth between advice enter/exit methods

* fix broken call depth tracking

* checkstyle

* fix javadocs
2021-07-06 12:05:14 -07:00
Mateusz Rzeszutek b9fcb6b498
Reduce CallDepth classes' API surface (#3497) 2021-07-06 09:24:19 +02:00
Alexey Zhokhov ed02aff7b5
OpenTelemetry JDBC instrumentation library (#3367)
* Added jdbc library with ported version of OpenTracing JDBC Instrumentation.

* Gradle 7.1.

* Revert "Gradle 7.1."

This reverts commit e3df35b0

* Code style fixes.

* Code style fixes.

* Moved some JDBC utilities classes to the library module.

* javax.annotation.Nullable -> org.checkerframework.checker.nullness.qual.Nullable

* Build fix.

* Spotless fixes.

* Cache prepared statements.

* Cache connection info.

* Tracing for JDBC statement and prepared statement.

* Added some API dependencies.

* Fixed ending the span.

* Removed proxy usage.

* Cleanup.

* Implemented datasource with tracing support.

* Renamed Tracing prefix with OpenTelemetry.

* Renamed Tracing prefix with OpenTelemetry.

* Moved utilities classes to io.opentelemetry.instrumentation.jdbc.internal subpackage.

* Build fix.

* Build fix.

* Cleanup.

* Moved some shared classes to instrumentation-api module.

* Code review fixes.

* Make OpenTelemetryDriver final.

* Spotless fixes.

* Moved test classes from javaagent-unit-tests module to library module.

* Removed javaagent-unit-tests module.

* Covered OpenTelemetryDriver with tests.

* Cleanup.

* Covered OpenTelemetryDataSource with tests.

* Covered OpenTelemetryConnection with tests.

* Revert TestPreparedStatement.

* Added README.

* Build fix.

* Checkstyle fixes.

* Spotless fixes.

* Rename to build.gradle

* Fix build.gradle format.

* INSTANCE package scope.

* Documented OpenTelemetryDataSource usage.

* Renamed CheckedCallable to ThrowingSupplier.

* Update instrumentation/jdbc/library/README.md

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/OpenTelemetryDriver.java

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/OpenTelemetryDriver.java

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/OpenTelemetryDriver.java

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* Update instrumentation/jdbc/library/README.md

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* Update instrumentation/jdbc/library/README.md

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* Update instrumentation/jdbc/library/README.md

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>

* Removed javaagent-api module usage.

* Removed useless checking.

* Moved javaagent test classes to testing module.

* Move common JDBC test classes to testing module.

* Spotless fixes.

* Code format.

* Moved PeerServiceAttributesExtractor back to javaagent-api module.

* Rename JavaAgentJdbcSingletons to JdbcSingletons.

* Fixed JdbcSingletons import.

* Cleanup.

* Codenarc fixes.

* Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/OpenTelemetryDriver.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Update instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/OpenTelemetryDriver.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Parse InstrumentationVersion.VERSION.

* Store major and minor version in private static fields.

* Make the datasource way a preferred way.

* Removed interceptor mode.

* Rename build.gradle -> build.gradle.kts.

* Switch to Gradle Kotlin DSL.

Co-authored-by: Anuraag Agrawal <aanuraag@amazon.co.jp>
Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2021-07-01 10:35:07 -07:00
Mateusz Rzeszutek 15ed01d4fc
Change all instrumentation names to io.opentelemetry.{libName}-{libVersion} (#3411)
* Change all instrumentation names to io.opentelemetry.{libName}-{libVersion}

* minumum supported version
2021-06-30 15:34:36 +02:00
Anuraag Agrawal 761b9c280b
Migrate instrumentation gradle files to kotlin (#3414)
* Migrate instrumentation gradle files to kotlin

* Convert

* Muzzle
2021-06-28 17:27:12 +09:00
Anuraag Agrawal 785dc6adf2
Rename build files to build.gradle (#3409)
* Rename build files to build.gradle

* Rename smoke-tests

* Fix already broken
2021-06-25 16:10:31 +09:00
Anuraag Agrawal deb0e255cf
Use plugins block everywhere for applying plugins (#3386)
* Use plugins block everywhere for applying plugins

* Actually it's library instrumentation
2021-06-24 11:13:35 +09:00
Anuraag Agrawal 80f43b7a6a
Migrate javaagent-instrumentation to plugin (#3328)
* Migrate instrumentation.gradle to plugin

* Migrate usages

* Remove old

* Fix

* Revert example

* afterEvaluate

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-06-17 23:13:14 +09:00
Mateusz Rzeszutek 2f528e4166
Rename *Instrumenters to *Singletons (#3335) 2021-06-16 10:12:37 -07:00
Trask Stalnaker 62f1f49bcd
Intellij cleanup (Java and Groovy) (#3285)
* Intellij cleanup

* Update instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Update instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractorTest.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Update instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlAttributesExtractorTest.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Update instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Update instrumentation/spring/spring-web-3.1/library/src/test/java/io/opentelemetry/instrumentation/spring/httpclients/RestTemplateInterceptorTest.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

* Use glassfish version that supports lambdas

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2021-06-14 10:23:01 -07:00
Trask Stalnaker 4c80c62ce7
Add unused to remaining advice classes (#3280)
* Add unused to remaining advice classes

* Add newlines for visual separation
2021-06-14 11:12:02 +09:00
Trask Stalnaker e9c3df6dac
Static factory method ordering (#3206) 2021-06-07 15:29:30 -07:00
Trask Stalnaker a78ed4c420
Rename some extractor request/response params (#3202) 2021-06-07 11:41:47 -07:00
Anuraag Agrawal 2436499a09
Update to Errorprone 2.7 (#3181)
* Update to errorprone 2.7

* ToString

* Finish
2021-06-04 10:40:55 +09:00
Mateusz Rzeszutek 5e4c5684e6
Moved jdbc-datasource instrumentation to Instrumenter API (#3160) 2021-06-02 23:45:11 -07:00
Anuraag Agrawal c3dedbb64e
Enable all errorprone checks (#3155)
* Enable all errorprone checks

* Fixes

* Finish

* Finish

* Add flag to disable error prone
2021-06-01 17:41:08 +09:00
Anuraag Agrawal ed88cca533
Migrate from spotbugs to errorprone (#3122)
* Migrate from spotbugs to errorprone

* Fix hashtable

* try-with-resources

* Fix from merge

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-05-28 14:23:40 -07:00
Anuraag Agrawal c358a35414
Use dependency management pattern for dependency versions (#3113)
* Use dependency management pattern for dependency versions.

* Add groovy bom too

* Update dependencyManagement/dependencyManagement.gradle.kts

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-05-28 11:32:08 +09:00
Trask Stalnaker c8ecd9a619
Add response type parameter to db attributes extractor (#3093)
* Add response type parameter to DbAttributesExtractor

* AutoValue

* ResultSet
2021-05-26 23:13:33 -07:00
Lauri Tulmin 38830ea06e
Fix JdbcInstrumentationTest (#3089) 2021-05-26 08:25:20 -07:00
Mateusz Rzeszutek d755654c29
[WIP] Add peer.service to Instrumenter API (#3050)
* [WIP] Add peer.service to Instrumenter API

* Move PeerServiceAttributesExtractor to javaagent-api and use reflection to add it

* Finish PeerServiceAttributesExtractor

* Fix tests

* Add peer.service to apache-httpclient-5.0, jedis-1.4, lettuce-4.0
2021-05-25 15:31:41 +02:00
Trask Stalnaker 329233e576
Change a couple of Longs to Integers in Instrumenter API (#3043) 2021-05-20 14:33:22 -07:00
Trask Stalnaker 6efae9ad28
Remove duplicate method (#3032) 2021-05-19 11:56:34 -07:00
Mateusz Rzeszutek bb8f515083
Refactor TypeInstrumentation#transformers() method (#3019)
* Refactor TypeInstrumentation#transformers() method part 1

Add TypeInstrumentation and its implementations

* Refactor TypeInstrumentation#transformers() method part 2

Use the new method in all existing TypeInstrumentation implementations

* Drift

* Spotless

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-05-18 09:50:26 +02:00
Trask Stalnaker 85522cb2ed
Avoid loading advice classes in agent class loader (#3008)
* Lettuce 5.0

* Lettuce 4.0

* Ratpack

* Cassandra 4.0

* Grizzly

* KHttp

* External annotations

* Test

* Jdbc

* Method instrumentation

* OTel annotations
2021-05-16 20:07:20 -07:00
Anuraag Agrawal fe41885ee6
Switch to colon notation for dependencies. (#2994)
* Switch to colon notation for dependencies.

* Even more cleanup

* Revert mistake
2021-05-15 15:31:06 +09:00
Trask Stalnaker 1086bce0b0
Add comment to JDBC DataSource instrumentation (#2940) 2021-05-11 09:52:42 -07:00
Anuraag Agrawal abeca79e24
Some Gradle optimizations (#2949)
* Gradle optimizations

* Finish
2021-05-11 17:45:54 +09:00
Mateusz Rzeszutek 9c7fae3b04
Extract javaagent-extension-api from tooling & spi (#2879) 2021-05-06 23:30:25 -07:00
Mateusz Rzeszutek c9a3793bf8
Instrumenter API improvements (#2860)
* Instrumenter API improvements

* Move HTTP & net classes to separate packages
* Remove `db` prefix from method names in `DbAttributesExtractor`
* Add request-only net attributes extractor (it'll be needed in spring-sleuth-otel once we decide to use Instrumenters there)

* One NetAttributesExtractor class, javadocs

* add missing @Nullable

* Apply suggestions from code review

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* spotless

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-05-06 11:35:38 +02:00
Lauri Tulmin 9f8371e77c
Use locale insensitive lower/upper case conversion (#2838) 2021-04-22 11:24:13 +09:00
Trask Stalnaker bd829a6494
Remove duplicate status verification (#2710) 2021-04-19 11:41:37 -07:00
Mateusz Rzeszutek 3faf693631
Fix tests on the main branch (#2795)
* Fix tests on the main branch

* And fix muzzle by the way
2021-04-13 19:30:13 +02:00
Mateusz Rzeszutek 113ef24bef
Use Instrumenter in JDBC instrumentation (#2739)
* Use Instrumenter in JDBC instrumentation

Except jdbc-datasource, that one is going to be in a separate PR

* Use Instrumenter in JDBC instrumentation - code review comments
2021-04-13 16:19:13 +02:00
Mateusz Rzeszutek 5c280d4c43
Fix JDBC instrumentation: recursive statements inside Connection#getMetaData (#2756) 2021-04-09 10:46:12 -07:00
Trask Stalnaker 25dd2cf194
Verify span kind in all tests (#2715) 2021-04-05 12:57:48 -07:00
Anuraag Agrawal 79d7e88e53
Use Caffeine for weak maps (#2601)
* Caffeine weakmap

* Use Caffeine for weak maps

* Drift

* Drift

* Remove weak-lock-free

* Update licenses

* Fix bug

* Restore weaklockfree

* Clean

* Fixes

* Inline expunction

* Synchronized

* More comment

* Fix shading

* Executor

* computeIfAbsent and delete unused.

* Fix license report
2021-03-24 17:12:26 +09:00
Mateusz Rzeszutek ae23b97ec4
Move and rename NetPeerUtils (#2548)
* Move and rename NetPeerUtils

* Rename NetPeerUtils to NetPeerAttributes; inject instance instead of using a global var
* Rename SpanAttributeSetter to AttributeSetter (might be used to set on AttributesBuilder in the future, who knows)
* Deprecate default BaseTracer constructor: library instrumentations are supposed to inject all dependencies, the javaagent should explicitly pass globals

* fix compilation failure

* Remove peer.service customization from library instrumentation
2021-03-16 13:50:19 +01:00
Piotr Glazar 92d61b5844
Auto value (#2494)
* SqlStatementInfo as AutoValue

* RequestMeta as AutoValue

* DbInfo as AutoValue

* After merge compilation fix

* CouchbaseQuerySanitizer compilation fix

* JdbcConnectionUrlParserTest compilation fix

* Revert "RequestMeta as AutoValue"

This reverts commit 609b57ee48.
2021-03-09 15:07:03 +02:00
Anuraag Agrawal 94872b1ced
Move DB helpers to instrumentation-api (#2511)
* Move DB helpers to instrumentation-api

* Fix gradle config

* Remove legacy
2021-03-08 12:32:36 +09:00
Mateusz Rzeszutek 5317b7e7f1
Enrich JDBC spans with db.operation and db.sql.table (#2425) 2021-02-27 12:44:20 +02:00
Mateusz Rzeszutek fd55ce226a
Refactor DatabaseClientTracer (in preparation for low-cardinality span names) (#2398)
* Refactor DatabaseClientTracer (in preparation for low-cardinality span names)

* spotless
2021-02-26 15:36:24 +01:00
Mateusz Rzeszutek 0adeb85f43
Refactor InMemoryExporter and move some of its methods … (#2264)
* Refactor InMemoryExporter and move some of its methods to spock base class & junit extension

* codenarc

* spotless

* Apply suggestions from code review

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* fix armeria library tests

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-02-15 17:36:14 +01:00
Mateusz Rzeszutek 0fbdcad1dd
Make BaseTracer#startSpan() return Context (#2232)
* Make BaseTracer#startSpan() return Context

* Update instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/CamelEventNotifier.java

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* spotless

* Add Javadocs to BaseTracer

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-02-12 12:12:40 +01:00
Anuraag Agrawal fc410706d0
Update to Sdk 0.16.0 (#2221)
* Update to 0.16.0-SNAPSHOT

* Finish

* Finish

* Update to 0.16.0

* Finish
2021-02-09 18:00:54 +09:00
Mateusz Rzeszutek 93b3a3b289
testing-common refactoring: replace direct AgentTestRunner usage with… (#2134)
* testing-common refactoring: replace direct AgentTestRunner usage with spock spec

* Updated instrumentation docs

* Fix reactor-core library tests

ReactorCoreTest was getting a tracer from GlobalOpenTelemetry before LibraryTestTrait had a change to initialize the SDK
2021-02-01 11:32:25 +01:00
Mateusz Rzeszutek c61f3f2949
Use a single configuration property for db.statement sanitization (#2125)
* Use a single configuration property for db.statement sanitization

* spotless
2021-01-29 16:02:15 +09:00
jason plumb 782a646d89
Cache sql sanitized extraction (#2094) 2021-01-27 10:04:58 -08:00
Mateusz Rzeszutek 20dadc1b6d
Replace two JavaCC lexers with a single JFlex one (#2113) 2021-01-26 14:03:11 -08:00
jason plumb 7122c4b2a5
Rename "normalize" to "sanitize" (#2087)
* rename SqlNormalizer to SqlSanitizer (more descriptive).

* rename normalize to sanitize.

* rename in comments and messages

* rename in variable to sanitized

* rename normalized -> sanitized in tests

* fixed broken tests

* rename variable.

Co-authored-by: Anuraag Agrawal <aanuraag@amazon.co.jp>
2021-01-22 15:49:24 +09:00
Anuraag Agrawal afdde0355b
Update to OTel 0.14.1 (#2059)
* Update SDK dependency to 0.14.1

* WIP

* Finish

* Cleanup
2021-01-18 13:02:04 +09:00
Pavol Loffay 077d8b64f6
Move common matchers to tooling/bytebuddy/matcher and ignore matchers to tooling/matcher (#1965) 2021-01-10 12:35:53 -08:00
Anuraag Agrawal 3b88bb75ae
Use SemanticAttributes for DbSystem (#1991) 2021-01-07 18:59:56 -08:00
Anuraag Agrawal 8d74baa2e4
Run tests with javaagent. (#1643)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-01-04 13:13:24 -08:00
Trask Stalnaker 4cbfb361e1
Use Context more in DatabaseClientTracer (#1836) 2020-12-07 09:15:15 +02:00
Trask Stalnaker 65f54e450b
Use Context more in HttpClientTracer (#1811)
* Use Context more in HttpClientTracer

* Better http-url-connection response object

* Follow database semantic conv for elasticsearch-rest

* Remove unnecessary CallDepth tracking
2020-12-03 11:47:08 -08:00
Trask Stalnaker ca76c80820
Hardcode expected values in tests (#1803)
* DEFAULT_SPAN_NAME

* TEMP_DESTINATION_NAME

* LoggingContextConstants

* Remove unnecessary dependencies

* Hardcode expected normalized queries in tests

* Spotless
2020-11-30 09:16:59 +02:00
Trask Stalnaker 5f263644da
Create javaagent dirs for all instrumentations (#1668)
* Create javaagent dirs for all instrumentation

* Add note about kotlin coroutine library instrumentation

* Feedback
2020-11-28 21:04:16 -08:00