Commit Graph

181 Commits

Author SHA1 Message Date
Luca Abbati f01d473d10
Merge pull request #894 from DataDog/labbati/log4j
Support log trace injection for log4j 1.x and log4j 2.x when used without Slf4j
2019-06-21 16:36:26 -04:00
Luca Abbati f279a612f7
Minor fixes to typos and code styles 2019-06-21 15:53:13 -04:00
Laplie Anderson d80406843f Add "http.query.string" and "http.fragment.string" to DDTags 2019-06-21 14:05:34 -04:00
Luca Abbati d0f17e4b9d
Rename log context injection test base 2019-06-21 08:54:13 -04:00
Luca Abbati 0916a00a5e
Fixed unnecessary semi-colon in groovy class 2019-06-20 21:42:50 -04:00
Luca Abbati cba8ba1221
Refactor classes of log injection services to improve readability 2019-06-20 18:38:00 -04:00
Luca Abbati 4d1d5d1012
Introduce the mandatory test suite that a supported logging library MUST satisfy for log injection 2019-06-20 18:15:19 -04:00
Tyler Benson a4d53b0dcd Update Cassandra Tests and more instance name cleanup 2019-06-13 15:55:40 -07:00
Tyler Benson d26edd6c17 Ensure gradle runs base mongo test first
Otherwise there is a race condition between the projects initializing the mongo instance.
2019-06-13 10:44:42 -07:00
Luca Abbati 075b30053d
Merge pull request #863 from DataDog/labbati/non-static-config
Avoid usage of static getters when accessing configuration parameters
2019-06-13 18:06:15 +02:00
Tyler Benson ec3b586c2f
Merge pull request #866 from DataDog/tyler/jdbc-instance
Attempt to properly parse out instance name from JDBC url
2019-06-13 08:15:02 -07:00
Luca Abbati bd1e9a01db
Fixed missing blank line 2019-06-13 14:34:27 +02:00
Luca Abbati a8dd35ef57
Improve AgentRunner and ConfigUtils class based on CR comments 2019-06-13 12:40:10 +02:00
Luca Abbati a522196b49
Merge branch 'master' of github.com:DataDog/dd-trace-java into labbati/non-static-config 2019-06-12 23:57:20 +02:00
Luca Abbati e1ceda8f0e
Improve config usage as instance based on CR 2019-06-12 14:00:36 +02:00
Nikolay Martynov 6d5972bce1 Make agent-tooling compile-depend on dd-tracing-ot directly
This ensures that `dd-tracng-ot` gets included into shadow jar.
Before this patch it was included only 'by accident' via some
transitive dependencies of some instrumentations.
2019-06-11 14:49:44 -04:00
Tyler Benson 1a5a70650c Fix SpringJpaTest 2019-06-10 17:18:58 -07:00
Nikolay Martynov dd4b4c38f3 Refactor smoketests setup
Move start/stop of servers in smoke tests from gradle code to test
code.
This gives more flexibility in terms of what we can do there.
This also allows us to run servers under test with same JVM as the
test itself - not same jvm as gradle which is currently locked to Java8
2019-06-07 22:56:28 -04:00
Luca Abbati 1dc8467c26
Merge branch 'master' of github.com:DataDog/dd-trace-java into labbati/non-static-config 2019-06-06 18:11:43 +02:00
Nikolay Martynov 7863a68a53 Fix typo 2019-06-06 09:41:36 -04:00
Luca Abbati 057ca7b66e
Refresh the tracer with changed config properties now that we are using instances 2019-06-05 15:38:00 +02:00
Luca Abbati ae03abe63c
Adapt tests to the new Config approach instance vs static 2019-06-05 12:17:09 +02:00
Tyler Benson 8016e22bc4 Review changes 2019-05-31 09:07:22 -07:00
Tyler Benson 9cdf049ca7 Extract ConfigUtils 2019-05-30 09:09:29 -07:00
Tyler Benson a7c941c2ea More fixes.
Notably added a transformer to make config easier to test with by making INSTANCE public static volatile.
2019-05-29 22:24:19 -07:00
Tyler Benson fc9f1d120c Misc fixes. 2019-05-29 13:54:35 -07:00
Tyler Benson 71101ac8d0 Add http.query.string tag when enabled
Disabled by default.

Enable for http servers with:
* System Property: `dd.http.server.tag.query-string=true`
* Environment Variable: `DD_HTTP_SERVER_TAG_QUERY_STRING=true`

Enable for http clients with:
* System Property: `dd.http.client.tag.query-string=true`
* Environment Variable: `DD_HTTP_CLIENT_TAG_QUERY_STRING=true`
2019-05-29 13:54:35 -07:00
Tyler Benson e260b1d044 Make all http client tests extend HttpClientTest
Add flexibility to handle inconsistencies between client integrations.
2019-05-29 13:54:35 -07:00
Nikolay Martynov c5dbd7d0d7 Fix ApacheHttpAsync race condition 2019-05-17 13:49:46 -04:00
Tyler Benson 579b6dd929 Add transient modifier to added context fields. 2019-05-02 15:52:43 -07:00
Tyler Benson c971c434d1 Fix propagation and add onUnsubscribe handler
Ensures that span is closed when Observable is unsubscribed from.

