Commit Graph

2107 Commits

Author SHA1 Message Date
Nikolay Martynov fd58187994 Support JFR profiling 2020-02-11 14:55:19 -05:00
Laplie Anderson 9023c6e1c7 Fix a couple tests using the wrong arguments 2020-02-11 11:44:46 -05:00
Laplie Anderson 01b0bebc93 minor formatting 2020-02-11 11:44:46 -05:00
Laplie Anderson 0cb0ae0a48 Less repetition in gradle files 2020-02-11 11:44:46 -05:00
Laplie Anderson c79fe3a459 Create shared internal jar 2020-02-11 11:44:46 -05:00
Laplie Anderson 3c0877e38a Create a shared parent classloader 2020-02-11 11:42:39 -05:00
Tyler Benson 032f22f5a6
Reduce tracer thread count by combining scheduled executors int… (#1200)
Reduce tracer thread count by combining scheduled executors into a single executor.
2020-02-11 08:18:59 -08:00
Tyler Benson 51bffa2e8a Move agent api classes to bootstrap package so they're not analyzed by muzzle
Also move jdbc classes to bootstrap to reduce size and complexity of those reference checkers.

These changes reduce the total file size of these instrumentation classes by 635k, which should also result in decent memory savings.
2020-02-10 15:09:15 -08:00
Tyler Benson 486d98135e Code review changes 2020-02-10 11:37:36 -08:00
Tyler Benson e5980d4812 Fix muzzle 2020-02-10 10:45:58 -08:00
Tyler Benson 75c7769192 Reduce tracer thread count by combining scheduled executors into a single executor.
Pulls out utility classes for reuse by other projects.

This also meant the dependency had to be bundled with dd-trace-ot since it isn't published as a separate dependency.
2020-02-10 10:45:58 -08:00
heathkd 7e62bca7fe limit hibernate latest dependency test to 5.x 2020-02-07 17:57:34 -05:00
Lev Priima 5265a43c6d Reduce use of Thread::setContextClassLoader 2020-02-06 22:53:04 -05:00
Tyler Benson 14b5576cd8
Merge pull request #1201 from DataDog/tyler/upgrade-okhttp
Upgrade OkHttp client to 3.12.8
2020-02-04 15:55:36 -08:00
Tyler Benson cab139e905 Upgrade OkHttp client to 3.12.8 2020-02-04 15:06:44 -08:00
Laplie Anderson a811c027ce
Merge pull request #1188 from DataDog/landerson/finatra
Finatra Instrumentation
2020-02-04 17:36:47 -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
Douglas Q Hawkins 53d32b4324
Merge pull request #1189 from DataDog/dougqh/type-caching2
Revised type cache
2020-01-30 18:47:02 -05:00
Laplie Anderson ed12af6994 Assume parent span is netty 2020-01-30 18:21:49 -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
Laplie Anderson 37a279069b Add server tests 2020-01-30 15:23:26 -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
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
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
Laplie Anderson 8ff985afdb Cleaner way to skip netty executor's tasks 2020-01-23 12:04:56 -05: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
Laplie Anderson 68e52497d6 Move to versioned folder name 2020-01-23 10:51:38 -05:00
dougqh 17af9b752c Fix typo in test name 2020-01-23 10:40:48 -05:00
Nikolay Martynov 950389587c Simplify groovy/scala/kotlin compile dependency hack 2020-01-23 09:40:15 -05:00
Laplie Anderson 4e58643bd0 Initial finatra instrumentation 2020-01-22 18:09:10 -05:00
Tyler Benson f9e43516ad Set timeouts on individual tests and increase overall test timeout. 2020-01-22 09:06:03 -08:00
Laplie Anderson 64ed09d76c
Merge pull request #1179 from DataDog/landerson/internal-jar-memory
Use streams directly in DatadogClassLoader
2020-01-16 10:51:42 -05:00
Laplie Anderson 6766e12597
Merge pull request #1173 from DataDog/landerson/weakmap-computeifabsent
Synchronized audit: WeakMap computeIfAbsent
2020-01-15 14:51:29 -05:00
Laplie Anderson 607c8f277e Don't copy to byte[], return input stream directly 2020-01-15 13:38:44 -05:00
Laplie Anderson 68ed1da9c6 Don't call `map.get()` in the `put(..)` case 2020-01-15 12:41:01 -05:00
Laplie Anderson a0b1cd4a75 WeakMap computeIfAbsent 2020-01-15 12:26:15 -05:00
Tyler Benson e31cbd6c89 Add Builder to DDTracer
Deprecate previous constructors.
2020-01-14 17:44:34 -08:00