Commit Graph

368 Commits

Author SHA1 Message Date
Nikolay Martynov fd58187994 Support JFR profiling 2020-02-11 14:55:19 -05:00
Tyler Benson 486d98135e Code review changes 2020-02-10 11:37:36 -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
Tyler Benson 66400c9b37 Fix NPE on serialization with no span type
Add tests.
2020-02-07 15:58:49 -08:00
Cécile Terpin 25ddcd434b Merge branch 'master' into cecile/setError 2020-02-06 17:03:33 +01:00
Cécile Terpin d095978223 Fix setError 2020-02-06 17:02:17 +01:00
Tyler Benson cab139e905 Upgrade OkHttp client to 3.12.8 2020-02-04 15:06:44 -08:00
Tyler Benson 697d4972a8 Remove Jackson from dd-trace-ot
Reduced the size of dd-java-agent jar by about 2 MB. Jackson is not removed completely though as it is still a dependency of jmxfetch.

Trace serialization is primarily done directly with msgpack.
Response deserialization and LoggingWriter serialization is done with mochi.

Msgpack Serialization buffer still not being reused though.
2020-01-31 15:59:43 -05:00
Tyler Benson 406b324a82
Split TraceConsumer into two different disruptors (#1161)
Split TraceConsumer into two different disruptors
2020-01-31 15:41:14 -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 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 bed15079bc Rename Rule Based Sampling properties 2020-01-16 11:38:38 -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
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 075ecb9f37 Lazy init Writer from config to avoid premature resource allocation. 2020-01-15 09:37:07 -08:00
Tyler Benson e31cbd6c89 Add Builder to DDTracer
Deprecate previous constructors.
2020-01-14 17:44:34 -08:00
Tyler Benson 0a89f2a57c Extract DDAgentResponseListener from DDApi.
Reduce references to DDApi
2019-12-20 14:49:31 -08:00
Tyler Benson 24e2fe6da7 Move DDApi and rename to DDAgentApi
Reduce visibility back to what it was before refactoring.
2019-12-20 14:36:45 -08:00
Tyler Benson 84f9d80258 Extract TraceSerializingDisruptor class from DDAgentWriter 2019-12-20 14:22:32 -08:00
Tyler Benson 97ed587547 Extract TraceConsumer from DDAgentWriter
Unfortunately this required making some things public that were previously private or package visible.  I expect this to be temporary.
2019-12-20 14:17:33 -08:00
Tyler Benson 8fdd30d3ed Make TraceConsumer a static class 2019-12-20 13:41:09 -08:00
Tyler Benson 2ea76494f8 Extract DisruptorEvent and EventTranslator classes from DDAgentWriter 2019-12-20 13:40:38 -08:00
Tyler Benson 6e57041a6a Extract Monitor classes from DDAgentWriter 2019-12-20 12:09:14 -08:00
Laplie Anderson 7920a25b7e
Merge pull request #1152 from DataDog/landerson/decorator-flag
Disable decorators via config
2019-12-20 11:09:21 -05:00
Tyler Benson ad22bd9cfc
Merge pull request #1150 from DataDog/tyler/fix-disruptor-shutdown
Allow flush to return if executor already shut down
2019-12-19 16:12:02 -08:00
Laplie Anderson 712a5c1483 Disable decorators via config 2019-12-19 13:02:59 -05:00
Tyler Benson 25d0d98dff Allow flush to return if executor already shut down
Otherwise it could block shutdown if executor is stopped before disruptor.
2019-12-18 14:23:46 -08:00
Tyler Benson 31b77cbd7b Capture error message even if no exception object provided.
This is currently only used by the GoogleHttpClient instrumentation, but may be used by customers too.
2019-12-18 13:49:24 -08:00
Douglas Q Hawkins 7b2c2e8c78
Merge pull request #1125 from DataDog/dougqh/service-decorator-ordering
Ordering inconistency with DDSpanBuilder.withTag
2019-12-12 10:33:07 -05:00
Douglas Q Hawkins e9e3b375b9
Merge pull request #1132 from DataDog/dougqh/bounded-sender-queue
Restricting sender queue size
2019-12-12 10:30:59 -05:00
dougqh ec27930d26 Ordering inconistency with DDSpanBuilder.withTag
Pior to this change, DDSpanBuilder.withTag behaves different than DDSpan.setTag when decorators are triggered.

Specifically builder.withTag(a, val).withTag(b, val) can behave differently than span.setTag(a, val); span.setTag(b, val)

This change makes a small step towards determinism by changing the HashMap inside DDSpanBuilder into a LinkedHashMap.  That guarantees the tags from withTags translated to the same sequence of setTag calls.

NOTE: Even with this change, there are inconsistencies when tags are removed or set to an empty value.
2019-12-11 20:11:58 -05:00
dougqh e604d9164c Adding monitor call back on interrupt
Adding call to monitor.onFailedSend in case senderSemaphore acquisition is interrupted during shutdown
2019-12-11 14:29:09 -05:00
Cecile terpin 073e4bbed5
Empty proc file is not an error
Empty proc file is not an error
2019-12-11 16:35:42 +01:00
Cecile terpin ce0d09f04a
AllowUstoGetContainerInfoOnDocker
Tested on docker. Although "/proc/self/cgroup" file is not empty, "/proc/self/cgroup".toFile().length() returns 0
as does Files.size("/proc/self/cgroup").
2019-12-11 14:27:23 +01:00
dougqh c614df7382 Lowering expectedRejects to account for timing variance in test 2019-12-10 16:11:56 -05:00
dougqh aa54dab853 Switching forEach -> each to fix Java 7 2019-12-10 16:11:56 -05:00
dougqh 53eacfdc79 Improving test reliability
Improving the reliability of the slow sender test.

Still needs work, but to make this truly reliable, I'd need to add to the DDAgentWriter API.  I'll probably do that, but I'm trying to start with sticking to the existing API.
2019-12-10 16:11:56 -05:00
dougqh 7883366b83 Restricting sender queue size
To prevent unbounded memory consumption, restricting the size of the sender queue.  Also, lowering the size of the Disruptor queue.

Unfortunately, our choice of a ScheduledExecutorService makes this a bit difficult, since ScheduledExecutorService doesn't allow us to supply the queue.

A bigger change is in-order but for now, this change restricts the queue size by introducing a Semaphore around the ScheduledExecutorService.

In effort to making testing easier, I introduced Monitor.onFlush.  This is used in the new slow response test which attempts to simulate a situation where the sending queue would back up.
2019-12-10 16:11:56 -05:00
Laplie Anderson 83e78fb8f0 Rename KnuthSampler to DeterministicSampler 2019-11-22 13:53:47 -05:00
Zachary Groves c4cebc30c8
Merge pull request #1097 from DataDog/ZStriker19/remove_duplicate_okhttp_span_and_okhttp_separate_service
Remove duplicate Okhttp span and stop separate service creation of ok…
2019-11-20 17:01:18 -06:00
Laplie Anderson 5ff2fcaa63 Fix tests, increase code coverage, codenarc 2019-11-18 23:39:03 -05:00
Laplie Anderson 9d850b8ef5 Default sampler priority is null 2019-11-18 17:21:17 -05:00
Laplie Anderson 3144d02615 Tests around PrioritySampling 2019-11-18 16:44:48 -05:00
Laplie Anderson bd11d7222e Remove reliance on toString() in tests 2019-11-18 14:59:38 -05:00
Laplie Anderson a0d5238214 Add tests for rules 2019-11-18 14:58:55 -05:00
Laplie Anderson 0c22e27f66 Config and builder 2019-11-18 12:04:22 -05:00