Commit Graph

180 Commits

Author SHA1 Message Date
Jamal Fanaian bdcb2d09e8
Implement spanName for MongoClientTracer (#2307)
* Implement spanName for MongoClientTracer

Adds a basic implementation for spanName in MongoClientTracer that uses the recommended  name from the specification.

* Fix mongo4 tests

* Fix typo in test

* Handle missing dbName

* Update test with a command that has no collection as value

* Fix style issues

* Fix formatting

* remove uneeded line
2021-02-18 11:44:21 +09: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
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
Trask Stalnaker 23945d97e9
Publish lettuce and mongo common (#2148) 2021-02-01 13:26:08 +09:00
Sergei Malafeev bbcbeb51e3
MongoDB 4 driver instrumentation (#2046)
* MongoDB 4 driver instrumentation

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* fix getting constructor

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* fix formatting

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* Update instrumentation/mongo/mongo-4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v4/MongoClientInstrumentationModule.java

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

* Update settings.gradle

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

* Update instrumentation/mongo/mongo-4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/v4/MongoClientInstrumentationModule.java

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

* use mongo-4.0

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* use public api

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* use testImplementation

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* use declaresField(named("commandListeners")) in typeMatcher

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* migrate to mongo-4.0-testing

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2021-01-25 15:55:03 +02: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
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 a04a0586a5
Fix mongo-common testLatestDeps (#1818) 2020-12-01 20:18:17 -08:00
Trask Stalnaker 01b4345742
Move MongoClientTracerTest to same module as MongoClientTracer (#1804)
* Move MongoClientTracerTest to mongo-common

* Remove multi-version support

* Use library dependency
2020-12-01 14:45:45 -08:00
Trask Stalnaker 26f254b10d
Create javaagent dirs for all instrumentations, part 2 (#1794) 2020-11-28 22:26:49 -08:00
Trask Stalnaker 41bd489a77
Format groovy files (#1793) 2020-11-28 21:22:14 -08: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
Mateusz Rzeszutek 9a64a628ea
Make instrumentations non final (#1752)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2020-11-26 11:22:25 -08:00
Mateusz Rzeszutek 50c8ab499d
Remove no longer needed helperClassNames() methods (#1755) 2020-11-24 20:50:32 -08:00
Trask Stalnaker c3e1a321d2
Fix MongoDB testLatestDeps (#1703)
* Fix MongoDB testLatestDeps

* Codenarc
2020-11-20 09:34:25 +02:00
Jeff Yemin d093a561b9
Report only known collection names in MongoClientTracer (#1625) (#1662)
* Report only known collection names in MongoClientTracer (#1625)

* Use allow-list of commands that are known to use collection name as the value of the command
* Special-case getMore command, which uses a different field for the collection name

* Add create, drop, and createIndexes to list of commands with collection name as their values
2020-11-19 16:26:27 -08:00
Jeff Yemin 65a6293714
Improve command scrubber in MongoClientTracer (#1587) (#1663)
* Improve command scrubber in MongoClientTracer (#1587)

* Don't scrub the command field value at all if it's a string
* Use JsonWriter to improve efficiency of the scrubber
* If available, user JsonWriter.Builder.maxLength to limit size of the query string
2020-11-19 13:21:29 -08:00
Trask Stalnaker cecdfc2cd0
Update instrumentation names to be consistent (#1671)
* Update instrumentation names to be consistent

* Remove amqp from rabbitmq package name
2020-11-18 19:53:31 -08:00
Mateusz Rzeszutek 1a23ac3027
Standardize instrumentation names in InstrumentationModules (#1648)
* Standardize instrumentation names in InstrumentationModules

* rename gradle modules:
  * vertx-3.0 to vertx-web-3.0
  * spark-web-framework-2.3 to spark-2.3
* add JavaDoc describing the naming rules to InstrumentationModule
2020-11-17 13:30:28 -08:00
Mateusz Rzeszutek ef58ec1770
Refactor Instrumenters into InstrumentationModules - K, L, M (#1563) 2020-11-09 14:41:55 -08:00
Anuraag Agrawal d3b60a5e33
Rename TRACER to tracer() (#1540) 2020-11-02 20:49:51 -08:00
Anuraag Agrawal c6eee70660
Update to latest snapshot. (#1524) 2020-10-29 18:54:09 -07:00
Anuraag Agrawal a2dccf2316
Update to latest SDK snapshot. (#1479) 2020-10-26 19:29:46 -07:00
Trask Stalnaker 3565775b00
Format groovy (#1475)
* Apply Intellij format to groovy

* spotless
2020-10-26 11:47:12 +09:00
Mateusz Rzeszutek 50990a7c17
Cassandra instrumentations should store normalised CQL queries as db.statement (#1427)
* Move `DbSystem` to package `...instrumentation.api.db`
* Move `SqlNormalizer` to `javaagent-api`  package ...api.db.normalizer
* Refactor Cassandra tests so that they use testcontainers (and run on Java 11)
* Implement Cassandra statement normalization
2020-10-22 17:56:06 +02:00
Vadim Shaigorodskiy 9e8d663ba4
Remove apache httpclient version (#1446)
* Remove version from `apache-httpclient` instrumentation

Fixes: #1260

* Remove version from all instrumentation names and add instrumentation name to `spring-web`

Fixes: #1260
2020-10-22 14:22:44 +09:00
Ioannis Mavroukakis 191370657a
capture mongodb database name as mongo-db.name attribute instead of client description (#1419) 2020-10-19 10:52:50 -07:00
Jamal Fanaian 69ea2f7491
Add operation and collection attributes for MongoDB spans (#1398)
* Add mongodb attributes for operation and collection

* Switch to using SemanticAttributes.MONGODB_COLLECTION

* Remove unused imports

* Fix import order

* Fix formatting

* Update tests to keep more readable closure syntax

* Run spotlessApply
2020-10-19 09:20:46 +03:00
Trask Stalnaker 1b51d4a6b1
Rename packages (#1367) 2020-10-11 13:54:35 -07:00
Ioannis Mavroukakis f2de47a150
SpanAssert method names should reflect underlying Span method names (#1307) 2020-10-05 16:04:08 +09:00
Anuraag Agrawal dadaac9a8c
Use 2-line license header to match SDK repo (#1321)
* Use 2-line license header to match SDK repo

* Apply change
2020-10-05 14:29:56 +09:00
Nikita Salnikov-Tarnovski 88707c3bb0
Review DB semantic conventions (#1284) 2020-10-01 11:17:09 -07:00
Nikita Salnikov-Tarnovski e74ffe2e52
Remove support for java7 from buildscripts (#1229)
* Remove support for java7 from buildscripts

* Remove support for java7 from buildscripts
2020-09-23 15:40:21 +03:00
Anuraag Agrawal bbfdbb39c0
Create abstraction for library dependencies for instrumentation. (#977)
* Create abstraction for library dependencies for instrumentation.

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

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2020-08-19 08:57:31 +09:00
Anuraag Agrawal 1b9b8b49b6
Separate out testing module for mongo. (#1041)
* Separate out testing module for mongo.

* Newline
2020-08-18 14:55:56 +09:00
Trask Stalnaker 7159d04b8d
Change groovy import order (#1013)
* Update docs

* Format all groovy code

* Organize imports
2020-08-15 23:19:27 -07:00
Trask Stalnaker 414213f2d1
Remove final from parameters (#1003) 2020-08-15 22:35:51 -07:00
Trask Stalnaker f893ca540b
Scripted package renaming (#988) 2020-08-15 21:55:01 -07:00
Helen Y bb235a0aa3
Update package name for tracers (#991) 2020-08-14 21:07:18 -07:00
Trask Stalnaker 7818e33178
Package renaming (#970) 2020-08-13 20:14:46 -07:00
Trask Stalnaker b5fbf90977
Extract instrumentation api module (#884) 2020-08-09 22:52:33 -07:00
Helen Y b659ee8223
Apply new database semantic attributes (#823) 2020-07-28 17:31:33 -07:00
Helen Y 44fcf8115b
Update database semantic conventions (#785) 2020-07-28 11:55:55 -07:00
Helen Y 86c438b154
Remove final from local variables (#732)
* Remove final from local variables
2020-07-20 13:53:34 +09:00
Alexey Zhokhov f3421e91a0
Remove Lombok (#672)
* Gradle 6.5.1.

* Skip download javadoc and sources automatically in IntelliJ IDEA.

* Added mavenLocal to repositories.

* Removed Lombok usage.

* Removed duplicated idea config.

* Code format.

* Removed useless usage of Objects.requireNonNull.

* Use instanceof to comparing objects.

* Code format.

* Code format.

* Fixes after merge.

* Fixed sneakyThrow exception.

* Code format.
2020-07-18 15:52:55 +03:00
Nikita Salnikov-Tarnovski 9f1ffbe38c
Remove attribute `span.origin.type` (#712) 2020-07-16 10:00:45 -07:00
Sergei Malafeev b78abac82c
#598 Rename "tags" to "attributes" (#645) 2020-07-07 21:03:41 -07:00
Nikita Salnikov-Tarnovski a62801649f
More fixes for Gradle warnings (#643)
* More gradle deprecation warnings fixed

* More gradle deprecation warnings fixed

* More fixes

* More fixes

Co-authored-by: Anuraag Agrawal <aanuraag@amazon.co.jp>
2020-07-07 15:02:07 +03:00
Anuraag Agrawal 874b157fe5
Newline between license and package. (#581) 2020-06-25 13:31:16 -07:00
Nikita Salnikov-Tarnovski c1c02ac949
Next attempt to extract common logic from instrumentations. (#523)
* Next attempt to extract common logic from instrumentations.

I tried to reduce code repetition in DB client instrumentations, jdbc and mongo ones. This time I experimented with another approach, different from HttpServerTracer. Namely, I have extracted that common `startSpan` method into `DatabaseClientDecorator` itself. The idea is still the same as before, but I wanted to see if we can migrate by smaller steps, reusing much of the existing code and just incrementally reducing public API.

* Extracted separate Tracer after all

* More explicit call depth handling

* Fix format

* More reusable method overloads
2020-06-17 12:08:52 -07:00
Tyler Benson 1b29184e7c Make rootDir usage consistent (DataDog/dd-trace-java#1518) 2020-06-11 10:14:02 -07:00
Rashmi cfade733b8
Fixed Mongo client double tracing bug (#471)
* Fixes #457

* Addressing review comments
1. Added comments in test
2. Fixed latestDepTest failures in MongoAsyncClient by adding `declaresField`
3. Made TracingCommandListener inline in MongoClientAdvice

Co-authored-by: Nikita Salnikov-Tarnovski <gnikem@gmail.com>
2020-06-04 19:48:05 +03:00
Trask Stalnaker 1f0cd54fd7
Remove copyright year from license header (#322)
* Update template

* Apply template
2020-04-15 11:24:44 -07:00
Trask Stalnaker e8a451cbce
Remove unused service method (#321) 2020-04-15 10:17:04 -07:00
Trask Stalnaker a333cfe536
Remove unused getComponentName (#314) 2020-04-14 13:29:33 -07:00
Trask Stalnaker 4fe685d916
Remove component attribute (#291) 2020-03-29 20:32:19 -07:00
Trask Stalnaker 570fa012c0
Remove service.name attribute (#290) 2020-03-29 20:29:15 -07:00
Trask Stalnaker 2e210683fd
Update to OpenTelemetry API/SDK 0.3.0 (#286)
* Update gradle dependencies and module name

* Replace Tracer.withSpan() with currentContextWith()

* Update inject to 0.3.0

* Update extract to 0.3.0

* More updates

* Remove distributedcontext package refs

* Update OpenTelemetry API interoperability

* No need to call setNoParent()

setParent(SpanContext.getInvalid()) should give the same result.
2020-03-28 19:38:51 -07:00
John Bley 55deb722cf
Populate db.url for MongoDB spans. (#280) 2020-03-24 15:42:03 -07:00
Trask Stalnaker 396baa69d6
Update OpenTelemetry API/SDK (#257)
* Update dependency version

* Change getTracerFactory to getTracerProvider

* Update some imports

* Change put to set

* Fix up bridge

* Update package names

* Update test SpanProcessor

* Remove null conditionals around setAttribute

* Update shading

* Update span context extraction
2020-03-20 14:13:55 -07:00
Trask Stalnaker 8700b2eb33
Remove span.type attribute (#262) 2020-03-20 13:05:00 -07:00
Trask Stalnaker 4921fecdb1
Update instrumentation package names, K-Z (#255) 2020-03-19 22:19:22 -07:00
Trask Stalnaker d70f4ded94
Better span names for mongo (#242) 2020-03-19 14:11:24 -07:00
Trask Stalnaker 18d74daf34
Remove unused code (#252) 2020-03-19 14:08:55 -07:00
Trask Stalnaker 2298885678 Merge tag 'v0.46.0' into dd-merge 2020-03-16 11:25:27 -07:00
Han Zhang 5b1218cdb8
Update instrumentation to be compliant with HTTP semantic conventions (#227)
* Update HTTP client-side span names

* Add query and fragment to  http.url for HTTP client spans

* Add query and fragment to http.url for HTTP server spans

* Update HTTP server span names to be the matched route or resource

* Use net.peer.* instead of peer.* attributes
2020-03-12 18:49:52 -07:00
Trask Stalnaker d3a931384d
Add grouping modules (#220)
* Add mongo grouping module

* Add play and play-ws grouping modules

* Add netty grouping module

* Add jaxrs grouping module

* Add jaxrs-client grouping module

* Add jedis grouping module

* Add log4j grouping module

* Add couchbase grouping module

* Add aws-sdk grouping module

* Add apache-httpclient grouping module
2020-03-10 15:56:41 -07:00
Trask Stalnaker cba031ddcb
Rename hibernate modules (#205)
* Rename hibernate modules

* Update tracer name

* Change from gradle inheritance to composition

This will make it possible to have empty "grouping" modules, e.g.
instrumentation:hibernate.

* Introduce empty hibernate grouping module
2020-03-09 15:33:21 -07:00
Trask Stalnaker 2f1b802aad
Rename mongo modules (#206)
* Rename mongo modules

* Update tracer name
2020-03-05 14:18:45 -08:00
Trask Stalnaker 40e3932358
Add license headers (#188)
* Add spotless gradle plugin

* Add license headers
2020-02-27 13:24:42 -08:00
Trask Stalnaker 4421a84a54
Instrument newer Mongo (sync) API (#174)
* Remove now unnecessary code

* Add instrumentation for newer mongo client api
2020-02-20 14:54:45 -08:00
Trask Stalnaker 215f611673
Update tracer names (#151) 2020-02-11 12:25:09 -08:00
Trask Stalnaker faec4901d2
Set span kind and remove prior "span.kind" attribute (#132)
* Set span kind in instrumentation

* Do not set span kind attribute

* Validate span kind in tests

* Remove unused constants
2020-02-05 15:12:33 -08:00
Trask Stalnaker 2b11b37d0f
Remove trace-api artifact (#116)
* Remove unused Trace annotations

* Remove Trace annotation from benchmark code

* Remove Trace annotation from instrumentation tests

* Remove Trace annotation from smoke tests

* Remove Trace annotation from agent tests

* Remove Trace annotation from testing tests

* Remove Trace annotation from hystrix tests

* Remove Trace annotation from netty tests

* Remove Trace annotation from webflux tests

* Remove Trace annotation from reactor tests

* Remove unnecessary conditional

* Remove Trace annotation from trace annotation instrumentation

* Remove Trace annotation from akka http tests

* Remove Trace annotation from java concurrent tests

* Delete Trace annotation

* Move classes out of trace-api

* Remove trace-api artifact

* Move trace-api classes to better packages
2020-02-01 13:07:51 -08:00
Pontus Rydin d22f38b320
Changed names of getters and removed instrumentationNames() (#112) 2020-01-31 10:33:24 -08:00
Trask Stalnaker 291c974e9c
Change grizzly, mongo, sparkjava, spring-data, jetty, jsp, kafka-clients, lettuce to use OpenTelemetry API directly (#108)
* Convert Grizzly to use OpenTelemetry API directly

* Convert Mongo to use OpenTelemetry API directly

* Convert SparkJava to use OpenTelemetry API directly

* Convert Spring Data to use OpenTelemetry API directly

* Convert Jetty to use OpenTelemetry API directly

* Convert JSP to use OpenTelemetry API directly

* Convert Kafka Clients to use OpenTelemetry API directly

* Convert Lettuce to use OpenTelemetry API directly
2020-01-30 14:37:23 -08:00
Trask Stalnaker 819ca7c256
Simplify directory/module structure (#77)
* Move things up a directory

* Scripted mass update

find -type f -name "*.gradle" | xargs sed -i 's/:java-agent:/:/g'

* Remove plugin version now that it's in root module

* Update java-agent and instrumentation configs

* Misc
2020-01-22 13:55:47 -08:00