Commit Graph

2500 Commits

Author SHA1 Message Date
Luca Abbati c6863f0ca3
Use groovy class reference style in Spock tests 2019-04-11 16:06:46 +02:00
Luca Abbati e8435b165d
Fixed typo in comment 2019-04-11 15:49:10 +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
Nikolay Martynov 3b3f6856e3
Merge pull request #799 from DataDog/mar-kolya/fix-aws-instrumentation-warning
Fix AWS instrumentation warning in Idea
2019-04-09 16:00:04 -04:00
Nikolay Martynov e41769232e Fix AWS instrumentation warning in Idea
Idea complains about duplicates root because we run latest dep tests
and 'later version' tests from the same dir. This is ultimately
TestSetd plugin bug by the looks of it, but we can work around it by
swapping old and new version tests.

Also run both old and new version tests under 'test' task.
2019-04-09 10:50:07 -04:00
Tyler Benson cfef546823
Merge pull request #796 from DataDog/tyler/jmx-log-level
Fix JMXFetch log level
2019-04-08 17:14:14 -04:00
Tyler Benson 229e8ef51b Fix JMXFetch log level 2019-04-08 09:48:49 -07:00
Nikolay Martynov 6ee172baaa
Merge pull request #791 from DataDog/mar-kolya/handle-scopes
Mar kolya/handle scopes
2019-04-08 12:29:52 -04:00
Nikolay Martynov 6fd630831f Stop using `scopeManager().activate(span, true)` 2019-04-08 11:54:47 -04:00
Nikolay Martynov f4791a17df Use decorators in Netty's ChannelFutureListenerInstrumentation 2019-04-08 11:35:13 -04:00
Nikolay Martynov 7b53cebd3d Fix some compiler warnings 2019-04-05 12:58:54 -04:00
Nikolay Martynov a5b5d236e1 Use Scope when opening span in netty instrumentation 2019-04-05 11:13:53 -04:00
Nikolay Martynov e678a62e5b Use scope when opening JMS span 2019-04-05 11:13:53 -04:00
Nikolay Martynov 4119059e70 Jaxrs: use scope when span is opened 2019-04-05 11:13:53 -04:00
Nikolay Martynov 0e7418fde6 AWS v2: use scope when span is created 2019-04-05 11:13:53 -04:00
Nikolay Martynov 480a14b170 OkHttp: rearrange scope code a bit 2019-04-05 11:13:53 -04:00
Nikolay Martynov 1af7487201 Wrap Rabbitmq channel span into scope 2019-04-05 11:13:53 -04:00
Nikolay Martynov 743ab327b0 Wrap GRPC span start into scope 2019-04-05 11:13:53 -04:00
Nikolay Martynov a1e23dfb86 Make sure span is opened and closed with scope in Cassandra 2019-04-05 11:13:53 -04:00
Nikolay Martynov bddee3d6e2 Make sure span is opened and closed with scope in Mongo 2019-04-05 11:13:53 -04:00
Nikolay Martynov f3e1eb4f5d Make sure span is opened and closed with scope in Couchbase 2019-04-05 11:13:53 -04:00
Nikolay Martynov 2bba4c5591 Make sure span is opened and closed with scope in spymemcached 2019-04-05 11:13:53 -04:00
Nikolay Martynov bfb48f31c1 Make sure span is opened and closed with scope in http_url_connection 2019-04-05 11:13:53 -04:00
Nikolay Martynov fb18b559ef
Merge pull request #792 from DataDog/mar-kolya/konvert-to-kotlin
Konvert muzzle plugin definition to Kotlin
2019-04-05 11:12:54 -04:00
Nikolay Martynov c489fb41cb Konvert muzzle plugin definition to Kotlin 2019-04-05 11:03:35 -04:00
Nikolay Martynov b30fcc7cab
Merge pull request #794 from DataDog/mar-kolya/fix-hibernate-latestdep-deps
Specify hibernate latest dep test deps for 4.0 tests
2019-04-05 11:02:29 -04:00
Nikolay Martynov 997832ba4e Limit hibernate integration tests to 5.x.x since we do not support 6+ 2019-04-05 10:43:16 -04:00
Nikolay Martynov 93621fac17 Specify hibernate latest dep test deps for 4.0 tests 2019-04-05 09:26:14 -04:00
Nikolay Martynov a608fe4758
Merge pull request #790 from DataDog/mar-kolya/minor-fixes
Mar kolya/minor fixes
2019-04-05 09:24:13 -04:00
Nikolay Martynov 1bba166554 typo fix 2019-04-03 14:50:10 -04:00
Nikolay Martynov c104be1fa7 Add compile dep on scala to make Idea happy 2019-04-03 13:59:25 -04:00
Nikolay Martynov e3488d23a2 Netty: do not use deprecated constants 2019-04-03 13:58:54 -04:00
Nikolay Martynov 03e614fa4b
Merge pull request #789 from DataDog/mar-kolya/upgrade-gradle
Upgradle gradle
2019-04-03 13:46:06 -04:00
Nikolay Martynov a245ec4949 Upgradle gradle 2019-04-03 12:56:15 -04:00
Nikolay Martynov de980c2d52
Merge pull request #787 from DataDog/mar-kolya/compiler-config-fix
Mar kolya/compiler config fix
2019-04-01 09:15:39 -04:00
Luca Abbati 3a4261fcce
Merge pull request #786 from DataDog/labbati/guava-20-and-27
Have cassandra integration to work with recent versions of Guava
2019-03-29 19:34:26 +01:00
Nikolay Martynov 8f811fef85 Reduce gradle heap size on muzzle task
Looks like gradle forks more with new compiler settings and we run out
of memory on muzzle task
2019-03-29 14:34:19 -04:00
Nikolay Martynov 212d4d3c71 Provide Java compiler with bootstrap classes for Java7
when compiling Java7-compatible sources.
2019-03-29 13:53:53 -04:00
Tyler Benson e4c0175ed0
Merge pull request #785 from DataDog/tyler/pendingtrace-init
Ensure that PendingTrace.SPAN_CLEANER initialized with Tracer
2019-03-29 10:22:07 -07:00
Tyler Benson bc9b96222d Add fixme for future testing task. 2019-03-29 10:03:53 -07:00
Nikolay Martynov 7f2186a369
Merge pull request #788 from DataDog/mar-kolya/pendingtrace-init-suggestion
Make SpanCleaner initialization explicit
2019-03-29 12:45:13 -04:00
Luca Abbati 2c282552dc
Fix comment 2019-03-29 17:26:43 +01:00
Nikolay Martynov 65630a702d Make SpanCleaner initialization explicit 2019-03-29 12:21:17 -04:00
Luca Abbati 64dd67024f
Improve javadoc entry 2019-03-29 17:18:53 +01:00
Luca Abbati ff17ed166b
Fix code style in cassandra integration 2019-03-29 16:38:32 +01:00
Nikolay Martynov 4c8a790c3b DDTracer: minor javadoc fix 2019-03-29 09:42:52 -04:00
Luca Abbati dfecfc8329
Fixed typo in comments (follow-up) 2019-03-29 14:15:25 +01:00
Luca Abbati 1626c5da62
Fixed typo in comments 2019-03-29 14:09:40 +01:00
Luca Abbati 1e69fb7234
Have cassandra integration to work with recent versions of Guava.
Recent versions of Guava removed method 'Futures::transform(input, function)' in favor of 'Futures::transform(input, function, executor)'.
This commit manually retrieve the executor as it was done in Guava 20 in the overloaded method.
See: 65f6b4f4b1/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java (L58)
2019-03-29 13:42:46 +01:00
Luca Abbati 1a3e5fe69a
Let muzzle plugin test same dependency in different conditions
The muzzle plugin creates a config for each of the dependencies under test with name '...-<group_id>-<artifact_id>-<version>'.
The problem is that if we want to test multiple times the same configuration under different conditions, e.g.
with different extra dependencies, the plugin would throw an error as it would try to create several times the same config.

This commit let directives to define an optional name that defaults to a null. If a name is provided then a slug of it
is used to generate the gradle configuration name.
2019-03-29 13:42:26 +01:00