Commit Graph

232 Commits

Author SHA1 Message Date
Tyler Benson ea0dedcee7 Allow setting dd.app.customlogmanager=false to disable jboss check 2019-01-31 10:53:20 -08:00
Tyler Benson ee8a26d4dc Replace jboss classpath check with ENV check for jmxfetch delay
Some applications seem to have this jboss class on the classpath, but don’t actually use it.  When coupled with not actually using JUL, this means that we may never actually start JMXFetch.

Checking for JBOSS_HOME instead should be safer.
2019-01-31 10:42:43 -08:00
Tyler Benson bb2fbb30b8 Add logging to JMXFetch initialization delay
Otherwise it’s difficult to determine why JMXFetch isn’t being initialized.
2019-01-30 10:39:29 -08:00
Tyler Benson 03bcdc97cc Move awaitGC to common utility package 2019-01-25 10:32:09 -08:00
Nikolay Martynov 04fbb5085f Improve OSGi class loader instrumentation
It turns out that Eclipse's OSGi implementation has two problems:
* It doesn't respect system properties by default
* It has tricky classloader implementation that loads bootstrap
  classes from the classloader-has-delegation-to-bootstrap check but
  doesn't load bootstrap classes from 'normal' code.

This should address second problem and make Eclipse's OSGi
implementation 'safe' by default.
2019-01-25 08:52:07 -05:00
Andrew Kent af306f376b Comments explaining jmxfetch delay 2019-01-18 10:56:21 -08:00
Andrew Kent 097c557651 Delay jmxfetch init when custom log manager is used by client's app 2019-01-16 12:18:29 -08:00
Andrew Kent 4c4b12e1d6 Expand custom logman tests to handle three different logman cases 2019-01-16 10:06:41 -08:00
Andrew Kent 3295739e28 Fix race conditions in custom log manager test
Fix two race conditions in the custom log manager test.

- Remove possibility of false positives by blocking until jmx thread
  sends statsd metrics
- Disable logging in test to avoid deadlock in jmxfetch which can
  occur when the JVM shuts down too quickly
2019-01-16 08:57:59 -08:00
Tyler Benson 6a09f6e2b9 Moves all ittests to be tests under dd-java-agent.
This was weird having it as a separate project.  Reduces the number of top level directories.

There weren’t any existing tests in dd-java-agent’s test directory, so this seemed like a good place to put them.
2019-01-04 15:25:36 -08:00
Nikolay Martynov 403040bac0 Use JMXFetch as a library 2018-10-18 09:46:44 -04:00
Tyler Benson 51919a77bb Apply formatter on java files. 2018-07-31 12:07:43 +10:00
Nikolay Martynov c844501bc5 Fixes for some minor checkstyle complaints 2018-07-23 10:04:53 -04:00
Tyler Benson 12a2fce96d Upgrade java formatter version. 2018-07-19 14:10:53 +10:00
Andrew Kent 84fe1fc0e3 Organize bootstrap and agent classes by known prefix. 2018-03-15 12:17:03 -07:00
Andrew Kent 4a1db505db Enhance logging and cleanup. 2018-02-15 19:17:19 -08:00
Andrew Kent a692d42d3c Move DatadogClassloader to bootstrap 2018-02-15 19:17:19 -08:00
Andrew Kent a28a7abd4e Run api classes on bootstrap and core agent on custom classloader 2018-02-15 19:17:19 -08:00
Andrew Kent cfef64b026 Reorganize dd-java-agent subprojects 2018-02-15 18:55:02 -08:00
Tyler Benson c9da16f334 Add resource naming instrumentation for jax-rs 2018-02-14 19:18:01 +10:00
Andrew Kent d703095717 Patch getLogger calls to safe logger. 2018-02-04 12:09:11 -08:00
Andrew Kent 6f088ddd53 Remove trace decorator yaml config 2018-01-31 16:13:41 -08:00
Andrew Kent 8d53e4703d Set span.type for all integrations. 2018-01-31 16:13:41 -08:00
Andrew Kent 228f896bb6 Move default decorators to code 2018-01-31 13:18:28 -08:00
Tyler Benson 6d3d88987b Rename dd-trace-annotations to dd-trace-api
And move DDTags over to it.
Move some `datadog.trace.api` classes over to `datadog.trace.common`.
Other misc renaming.
2018-01-09 10:07:36 +10:00
Tyler Benson becf2a5862 Lots of renaming
Module:
dd-trace -> dd-trace-ot

