Commit Graph

3893 Commits

Author SHA1 Message Date
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 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
Laplie Anderson 4e58643bd0 Initial finatra instrumentation 2020-01-22 18:09:10 -05: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
Tyler Benson b7d599d82f
Merge pull request #1182 from DataDog/tyler/decorator-disable-case-insensitive
Check for both regular and lowercase names with decorator enabled flags.
2020-01-17 12:29:52 -08:00
Tyler Benson 5cce4cb783 Replace DDAgentWriter.Spec with a proper Builder.
Also rename the builder class on DDTracer to default name generated by Lombok.
2020-01-17 11:10:11 -08:00
Tyler Benson a280ae6b7f Check for both regular and lowercase names with decorator enabled flags. 2020-01-17 11:05:44 -08:00
Laplie Anderson 70c874b135
Merge pull request #1181 from DataDog/landerson/sampling-variable
Rename Rule Based Sampling properties
2020-01-16 13:17:39 -05:00
Laplie Anderson e24d04e3a5 changes to config test 2020-01-16 12:02:21 -05:00
Laplie Anderson bed15079bc Rename Rule Based Sampling properties 2020-01-16 11:38:38 -05: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
Tyler Benson 3aea763769 Remove test race condition 2020-01-15 16:13:44 -08:00
Tyler Benson a4db31cf79 Apply `_sample_rate` metric to allow dd-agent to do proper scaling of metrics when traces are sampled. 2020-01-15 16:13:44 -08:00
Tyler Benson 5ff855737b Add documentation, remove volatile/public, improve test reliability. 2020-01-15 16:13:44 -08:00
Tyler Benson 451fba256a Split TraceConsumer into two different disruptors
First disruptor (TraceProcessingDisruptor) does processing, which is currently limited to serialization, but in the future can do other processing such as TraceInterceptor invocation.
Second disruptor (BatchWritingDisruptor) takes serialized traces and batches them into groups and flushes them periodically based on size and time.
2020-01-15 16:13:44 -08: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
Tyler Benson bcf81823b3 Add limit to trace scope depth
When limit is exceeded, a NoopScope is returned.
Allow custom ScopeManager to be provided, with the plan to remove `ScopeContext` customization in the future.
2020-01-15 11:51:06 -08:00
Tyler Benson d8bf99555f
Merge pull request #1174 from DataDog/tyler/ddtrace-builder
Add Builder to DDTracer
2020-01-15 11:49:46 -08:00
Tyler Benson b3328398e5
Merge pull request #1176 from DataDog/tyler/muzzle-https
Update muzzle maven URL to use https
2020-01-15 11:43:52 -08:00
Tyler Benson 4915ed9c75 Update muzzle maven URL to use https
Also add a test.
2020-01-15 11:22:10 -08: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
Tyler Benson 075ecb9f37 Lazy init Writer from config to avoid premature resource allocation. 2020-01-15 09:37:07 -08:00
Laplie Anderson a0b1cd4a75 WeakMap computeIfAbsent 2020-01-15 12:26:15 -05:00
Laplie Anderson 03c9bd5db8
Merge pull request #1175 from DataDog/landerson/bytebuddy-10.6
Update bytebuddy to 1.10.6
2020-01-15 12:23:21 -05:00
Laplie Anderson e351ce523c Update bytebuddy to 1.10.6 2020-01-15 10:40:46 -05:00
Tyler Benson e31cbd6c89 Add Builder to DDTracer
Deprecate previous constructors.
2020-01-14 17:44:34 -08:00
Tyler Benson e05c892271 Begin 0.42.0 2020-01-14 11:11:06 -08:00
Tyler Benson 7fabcaaecb Version 0.41.0 2020-01-14 10:48:14 -08:00
Tyler Benson a52a1420db
Merge pull request #1165 from DataDog/tyler/servlet
Add servlet integrations for request and response dispatch back in.
2020-01-13 13:17:29 -08:00
Tyler Benson d42e72b683
Merge pull request #1171 from DataDog/tyler/bb-filter
Remove more declared method filtering for optimization
2020-01-13 13:05:28 -08:00
Tyler Benson ef6cd9c52c
Merge pull request #1170 from DataDog/tyler/couchbase
Adjust version compatibility to only 2.x
2020-01-13 13:04:57 -08:00