Also added retransform error logger since retransforms might be missed if an exception is thrown, leading to odd behavior.
2019-04-30 11:52:20 -07:00
Tyler Benson 6414de82d9 Add support for HystrixObservableCommand
This change is slightly breaking for existing hystrixCommand code since the resource name changes from run->execute and getFallback->fallback.  The fallback span is also now a child of the execute span.
2019-04-29 12:04:27 -07:00
Tyler Benson 68a68f1057 Ensure that http.url tag doesn’t have query params set
Make handling of it more consistent in decorator.
2019-04-26 09:48:34 -07:00
Tyler Benson 9ad06a6791 Add instrumentation for Apache HttpAsyncClient
Extract http client tests to shared class.
2019-04-23 17:10:40 -07:00
Tyler Benson ec91a75848 Add config allowing classes to be excluded from transformation
Add the following system property or corresponding environment variable:
```
dd.trace.classes.exclude=some.packagename.*,some.classname.MyClass$NestedClass
```
2019-04-19 10:41:13 -07:00
Tyler Benson dc2e435de9
Merge pull request #797 from DataDog/tyler/ratpack
Update ratpack instrumentation and remove default disabled.
2019-04-16 08:14:10 -07:00
Luca Abbati f4a17ba4c5
Remove tests that relied on inner knowledge of the class. Feature still tested with cglib test. 2019-04-12 17:12:50 +02:00
Luca Abbati ff021f34db
Add minor fixes to comments and typos as per code reviewer suggestions 2019-04-12 16:51:49 +02:00
Luca Abbati c6863f0ca3
Use groovy class reference style in Spock tests 2019-04-11 16:06:46 +02:00
Luca Abbati 3a6fedda14
Add context getter/setter methods to an object only if not already defined
Class `FieldBackedProvider` uses ByteBuddy to add a field and its respective getters and setters to store the context object.
Assuming that we have a class `A` that implements runnable and that we wrap with a `FieldBackedProvider`
`Runnable` interfaces, if later on we use a cglib's `Enancher` class on `A` then the our mechanism will kick in again and try
to add the methods again. This causes a `java.lang.ClassFormatError: Duplicate method name "get__datadogContext$java$lang$Runnable" with signature "()Ljava.lang.Object;"`
to be thrown because CGLIB already copied over those methods from the original class `A` to the newly created class.

With this commit we now check that method were not previously defined before adding them, and if they were then we avoid adding them
again.

The reason why it wasn't faiing before is that we only checked on context field existence, not methods and cglib do not copy over fields, it copies only methods. E.g.

```
public class Main {

    public static class A {
        private String name = "hey";
        public String getName() {
            return this.name;
        }
    }

    public static void main(String[] args) {
        System.out.println("----- 'A' declared fields -----");
        A s = new A();
        for (Field f : s.getClass().getDeclaredFields()) {
            System.out.println("field: " + f.getName());
        }
        for (Method m : s.getClass().getDeclaredMethods()) {
            System.out.println("method: " + m.getName());
        }

        System.out.println("----- Proxy declared fields -----");
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(A.class);
        enhancer.setCallback((FixedValue) () -> null);
        A proxy = (A) enhancer.create();
        for (Field f : proxy.getClass().getDeclaredFields()) {
            System.out.println("field: " + f.getName());
        }
        for (Method m : proxy.getClass().getDeclaredMethods()) {
            System.out.println("method: " + m.getName());
        }
    }
}
```

Results in:

```
----- 'A' declared fields -----
field: name
method: getName
----- Proxy declared fields -----
field: CGLIB$BOUND
field: CGLIB$FACTORY_DATA
field: CGLIB$THREAD_CALLBACKS
field: CGLIB$STATIC_CALLBACKS
field: CGLIB$CALLBACK_0
field: CGLIB$CALLBACK_FILTER
method: equals
method: toString
method: hashCode
method: clone
method: getName
method: newInstance
method: newInstance
method: newInstance
method: setCallbacks
method: CGLIB$SET_STATIC_CALLBACKS
method: CGLIB$SET_THREAD_CALLBACKS
method: getCallback
method: getCallbacks
method: CGLIB$STATICHOOK1
method: CGLIB$BIND_CALLBACKS
method: setCallback
```
2019-04-11 15:45:43 +02:00
Tyler Benson c4ac5b94ec Fix span relationships and other review issues. 2019-04-10 17:31:22 -07:00
Tyler Benson a11b888d7a Update ratpack instrumentation and remove default disabled. 2019-04-08 18:26:08 -07:00
Ben Keith 446591240c Avoid race in TestHttpServer port selection
I notice occasionally some of the instrumentation tests fail due to port
conflicts in TestHttpServer, esp when using the `--parallel` option in
gradle. I think the previous method is subject to a race where two
concurrent workers will both get the same port from `randomOpenPort()`.
2019-03-06 12:55:02 -05:00
Tyler Benson 576e554445 Migrate Mongo to Decorator 2019-03-05 20:50:06 -05:00
Tyler Benson 50279d64fe Span type should only be an attribute and not inherited
Previously we were inheriting from the parent and also often setting as a tag.

Apply default span assertion to verify the spanType is being checked properly. (Include error state too.)
2019-02-28 12:39:51 -08:00
Tyler Benson 133460a79a Stop making hard references in HelperInjector
Also make awaitGC interruptable.
2019-02-27 19:09:01 -08:00
Tyler Benson 1644de3969 Migrate Jax-rs client instrumentation to Decorator 2019-02-27 09:40:08 -08:00
Tyler Benson a33b6ddaa0 Implement trace origin header and propagation support 2019-02-26 08:26:31 -08:00
Tyler Benson 5bc3ec82c2
Merge pull request #697 from DataDog/tyler/gradle-upgrade
Upgrade Gradle to 4.10.3
2019-02-11 16:01:35 -08:00
Nikolay Martynov 05731c3c45 Log when test starts
This is helpful to see what logs belong to what test
2019-02-11 12:21:20 -05:00