Packages:
Standardize on `datadog.trace` and `datadog.opentracing` as the package prefixes.
2018-01-09 10:02:06 +10:00
Tyler Benson eeb17c4522 Move @Trace and JDBC instrumentation to individual modules 2018-01-04 16:20:26 +10:00
Andrew Kent 9d79531f59 Move bytebuddy agent setup into tooling 2017-12-28 09:46:08 -08:00
Tyler Benson 02460060bc Misc cleanup
Remove out of date “async-tracing” example since it’s more about byteman and no longer relevant.

Minor changes to improve the code test coverage…
2017-12-21 16:31:03 -08:00
Tyler Benson 4822c19c5d Remove legacy config references. 2017-12-21 16:28:18 -08:00
Andrew Kent 75edd2bee4 Initialize AgentVersion classes in global tracer init 2017-12-19 16:00:03 -08:00
Andrew Kent f5ecd47379 Remove dead code 2017-12-19 09:06:38 -08:00
Andrew Kent e9b6f5278d Initialize GlobalTracer in TracingAgent 2017-12-19 09:06:38 -08:00
Andrew Kent f68406113a Remove helpers from agent 2017-12-18 16:44:12 -08:00
Andrew Kent 9d933d2109 Skip c3p0 proxy classes. 2017-12-11 08:17:59 -08:00
Andrew Kent 95550ac9d6 Save connection info after connection construction. 2017-12-11 08:17:59 -08:00
Andrew Kent b231306f57 init global tracer in premain 2017-12-08 16:56:43 -08:00
Andrew Kent 42832e77f5 Add agent's classloader to default instrumentation location strategy
The transformer needs the agent's classloader to resolve advice
classes at transform time. Also stop using reflection to register classloads.
2017-12-08 09:40:14 -08:00
Andrew Kent 6a646009fa Test system class sibling classloader
Test cases where the classloader of the instrumented class cannot
resolve agent advice classes.
2017-12-08 09:34:16 -08:00
Andrew Kent 34791bbdbf Move common instrumentation advice settings into DDAdvice 2017-12-08 09:34:16 -08:00
Tyler Benson 6f985c15bf Remove Byteman now that instrumentation is migrated
At some point, we should refactor the managers since this leaves them in an awkward state.
2017-12-07 13:11:26 -08:00
Tyler Benson d933a4049a Move OkHttp instrumentation to byte buddy 2017-12-06 18:07:17 -08:00
Andrew Kent 6fa303058f ApacheHttpClient bytebuddy instrumentation and tests. 2017-12-01 10:54:32 -08:00
Andrew Kent 7298b0a31a Convert datastax cassandra instrumentation to bytebuddy 2017-11-28 17:01:04 -08:00
Andrew Kent 86a76ec588 Convert Mongo instrumentation to ByteBuddy 2017-11-27 09:18:49 -08:00
Tyler Benson 871ce37f80 Migrate JMS to Byte Buddy and add JMS 1 support
This does not yet include instrumentation for MessageListener.
I think there is actually no difference between the instrumentation so we should combine them.
I also added TEXT_MAP as a format that maps to the HTTP Codec.  There is some remapping inside the instrumentation to remove dashes before setting as a property.  This should also be changed when an official format is defined.

