Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests with javaagent. #1643

Merged
merged 180 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
a2f1604
Run tests with javaagent.
Nov 16, 2020
02b72aa
TransformationListener bridge.
Nov 16, 2020
c3f13d7
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
Nov 17, 2020
dd1eff3
Simple instrumentation (e.g. armeria) work
Nov 17, 2020
d067842
Config updates work
Nov 17, 2020
b1cacb1
Some cleanup
Nov 17, 2020
ff513ae
Exclude bootstrap from the testRuntimeClasspath so tooling can contin…
Nov 17, 2020
4e34a57
Exclude bootstrap from all test runtime classpaths.
Nov 17, 2020
42d2c7a
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
Nov 18, 2020
388493b
Clean
Nov 18, 2020
6757a11
testInstrumentation
Nov 18, 2020
78ff98d
Shrink agent testing jar
Nov 18, 2020
8080285
Fixes
Nov 18, 2020
ec435b6
Fixes
Nov 20, 2020
916fc2e
Remove iscompleted
Nov 20, 2020
06ca469
Remove dependency on agent classes in tests.
Nov 21, 2020
d229ab8
Merge remote-tracking branch 'upstream/master' into pr-run-tests-with…
trask Nov 21, 2020
1d3de5a
FIXUP
trask Nov 21, 2020
3552033
Fix for no propagators being installed
trask Nov 21, 2020
0e1cf89
Partially fix opentelemetry-api instrumentation tests
trask Nov 22, 2020
ca5a118
Rename
trask Nov 22, 2020
2356d5b
fixup! Rename
trask Nov 22, 2020
f90fdaa
Reduce test dependency on OpenTelemetry API
trask Nov 22, 2020
58dae8a
Revert "Reduce test dependency on OpenTelemetry API"
trask Nov 22, 2020
8bd1a0d
No need to set propagators in AgentTestRunner
trask Nov 22, 2020
c9e6cf7
Remove no longer needed code
trask Nov 22, 2020
af1b1a9
Basic ContextBridgeTest
trask Nov 22, 2020
915767e
Remove unnecessary verification
trask Nov 22, 2020
da51582
Revert "Remove unnecessary verification"
trask Nov 22, 2020
678a868
Remove mock context
trask Nov 22, 2020
6b76dff
Spotless
trask Nov 22, 2020
011b106
Merge remote-tracking branch 'upstream/master' into pr-run-tests-with…
trask Nov 23, 2020
c278b13
Fix guava test
trask Nov 24, 2020
6b5d90a
Merge remote-tracking branch 'upstream/master' into pr-run-tests-with…
trask Nov 24, 2020
b0d4249
Fix jdbc tests
trask Nov 24, 2020
faf8e85
Compile failures
Nov 24, 2020
57492db
Fix cassandra test and jaxrs-1 compile failure.
Nov 24, 2020
0c62f64
Ignore kubernetes test for now
Nov 24, 2020
ef55977
Disable oshi assertion.
Nov 24, 2020
e66eb66
Comment out more unit tests
Nov 24, 2020
c2e7226
Don't apply unnecessary plugins at top level.
Nov 24, 2020
96a9ed1
Merge branch 'top-level-less-plugins' into run-tests-with-agent
Nov 24, 2020
066cf29
Use agent way to set xray propagator.
Nov 24, 2020
d3c5c8c
More
Nov 24, 2020
15821e9
Almost there
Nov 24, 2020
d76d9dd
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
Nov 24, 2020
e950709
Merge remote-tracking branch 'upstream/master' into pr-run-tests-with…
trask Nov 24, 2020
415d8f7
Split out ConfigUtils for non-agent instrumentation tests.
Nov 25, 2020
4e7fc8c
Remove testing-bootstrap
Nov 25, 2020
a3aa8c6
Remove Shaded SDK projects.
Nov 25, 2020
1e72ea1
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Nov 27, 2020
904382a
Convert HibernateDecorator to HibernateTracer
trask Nov 27, 2020
4b062bd
Convert TwilioDecorator to TwilioTracer
trask Nov 27, 2020
6f7c196
Delete BaseDecorator
trask Nov 28, 2020
428e29f
Remove decorator package
trask Nov 28, 2020
6148a26
More renames
trask Nov 28, 2020
d937ca6
Improve tests that rely on config
trask Nov 27, 2020
bef075b
RedisCommandNormalizerTest
trask Nov 28, 2020
265c5ec
Fix
trask Nov 28, 2020
5b12e11
Merge branch 'remove-decorators' into run-tests-with-agent
trask Nov 28, 2020
d25cb37
Remove testing ConfigUtils
trask Nov 28, 2020
af6953c
Update more config property names
trask Nov 28, 2020
59d654e
Spotless
trask Nov 28, 2020
adba247
Split out methods and otel-annotations modules
trask Nov 28, 2020
911f774
Merge branch 'update-more-config-property-names' into run-tests-with-…
trask Nov 28, 2020
29002ea
Bring back hystrix internal prop, I thought it was instrumentation prop
trask Nov 28, 2020
40cb995
Hystrix config
trask Nov 28, 2020
aea5afe
WORK
trask Nov 28, 2020
72dde42
Rename defaultEnabled property to default-enabled
trask Nov 28, 2020
9c855ed
Fix external-annotations test
trask Nov 28, 2020
375ceae
Merge branch 'split-out-two-more-modules' into run-tests-with-agent
trask Nov 28, 2020
b867b30
Merge branch 'rename-default-enabled-prop' into run-tests-with-agent
trask Nov 28, 2020
c1cb569
morework
trask Nov 28, 2020
987daf6
Fix ConfiguredTraceAnnotationsTest
trask Nov 28, 2020
4ab50b7
Merge branch 'split-out-two-more-modules' into run-tests-with-agent
trask Nov 28, 2020
818b84e
Remove ConfigUtils
trask Nov 28, 2020
fcb7026
Removing ConfigUtils still
trask Nov 28, 2020
10e1903
Fixing methods instrumentation test
trask Nov 28, 2020
42c891f
Fix external-annotations tests
trask Nov 28, 2020
dec14a5
Fix opentelemetry-annotations-1.0 tests
trask Nov 28, 2020
fd2f9b9
Less ConfigUtils
trask Nov 28, 2020
17240a6
Working on testing-common
trask Nov 28, 2020
ca24ed1
Remove ConfigUtils from kafka
trask Nov 28, 2020
a13ef3f
Remove ConfigUtils
trask Nov 28, 2020
f83c8da
Delete AgentInstallerAccess and ConfigAccess
trask Nov 28, 2020
4cfe7d9
Temporarily ignore some tests
trask Nov 28, 2020
d4bda6a
Fix compilation errors
trask Nov 28, 2020
05d6e5c
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Nov 28, 2020
a781ce7
Extract unittest from kubernetes-client
trask Nov 28, 2020
a44d7ea
Extract unittest from jdbc
trask Nov 28, 2020
a6c7b75
Extract unittest from mongo-3.1 and mongo-3.7
trask Nov 28, 2020
64d675c
Spotless
trask Nov 28, 2020
78bd949
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Nov 28, 2020
09f18c3
Extract unittest from external-annotations
trask Nov 28, 2020
a8b01d2
Consistency in unittests gradle files
trask Nov 28, 2020
805b520
Codenarc
trask Nov 28, 2020
9a52869
Fix opentelemetry-api-1.0 test
trask Nov 28, 2020
5ad267b
Temporarily ignore test
trask Nov 28, 2020
6aabf27
Create javaagent dirs for all instrumentation
trask Nov 29, 2020
7b1d8fe
Format groovy
trask Nov 29, 2020
f3db271
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Nov 29, 2020
9a2bafa
Remove no longer needed comment
trask Nov 29, 2020
42ed2c9
Cleanup
trask Nov 29, 2020
5d1c386
Cleanup
trask Nov 29, 2020
f822799
Cleanup
trask Nov 30, 2020
42517df
Cleanup
trask Nov 30, 2020
fd75472
Fixes
trask Nov 30, 2020
dbf50bf
Fix javaagent module tests
trask Nov 30, 2020
4560525
Fix javaagent-tooling module tests
trask Nov 30, 2020
39b8390
Turn off debug logging
trask Nov 30, 2020
115b6be
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Dec 2, 2020
749086c
Merge cleanup
trask Dec 2, 2020
0e0f1d2
Revert "Turn off debug logging"
trask Dec 2, 2020
1813fe1
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Dec 3, 2020
09d02e7
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Dec 16, 2020
fc169ed
Merge fixes
trask Dec 16, 2020
0c65803
Fix metrics tests
trask Dec 16, 2020
515f68a
METRICS
trask Dec 17, 2020
f90b056
fixup! METRICS
trask Dec 17, 2020
1de976a
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Dec 19, 2020
d65463a
Get tests compiling again
trask Dec 19, 2020
dc492e7
Tests
trask Dec 19, 2020
b4ff124
Consistent extra gradle test task
trask Dec 19, 2020
4af856d
Fix testing-common tests
trask Dec 19, 2020
595bf1e
Metrics test working
trask Dec 20, 2020
22b0002
Fix oshi test
trask Dec 20, 2020
a48e2ed
Fix jsp test
trask Dec 20, 2020
8f5a37b
Also percentiles
trask Dec 20, 2020
b638ea3
Add TODO about more tests needed
trask Dec 20, 2020
06cb308
Bring back 2 more tests
trask Dec 20, 2020
4f0574d
Wait for spans inside of traces
trask Dec 20, 2020
e77f1ce
A bit more review
trask Dec 21, 2020
c6bb023
Spotless
trask Dec 20, 2020
0a6a6e8
One more comment
trask Dec 21, 2020
5bfbb7e
Fix gradle logging deadlocks
trask Dec 21, 2020
6befa81
Match comment in javaagent.gradle
trask Dec 21, 2020
1e75760
Ooops
trask Dec 21, 2020
35f0ae7
More oops
trask Dec 21, 2020
3ae6dfb
Still fixing recent InMemoryExporter changes
trask Dec 21, 2020
1f6313d
Fix baggage test
trask Dec 21, 2020
eec252b
Fix the build
trask Dec 21, 2020
3f582c0
Checkstyle
trask Dec 21, 2020
2f26374
Remove code coverage check from testing-common
trask Dec 21, 2020
a44cefd
Spotless
trask Dec 21, 2020
47e7701
Fix new gradle files
trask Dec 21, 2020
584382e
Spotless
trask Dec 21, 2020
2264e26
Fix kotlin coroutine test
trask Dec 21, 2020
21acc89
Fix CI sporadic hanging
trask Dec 21, 2020
fa41e7e
Feedback
trask Dec 21, 2020
1bdec4b
Unnecessary
trask Dec 21, 2020
189a68f
Spotless
trask Dec 21, 2020
742474b
Bring back deadlock
trask Dec 21, 2020
e39246e
Fix gradle output deadlock
trask Dec 22, 2020
a117395
Look for new deadlock
trask Dec 22, 2020
eb58976
To be reverted: --no-build-cache
trask Dec 22, 2020
cbdeb7a
Revert "To be reverted: --no-build-cache"
trask Dec 22, 2020
4607cc3
Revert "Look for new deadlock"
trask Dec 22, 2020
8a673ea
Revert "Fix gradle output deadlock"
trask Dec 22, 2020
1efdffe
Revert "Bring back deadlock"
trask Dec 22, 2020
c684902
Add org.gradle to GlobalIgnoresMatcher
trask Dec 22, 2020
5f19bb2
Bring back cglib ignore
trask Dec 22, 2020
ac643e6
Remove unused code
trask Dec 22, 2020
6aa1eaa
Fix FieldBackedProviderTest's cglib test
trask Dec 23, 2020
063613d
Enable debug logging
trask Dec 23, 2020
839c55e
Fix gradle deadlocking
trask Dec 23, 2020
7824080
Set net.bytebuddy.raw earlier
trask Dec 23, 2020
058225d
Add doc
trask Dec 23, 2020
c0775f5
Can't see github action output
trask Dec 23, 2020
10b1acc
Spotless
trask Dec 23, 2020
5b031c4
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Dec 23, 2020
8652c1b
Fix undertow tests
trask Dec 23, 2020
b263ce3
Fix undertow tests, take 2
trask Dec 23, 2020
86568f2
Spotless
trask Dec 23, 2020
473acce
Simplify depedencies
trask Dec 23, 2020
db5c58d
More doc
trask Dec 23, 2020
0f7eaf5
Different fix for gradle deadlock
trask Dec 23, 2020
c1991ee
Add link from CONTRIBUTING
trask Dec 23, 2020
b1d4171
Merge remote-tracking branch 'upstream/master' into run-tests-with-agent
trask Dec 24, 2020
f5e2789
Bump timeout for flaky test
trask Dec 24, 2020
ed6a91a
Maybe still seeing a deadlock
trask Dec 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove dependency on agent classes in tests.
  • Loading branch information
