Commit Graph

3715 Commits

Author SHA1 Message Date
Pontus Rydin bec7775d56
Fixed error handling when Java version can't be determined (#118)
* Fixed error handling when Java version can't be determined

* Made build getJavaExecutableVersion more resilient to output variations
2020-02-03 12:38:21 -08:00
Tyler Benson 37b314fa0c
Merge changes from dd-trace-java 0.42.0 (#119)
Merge changes from dd-trace-java 0.42.0
2020-02-03 15:06:48 -05:00
Trask Stalnaker 147b42d1ff Merge tag 'v0.42.0' 2020-02-01 13:28:58 -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 49e6309cf9
Experimental Jaeger integration (#115)
* Added simple exporter

* Updated config prefix
2020-02-01 12:22:25 -08:00
Brian Devins-Suresh f78b34fd9d Version 0.42.0 2020-01-31 14:33:50 -05:00
Pontus Rydin d22f38b320
Changed names of getters and removed instrumentationNames() (#112) 2020-01-31 10:33:24 -08:00
Brian Devins-Suresh 848476316d
Merge pull request #1196 from DataDog/tyler/fix-span-attribute
Set dispatcher span on request instead of clear
2020-01-31 13:26:33 -05:00
Tyler Benson daae198b08 Set dispatcher span on request instead of clear
Clearing the span caused traces to be broken up and reported independently when calling forward/include.
2020-01-30 21:55:16 -05:00
Trask Stalnaker 2d3132e9b8
Convert Trace Annotations and tests to use OpenTelemetry API directly (#110)
* Fix Dropwizard conversion to OpenTelemetry API

* Finish converting JDBC to use OpenTelemetry API directly

* Finish converting Servlet to use OpenTelemetry API directly

* Convert Trace Annotation to use OpenTelemetry API directly

* Convert tests to use OpenTelemetry API directly
2020-01-30 15:51:14 -08:00
Douglas Q Hawkins 53d32b4324
Merge pull request #1189 from DataDog/dougqh/type-caching2
Revised type cache
2020-01-30 18:47:02 -05:00
dougqh faeb069424 Adjusting capacity check again 2020-01-30 18:08:49 -05:00
dougqh 235a6470fb googleJavaFormat 2020-01-30 17:45:40 -05:00
dougqh 0f095f0adb Final clean-up
- Removed unused method from earlier version
- Corrected previously overlooked comments that were remnant of prior version
2020-01-30 17:44:24 -05: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
Pontus Rydin feb21ab295
Refactored jedis-* (#113) 2020-01-30 11:31:32 -08:00
Trask Stalnaker e4b8c579b2
Change netty-*, play-*, rabbitmq, ratpack, rmi, jms instrumentation to use OpenTelemetry API directly (#102)
* Fix gRPC conversion to OpenTelemetry API

* Fix Akka conversion to OpenTelemetry API

* Convert JMS to use OpenTelemetry API directly

* Convert Netty 4.0 to use OpenTelemetry API directly

* Convert Netty 4.1 to use OpenTelemetry API directly

* Convert Play 2.4 to use OpenTelemetry API directly

* Convert Play 2.6 to use OpenTelemetry API directly

* Convert Play WS 1 to use OpenTelemetry API directly

* Convert Play WS 2 to use OpenTelemetry API directly

* Convert Play WS 2.1 to use OpenTelemetry API directly

* Convert RabbitMQ to use OpenTelemetry API directly

* Convert Ratpack to use OpenTelemetry API directly

* Convert RMI to use OpenTelemetry API directly
2020-01-29 11:19:23 -08:00
Tyler Benson 8757ba0a81
Fix potential StackOverFlowError on regexp (#1193)
Fix potential StackOverFlowError on regexp
2020-01-29 13:19:40 -05:00
Blinkingor 8d83172128 clazz -> segment rename 2020-01-29 18:41:29 +01:00
Blinkingor db485d10da final configString 2020-01-28 16:20:02 +01:00
Blinkingor 811051d111 Remove overlapping tests and fix failing unit test 2020-01-28 16:06:23 +01:00
Blinkingor 10b963d277 Codenarc fixes 2020-01-28 15:35:39 +01:00
Blinkingor cf876b5e67 Fix import order 2020-01-28 15:21:50 +01:00
Blinkingor 1e390984c1 Fix potential StackOverFlowError on regexp 2020-01-28 10:28:37 +01:00
dougqh 176f826a44 Adjusting approximateSize check to be more reliable 2020-01-27 17:44:39 -05:00
dougqh 4c7a0ba7a7 Fixing muzzle?
MuzzlePlugin groovy checks that no threads are spawned because this holds the ClassLoader live.

This was breaking with the caching change because the cache no longer uses the Cleaner service.

This caused a problem because the Thread behind the cleaner is created lazily when the first task is created, but without the cache the creation was delayed.

To solve this, I addressed the original cause of the leak.  The newly created Thread automatically inherits the contextClassLoader of its parent, but that's unnecessary for a cleaner thread.

So I changed the ThreadFactory for cleaner to explicitly null out the contextClassLoader.

We should probably null out contextClassLoader in other thread factories and also reduce our use of contextClassLoaders in general, but that will left to another PR.
2020-01-27 17:14:17 -05:00
Trask Stalnaker 068823c55e
Set SpanKind for servlet requests (#88) 2020-01-27 11:49:09 -08:00
Trask Stalnaker 26355485d9
Move OpenTelemetry SDK out of the bootstrap loader (#86)
* Move OpenTelemetry SDK out of bootstrap loader

* Improve shading

After this change, the shaded opentelemetry-sdk is only used by test
modules, so it doesn't need to be published.
2020-01-27 11:11:05 -08:00
dougqh d50f901f39 googleJavaFormat, codeNarcTest, and test reliability 2020-01-27 12:34:39 -05:00
dougqh fb871611b5 Replacing ID generation with WeakReference reuse
First pass at replacing ID generation with WeakReference reuse

In this first version, the Cache<ClassLoader, ID> was replaced with Cache<ClassLoader, WeakReference<ClassLoader>>.

The core cache is still of Cache<TypeCacheKey, TypePool.Resolution> and TypeCacheKey logically remains a composite key of ClassLoader, class name.

The removal of ID assignment means ID exhaustion is no longer na issue, so there's never a need to rebuild the cache.  For that reason, CacheInstance has removed and the core caching logic has been moved into DDCachingPoolStrategy.

While TypeCacheKey remains conceptually the same, the internals have changed somewhat.  The TypeCacheKey now has 3 core fields...
- loaderHash
- loadeRef
- class name

Since loader refs are recycled, the fast path for key equivalence can use reference equivalence of the reference objects.

This change ripples through the CacheProvider-s which also have to store loaderHash and loaderRef.

It may be worth going a step further and switching to a Cache<Loader, TypePool> as well.  That still avoid the creation of many WeakReference-s, since the underlying CacheProvider will hold a canonical WeakReference per ClassLoader.
2020-01-27 12:03:44 -05:00
dougqh cf877f67e5 Working around muzzle quirk
Muzzle doesn't like creation of SecureClassLoader-s, so switching to a URLClassLoader for my placeholder loader in tests
2020-01-27 09:47:36 -05:00
Pontus Rydin 80379fb50b Refactored jax-rs-client-* and jdbc instrumentation (#94)
* jax-rs-client refactor WIP

* Refactored jax-rs-client-1.1

* Refactored jax-rs-client-* and jdbc
2020-01-24 15:45:02 -08:00
Brian Devins-Suresh 660041636a
Merge pull request #1190 from DataDog/devinsba/hibernate-null-entity-check
Add null check to hibernate decorator
2020-01-24 14:55:11 -05:00
Brian Devins-Suresh 3daad0009d Add null check to hibernate decorator 2020-01-24 10:58:52 -05:00
Pontus Rydin 88957e9ab6 Refactored http-url-connection, java-concurrent, jax-rs-annotation-* (#87)
* Refactor of twilio (WIP)

* Refactored http-url-connection

* Refactored java-concurrent

* Refactored jax-rs-annotation-1

* Refactored jax-rs-annotations-2 instrumentation
2020-01-23 13:08:49 -08:00
Trask Stalnaker ee58416dae
Fix sporadic test failures (#82)
* Fix sporadic test failure

* Remove RetryOnFailure from Elasticsearch tests

* Remove retry from Hystrix tests

* Improve test verification

* Fix sporadic span order not found failures

* Add RetryOnFailure to tests with sporadic failures
2020-01-23 11:37:38 -08:00
dougqh 984d77e44c googleJavaFormat & codeNarc 2020-01-23 11:15:39 -05:00
dougqh 726236bd64 Type cache overhaul
This change overhauls the core type cache

The new approach aims to achieve several things...
1 - cache is strictly bounded -- no variance for number of classes of ClassLoaders
2 - cache is significantly smaller
3 - cache doesn't compromise start-up time
4 - primary eviction policy isn't driven by time
5 - primary eviction policy isn't driven by GC

There are some slight compromises here.
In practice, start-up does increase slightly in a memory rich environment; however, start-up improves considerably in a memory poor environment.

The basic approcach is to have a single unified Guava cache for all ClassLoaders -- nominally keyed a composite of ClassLoader & class name

The ByteBuddy CacheProvider are simply thin wrappers around the Guava cache associated to a particular ClassLoader

However rather than having a large number of WeakReferences floating around.  The cache assigns an ID to each ClassLoader.

To further avoid, consuming memory the cache only preserves a small map of Loader / ID assignments.  This means a ClassLoader may have more than one active ID.

This introduce the possibility for ID exhaustion.  That unlikely case is handle by retiring the internal CacheInstance and starting anew.
2020-01-23 10:55:16 -05:00
dougqh 17af9b752c Fix typo in test name 2020-01-23 10:40:48 -05:00
Nikolay Martynov ad46239009
Merge pull request #1186 from DataDog/mar-kolya/update-gradle
Update gradle
2020-01-23 10:33:20 -05:00
Nikolay Martynov 950389587c Simplify groovy/scala/kotlin compile dependency hack 2020-01-23 09:40:15 -05:00
Nikolay Martynov be6a7730bf Update kotlin version 2020-01-23 09:40:15 -05:00
Nikolay Martynov 53026932a8 Update task tree plugin 2020-01-23 08:39:17 -05:00
Nikolay Martynov bc72b9271a Update gradle to 6.1 2020-01-23 08:39:06 -05:00
Pontus Rydin f53167063e Refactored Twilio and Hibernate instrumentation (#81)
* Refactor of twilio (WIP)

* Refactored hibernate instrumentation

* Finished refactoring hibernate instrumentation

* Minor changes

* Minor change

* Moved files after upstream restructuring

* Fixed typo and Twilio test issues

* Refactored hibernate tests

* Fixed formatting

* Moved span auto close functionality to SessionState
2020-01-22 21:01:49 -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
Pontus Rydin b6b425c8a9 Refactored servlet instrumentation and dependents (#75)
* Refactored servlet-2

* Servlet instrumentation WIP

* Formatting

* Finished refactoring of spring-webmvc

* Formatting

* Refactored reactor-core

* Refactored spring-webflux

* Added merged files

* Fixed agent_tooling testing to work with refactored code

* Removed some debug printlns

* Added helperClasses to reactor-core instrumentation

* Addressed maintainer comments

* Fixed negated contidion

* Update java-agent/instrumentation/spring-webflux-5/src/main/java8/io/opentelemetry/auto/instrumentation/springwebflux/client/TracingClientResponseMono.java

Co-Authored-By: Trask Stalnaker <trask.stalnaker@gmail.com>

* Update java-agent/instrumentation/reactor-core-3.1/src/main/java8/io/opentelemetry/auto/instrumentation/reactor/core/FluxAndMonoSubscribeAdvice.java

Co-Authored-By: Trask Stalnaker <trask.stalnaker@gmail.com>

* Update java-agent/instrumentation/spring-webmvc-3.1/src/main/java/io/opentelemetry/auto/instrumentation/springweb/DispatcherServletInstrumentation.java

Co-Authored-By: Trask Stalnaker <trask.stalnaker@gmail.com>

* Update java-agent/instrumentation/spring-webflux-5/src/main/java8/io/opentelemetry/auto/instrumentation/springwebflux/client/TracingClientResponseSubscriber.java

Co-Authored-By: Trask Stalnaker <trask.stalnaker@gmail.com>

* Update java-agent/instrumentation/servlet/request-2/src/main/java/io/opentelemetry/auto/instrumentation/servlet2/Servlet2Advice.java

Co-Authored-By: Trask Stalnaker <trask.stalnaker@gmail.com>

* Update java-agent/instrumentation/spring-webflux-5/src/main/java8/io/opentelemetry/auto/instrumentation/springwebflux/client/TracingClientResponseSubscriber.java

Co-Authored-By: Trask Stalnaker <trask.stalnaker@gmail.com>

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2020-01-22 13:30:02 -08:00
Tyler Benson 5c6f74fd5e
Merge pull request #1177 from DataDog/tyler/scope-depth-limit
Add limit to trace scope depth
2020-01-22 12:13:23 -08:00
Tyler Benson 08e24bf3b6
Merge pull request #1184 from DataDog/tyler/test-timeout
Set timeouts on individual tests and increase overall test timeout.
2020-01-22 09:38:58 -08:00
Tyler Benson f9e43516ad Set timeouts on individual tests and increase overall test timeout. 2020-01-22 09:06:03 -08:00