This also currently has a problem with Spring Boot applications as the JMS Util references classes not on the system classpath (it needs to be injected into the child classpath)
2017-11-17 12:06:30 -08:00
Andrew Kent dd8f71e164 MongoHelper query scrubber test 2017-11-13 10:34:07 -05:00
Andrew Kent 9cb097b783 Replace TracingCommandListener with DDTracingCommandListener 2017-11-13 10:34:07 -05:00
Tyler Benson 66355feddb
Merge pull request #148 from DataDog/tyler/remove-super-matchers
Migrate expensive integrations using super matchers to byte buddy.
2017-11-10 09:42:48 -05:00
Tyler Benson 51f903acd6 Ensure helpers are injected on a classloader that has instrumented code. 2017-11-09 15:34:05 -05:00
Tyler Benson 294320acb5 Add exception handling and supression for advice.
Also centralize classloader matching.
2017-11-09 14:45:03 -05:00
Tyler Benson f61935452b Handle case where SQL is not saved in map properly.
Otherwise this could result in an NPE.
2017-11-08 14:54:32 -05:00
Tyler Benson e96c084b51 Migrate aws instrumentation to byte buddy. 2017-11-06 14:25:28 -08:00
Tyler Benson e5924b3fe9 Migrate servlet instrumentation to byte buddy. 2017-11-06 11:28:06 -08:00
Tyler Benson 4199d123c2 Better null handling for JDBC instrumentation
This also reduces the log noise for transformation issues around synthesized classes.
2017-11-01 11:30:05 -07:00
Tyler Benson e8bbc849bb Set resource name using the route pattern from spring.
This provides a better static resorce name than trying to conjure one out of the original URL.
2017-10-30 13:24:18 -07:00
Tyler Benson cacba43435 Use byte buddy for @Trace instead of byteman. 2017-10-26 14:45:16 -07:00
Tyler Benson 25029b4109 Add integration tests for in-memory jdbc drivers. 2017-10-25 10:37:37 -07:00
Tyler Benson 14b834a358 Ignore generic classes and proxy classes 2017-10-25 10:36:37 -07:00
Tyler Benson 0d64192d91 Set resource name and span type correctly. 2017-10-24 10:28:53 -07:00
Tyler Benson ef5481cc27 Change operation name and set service name. 2017-10-24 10:28:53 -07:00
Tyler Benson b40bcf9973 Add automatic instrumentation for JDBC
This instrumentation creates spans for Statements and PreparedStatements. It also captures the corresponding SQL and additional connection info.  ResultSet could be considered for future instrumentation to capture even more of the DB interaction time.

This integration uses Bytebuddy instead of Byteman as the many methods to instrument would have been messy in Byteman.
2017-10-24 10:28:53 -07:00
Tyler Benson f2d1f0c209 Capture and report errors and stacktraces 2017-10-13 16:32:13 +02:00
Tyler Benson af5ef5e624 Fix name overloading confusion.
references to entries below were using the wrong instance and thus not being cleaned properly.
2017-10-13 14:08:03 +02:00
Tyler Benson cffde51b9e Add funky locking to ensure consistent execution for jetty test. 2017-09-21 13:47:28 -07:00
Tyler Benson 30721d00dc Replace tomcat/jetty specific integ with generic servlet integ.
This should also work with things like Weblogic and Websphere with the main requirement being Servlet 2.3 or above compatibility.
2017-09-20 16:39:43 -07:00
Tyler Benson 19af7840fb Adjust logging a bit more. 2017-09-19 10:53:14 -07:00
Tyler Benson 9c39bb64ae Fix aws version in readme, add finals and reformatting 2017-09-18 10:49:08 -07:00
Tyler Benson 4b26b787b8 Improve error logging for defineClass 2017-09-18 10:33:25 -07:00
Tyler Benson 4e106679a7 Move packages around and rename dd-trace inside agent
This avoids conflicts if the user already has dd-trace included in their app.
2017-09-11 15:00:00 -07:00
Tyler Benson 62c167de16 Inject helper classes into application’s classloader
This is important for things like Spring Boot’s executable jar classloader which keeps all the jars individually rather than on the system classloader.
2017-09-06 11:08:28 -07:00
Tyler Benson c652aa262c Remove dependency on OpenTracing Agent
It brings in a bunch of duplicate and unnecessary dependencies since it also bundles them in its’ jar.  Copying the OpenTracingHelper class to our repo until we can refactor it away.  It also is Apache 2 licensed so I think we should be ok.
2017-09-05 16:48:22 -07:00
Tyler Benson 3df63d9e53 Split up manager responsibility by job
`TraceAnnotationsManager` is responsible for generating the rules for `@Trace`ed methods, `InstrumentationRulesManager` is responsible for our custom built Integrations.
2017-09-05 13:52:11 -07:00
Tyler Benson a8908c06d8 Move helpers to a separate project for future bundling
This will allow us to eventually inject these classes in the correct classpath rather than having them on the system classpath.
2017-09-05 12:19:22 -07:00
Tyler Benson b85b7aed1d Turns out Byteman doesn’t like $this as a reference
Their docs were misleading.