Anuraag Agrawal committed Nov 21, 2020
commit 06ca46962767f547a3c33e9abffd6d8ca1c62808
5 changes: 1 addition & 4 deletions gradle/instrumentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ afterEvaluate {
compileOnly deps.autoservice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seemingly innocent change caused a lot of breakage since guava, previously set by autoservice, ended up getting too new for many of our projects. But it's probably better to have the manual downgrading as now to know about these instead of the luck.

implementation deps.slf4j

testImplementation project(':instrumentation-api')
testImplementation project(':javaagent-api')
testImplementation project(':javaagent-tooling')
testImplementation deps.opentelemetryApi

testImplementation project(':testing-common')
testAnnotationProcessor deps.autoservice
testImplementation deps.autoservice
testCompileOnly deps.autoservice
testImplementation project(':utils:test-utils')

testImplementation deps.testcontainers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import akka.http.javadsl.model.HttpMethods
import akka.http.javadsl.model.HttpRequest
import akka.http.javadsl.model.headers.RawHeader
import akka.stream.ActorMaterializer
import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer
import io.opentelemetry.instrumentation.test.base.HttpClientTest
import spock.lang.Shared
import spock.lang.Timeout
Expand Down Expand Up @@ -64,7 +63,7 @@ class AkkaHttpClientInstrumentationTest extends HttpClientTest {
trace(0, 1) {
span(0) {
hasNoParent()
name HttpClientTracer.DEFAULT_SPAN_NAME
name "HTTP request"
kind CLIENT
errored true
errorEvent(NullPointerException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import com.amazonaws.services.lambda.runtime.Context
import com.amazonaws.services.lambda.runtime.RequestHandler
import io.opentelemetry.instrumentation.awslambda.v1_0.AbstractAwsLambdaRequestHandlerTest
import io.opentelemetry.instrumentation.test.AgentTestTrait
import io.opentelemetry.javaagent.testing.common.AgentTestingExporterAccess

class AwsLambdaTest extends AbstractAwsLambdaRequestHandlerTest implements AgentTestTrait {

def cleanup() {
assert testWriter.forceFlushCalled()
assert AgentTestingExporterAccess.forceFlushCalled()
}

class TestRequestHandler implements RequestHandler<String, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.test.InstrumentationTestTrait
class AwsLambdaTest extends AbstractAwsLambdaRequestHandlerTest implements InstrumentationTestTrait {

def cleanup() {
assert testWriter.forceFlushCalled()
assert forceFlushCalled()
}

class TestRequestHandler extends TracingRequestHandler<String, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT
import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING

import groovy.json.JsonSlurper
import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer
import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.api.trace.attributes.SemanticAttributes
import io.opentelemetry.instrumentation.test.AgentTestRunner
import org.apache.http.HttpHost
import org.apache.http.client.config.RequestConfig
import org.apache.http.util.EntityUtils
Expand Down Expand Up @@ -116,6 +115,6 @@ class Elasticsearch5RestClientTest extends AgentTestRunner {
}

String expectedOperationName(String method) {
return method != null ? "HTTP $method" : HttpClientTracer.DEFAULT_SPAN_NAME
return method != null ? "HTTP $method" : "HTTP request"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static io.opentelemetry.api.trace.Span.Kind.CLIENT

import groovy.json.JsonSlurper
import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer
import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.api.trace.attributes.SemanticAttributes
import org.apache.http.HttpHost
Expand Down Expand Up @@ -126,6 +125,6 @@ class Elasticsearch6RestClientTest extends AgentTestRunner {
}

String expectedOperationName(String method) {
return method != null ? "HTTP $method" : HttpClientTracer.DEFAULT_SPAN_NAME
return method != null ? "HTTP $method" : "HTTP Request"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import static io.opentelemetry.api.trace.Span.Kind.CLIENT

import groovy.json.JsonSlurper
import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer
import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.api.trace.attributes.SemanticAttributes
import io.opentelemetry.instrumentation.test.AgentTestRunner
import org.apache.http.HttpHost
import org.apache.http.client.config.RequestConfig
import org.apache.http.util.EntityUtils
Expand Down Expand Up @@ -112,6 +111,6 @@ class Elasticsearch6RestClientTest extends AgentTestRunner {
}

String expectedOperationName(String method) {
return method != null ? "HTTP $method" : HttpClientTracer.DEFAULT_SPAN_NAME
return method != null ? "HTTP $method" : "HTTP request"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

import io.opentelemetry.instrumentation.api.config.Config
import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.instrumentation.test.utils.ConfigUtils
import io.opentelemetry.javaagent.instrumentation.traceannotation.TraceAnnotationsInstrumentationModule
import io.opentelemetry.test.annotation.SayTracedHello

import java.util.concurrent.Callable

import static io.opentelemetry.javaagent.instrumentation.traceannotation.TraceAnnotationsInstrumentationModule.DEFAULT_ANNOTATIONS

class ConfiguredTraceAnnotationsTest extends AgentTestRunner {
static final PREVIOUS_CONFIG = ConfigUtils.updateConfigAndResetInstrumentation {
it.setProperty("otel.trace.annotations", "package.Class\$Name;${OuterClass.InterestingMethod.name}")
Expand Down Expand Up @@ -46,32 +42,34 @@ class ConfiguredTraceAnnotationsTest extends AgentTestRunner {
}
}

def "test configuration #value"() {
setup:
// Don't use ConfigUtils since that modifies the config in the agent - here we're just
// initializing TraceAnnotationsInstrumentationModule directly so this is not using the agent
// and we need to make sure to modify our (non-shaded) config.
def previousConfig = Config.get()
Config.INSTANCE = Config.create(['otel.trace.annotations': value])

expect:
new TraceAnnotationsInstrumentationModule.AnnotatedMethodsInstrumentation().additionalTraceAnnotations == expected.toSet()

cleanup:
Config.INSTANCE = previousConfig

where:
value | expected
null | DEFAULT_ANNOTATIONS.toList()
" " | []
"some.Invalid[]" | []
"some.package.ClassName " | ["some.package.ClassName"]
" some.package.Class\$Name" | ["some.package.Class\$Name"]
" ClassName " | ["ClassName"]
"ClassName" | ["ClassName"]
"Class\$1;Class\$2;" | ["Class\$1", "Class\$2"]
"Duplicate ;Duplicate ;Duplicate; " | ["Duplicate"]
}
// WIP(anuraaga): Accessing Config directly in tests causes issues due to shading conflicts.
// We'll probably want to move this to an independent test that isn't using AgentTestRunner.
// def "test configuration #value"() {
// setup:
// // Don't use ConfigUtils since that modifies the config in the agent - here we're just
// // initializing TraceAnnotationsInstrumentationModule directly so this is not using the agent
// // and we need to make sure to modify our (non-shaded) config.
// def previousConfig = Config.get()
// Config.INSTANCE = Config.create(['otel.trace.annotations': value])
//
// expect:
// new TraceAnnotationsInstrumentationModule.AnnotatedMethodsInstrumentation().additionalTraceAnnotations == expected.toSet()
//
// cleanup:
// Config.INSTANCE = previousConfig
//
// where:
// value | expected
// null | DEFAULT_ANNOTATIONS.toList()
// " " | []
// "some.Invalid[]" | []
// "some.package.ClassName " | ["some.package.ClassName"]
// " some.package.Class\$Name" | ["some.package.Class\$Name"]
// " ClassName " | ["ClassName"]
// "ClassName" | ["ClassName"]
// "Class\$1;Class\$2;" | ["Class\$1", "Class\$2"]
// "Duplicate ;Duplicate ;Duplicate; " | ["Duplicate"]
// }

class AnnotationTracedCallable implements Callable<String> {
@OuterClass.InterestingMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

import static io.opentelemetry.api.trace.Span.Kind.CLIENT
import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace
import static io.opentelemetry.api.trace.Span.Kind.CLIENT

import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer
import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.api.trace.Span
import io.opentelemetry.api.trace.attributes.SemanticAttributes
import io.opentelemetry.instrumentation.test.AgentTestRunner

class UrlConnectionTest extends AgentTestRunner {

Expand Down Expand Up @@ -61,6 +60,6 @@ class UrlConnectionTest extends AgentTestRunner {
}

String expectedOperationName(String method) {
return method != null ? "HTTP $method" : HttpClientTracer.DEFAULT_SPAN_NAME
return method != null ? "HTTP $method" : "HTTP request"
}
}
2 changes: 1 addition & 1 deletion instrumentation/instrumentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ shadowJar {
}

// rewrite library instrumentation dependencies
relocate("io.opentelemetry.instrumentation", "io.opentelemetry.javaagent.shaded.instrumentation")
relocate "io.opentelemetry.instrumentation", "io.opentelemetry.javaagent.shaded.instrumentation"

// rewrite dependencies calling Logger.getLogger
relocate 'java.util.logging.Logger', 'io.opentelemetry.javaagent.bootstrap.PatchLogger'
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/java-classloader/java-classloader.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ dependencies {
compileOnly project(':javaagent-bootstrap')

testImplementation project(':javaagent-bootstrap')
}

shadowJar {
from("src/test/resources/")
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import static io.opentelemetry.instrumentation.util.gc.GcUtils.awaitGc

import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.javaagent.tooling.HelperInjector
import io.opentelemetry.javaagent.testing.common.HelperInjectorAccess
import java.lang.ref.WeakReference
import java.util.concurrent.atomic.AtomicReference

Expand All @@ -15,7 +15,6 @@ class ResourceInjectionTest extends AgentTestRunner {
def "resources injected to non-delegating classloader"() {
setup:
String resourceName = 'test-resources/test-resource.txt'
HelperInjector injector = new HelperInjector("test", [], [resourceName])
AtomicReference<URLClassLoader> emptyLoader = new AtomicReference<>(new URLClassLoader(new URL[0], (ClassLoader) null))

when:
Expand All @@ -26,7 +25,7 @@ class ResourceInjectionTest extends AgentTestRunner {
when:
URLClassLoader notInjectedLoader = new URLClassLoader(new URL[0], (ClassLoader) null)

injector.transform(null, null, emptyLoader.get(), null)
HelperInjectorAccess.injectResources(emptyLoader.get(), resourceName)
resourceUrls = emptyLoader.get().getResources(resourceName)

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.javaagent.instrumentation.api.concurrent.State
import org.apache.catalina.WebResource
import org.apache.catalina.WebResourceRoot
import org.apache.catalina.loader.ParallelWebappClassLoader
Expand All @@ -25,11 +24,8 @@ class TomcatClassloadingTest extends AgentTestRunner {
classloader.init()
classloader.start()

when:
expect:
// If instrumentation didn't work this would blow up with NPE due to incomplete resources mocking
def clazz = classloader.loadClass("io.opentelemetry.javaagent.instrumentation.api.concurrent.State")

then:
clazz == State
classloader.loadClass("io.opentelemetry.javaagent.instrumentation.api.concurrent.State")
}
}
26 changes: 13 additions & 13 deletions instrumentation/jms-1.1/src/jms2Test/groovy/Jms2Test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ import com.google.common.io.Files
import io.opentelemetry.api.trace.attributes.SemanticAttributes
import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
import io.opentelemetry.javaagent.instrumentation.jms.JmsTracer
import io.opentelemetry.sdk.trace.data.SpanData
import java.util.concurrent.CountDownLatch
import java.util.concurrent.atomic.AtomicReference
import javax.jms.Message
import javax.jms.MessageListener
import javax.jms.Session
import javax.jms.TextMessage
import org.hornetq.api.core.TransportConfiguration
import org.hornetq.api.core.client.HornetQClient
import org.hornetq.api.jms.HornetQJMSClient
Expand All @@ -32,6 +25,13 @@ import org.hornetq.core.server.HornetQServers
import org.hornetq.jms.client.HornetQTextMessage
import spock.lang.Shared

import javax.jms.Message
import javax.jms.MessageListener
import javax.jms.Session
import javax.jms.TextMessage
import java.util.concurrent.CountDownLatch
import java.util.concurrent.atomic.AtomicReference

class Jms2Test extends AgentTestRunner {
@Shared
HornetQServer server
Expand Down Expand Up @@ -110,8 +110,8 @@ class Jms2Test extends AgentTestRunner {
destination | destinationType | destinationName
session.createQueue("someQueue") | "queue" | "someQueue"
session.createTopic("someTopic") | "topic" | "someTopic"
session.createTemporaryQueue() | "queue" | JmsTracer.TEMP_DESTINATION_NAME
session.createTemporaryTopic() | "topic" | JmsTracer.TEMP_DESTINATION_NAME
session.createTemporaryQueue() | "queue" | "(temporary)"
session.createTemporaryTopic() | "topic" | "(temporary)"
}

def "sending to a MessageListener on #destinationName #destinationType generates a span"() {
Expand Down Expand Up @@ -149,8 +149,8 @@ class Jms2Test extends AgentTestRunner {
destination | destinationType | destinationName
session.createQueue("someQueue") | "queue" | "someQueue"
session.createTopic("someTopic") | "topic" | "someTopic"
session.createTemporaryQueue() | "queue" | JmsTracer.TEMP_DESTINATION_NAME
session.createTemporaryTopic() | "topic" | JmsTracer.TEMP_DESTINATION_NAME
session.createTemporaryQueue() | "queue" | "(temporary)"
session.createTemporaryTopic() | "topic" | "(temporary)"
}

def "failing to receive message with receiveNoWait on #destinationName #destinationType works"() {
Expand Down Expand Up @@ -234,7 +234,7 @@ class Jms2Test extends AgentTestRunner {
"${SemanticAttributes.MESSAGING_SYSTEM.key}" "jms"
"${SemanticAttributes.MESSAGING_DESTINATION.key}" destinationName
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" destinationType
if (destinationName == JmsTracer.TEMP_DESTINATION_NAME) {
if (destinationName == "(temporary)") {
"${SemanticAttributes.MESSAGING_TEMP_DESTINATION.key}" true
}
}
Expand Down Expand Up @@ -263,7 +263,7 @@ class Jms2Test extends AgentTestRunner {
//In some tests we don't know exact messageId, so we pass "" and verify just the existence of the attribute
"${SemanticAttributes.MESSAGING_MESSAGE_ID.key}" { it == messageId || messageId == "" }
}
if (destinationName == JmsTracer.TEMP_DESTINATION_NAME) {
if (destinationName == "(temporary)") {
"${SemanticAttributes.MESSAGING_TEMP_DESTINATION.key}" true
}
}
Expand Down
Loading