Also fix the readme’s maven dependency.
2017-09-01 14:22:34 -07:00
Tyler Benson ec08b37757 Use package-renamed Simple SLF4J logger
This will prevent us from respecting any existing SLF4J implementation and just print to the console.  This is important for things like Spring Boot that never put a SLF4J implementation on the system classpath, but instead keep it inside the jar.
2017-08-28 14:57:46 -07:00
Tyler Benson a0d4f2ca76 Report version from main
This allows running the agent as an executable jar to report the version number.

Also repot version scan errors better.
2017-08-28 13:39:19 -07:00
Tyler Benson 9a9da92b59 Add version checking via class/method for jetty 2017-08-24 17:38:16 -07:00
Tyler Benson 59d1be4ea7 Merge pull request #112 from DataDog/tyler/version-verify
Add version scan verification and test in CI
2017-08-24 17:20:48 -07:00
Tyler Benson 1b63a53167 Add version scan verification and test in CI 2017-08-24 17:15:22 -07:00
Tyler Benson 82a9c73c6b Merge pull request #111 from DataDog/tyler/servlet-async
Mark servlet trace filter as async supported
2017-08-24 07:47:15 -07:00
Tyler Benson 233d241e07 Mark servlet trace filter as async supported 2017-08-23 16:01:42 -07:00
Tyler Benson ab7598804e Update dropwizard and spring boot readmes. 2017-08-23 15:35:55 -07:00
Tyler Benson 9ff937557e Ensure rules are loaded on the right classpath for Spring Boot 2017-08-23 14:30:18 -07:00
Tyler Benson db2758af19 Merge branch 'master' into tyler/versions
# Conflicts:
#	dd-java-agent/src/main/java/com/datadoghq/trace/agent/InstrumentationChecker.java
2017-08-23 09:08:40 -07:00
Tyler Benson 55edba486a Order rules alphabetically and ensure matches. 2017-08-22 17:25:45 -07:00
Tyler Benson 60cfb392c4 Fix grouping so any rule can allow module to be active. 2017-08-22 10:33:24 -07:00
Guillaume Polaert 1086439da8 log as info level 2017-08-22 15:32:58 +02:00
Guillaume Polaert 78c99f4574 Add more logs to debug 2017-08-21 14:58:08 +02:00
Tyler Benson aad3746c2b Fix tests 2017-08-18 11:12:06 -06:00
Tyler Benson 988a3d0fdf Cleanup plugin and add identifying classes to config
Still missing jetty since that requires method level searching.
2017-08-18 11:11:37 -06:00
Tyler Benson 860df9856c Enable instrumentation to scan for classes for version matching 2017-08-18 11:11:37 -06:00
Tyler Benson 03ca35426c Convert InstrumentationCheckerTest to Spock 2017-08-18 11:11:37 -06:00
Emanuele Palazzetti f1f112ff5a Merge pull request #79 from gpolaert/resource-name
[servlet] resource name for HTTP frameworks
2017-08-03 13:03:50 +02:00
Emanuele Palazzetti c5c750bd49
[elasticsearch] remove auto instrumentation; will be added later 2017-08-02 17:42:01 +02:00
Guillaume Polaert d46099cbd9 adding tests 2017-08-02 14:22:20 +02:00
Guillaume Polaert 78b2faf03b typo 2017-08-02 13:38:14 +02:00
Guillaume Polaert aef9ebec9a change span.type value 2017-08-02 13:35:37 +02:00
Guillaume Polaert 16aba0ac7a [servlet] change the resource name for servlet integration (404 grouping) 2017-08-02 11:17:05 +02:00
Guillaume Polaert 402e4978e2 [core] cosmetics 2017-08-02 11:07:59 +02:00