File tree Expand file tree Collapse file tree
communication/src/main/java/datadog/communication/http
agent-ci-visibility/src/main/java/datadog/trace/civisibility/events
instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5
main/java/datadog/telemetry
test/groovy/datadog/telemetry Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ system_test_matrix: &system_test_matrix
3232
3333agent_integration_tests_modules: &agent_integration_tests_modules "dd-trace-core|communication|internal-api|utils"
3434core_modules: &core_modules "dd-java-agent|dd-trace-core|communication|internal-api|telemetry|utils|dd-java-agent/agent-bootstrap|dd-java-agent/agent-installer|dd-java-agent/agent-tooling|dd-java-agent/agent-builder|dd-java-agent/appsec|dd-java-agent/agent-crashtracking"
35- instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation|dd-java-agent/agent-tooling|dd-java-agent/agent-installer|dd-java-agent/agent-builder|dd-java-agent/agent-bootstrap|dd-java-agent/appsec|dd-java-agent/testing|dd-trace-core|dd-trace-api|internal-api"
35+ instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation|dd-java-agent/agent-tooling|dd-java-agent/agent-installer|dd-java-agent/agent-builder|dd-java-agent/agent-bootstrap|dd-java-agent/appsec|dd-java-agent/testing|dd-trace-core|dd-trace-api|internal-api|communication "
3636debugger_modules: &debugger_modules "dd-java-agent/agent-debugger|dd-java-agent/agent-bootstrap|dd-java-agent/agent-builder|internal-api|communication|dd-trace-core"
3737profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"
3838
Original file line number Diff line number Diff line change @@ -117,13 +117,21 @@ private static OkHttpClient buildHttpClient(
117117 final long timeoutMillis ) {
118118 final OkHttpClient .Builder builder = new OkHttpClient .Builder ();
119119
120+ try {
121+ builder .eventListenerFactory (
122+ call -> {
123+ Request request = call .request ();
124+ CustomListener listener = request .tag (CustomListener .class );
125+ return listener != null ? listener : EventListener .NONE ;
126+ });
127+ } catch (NoSuchMethodError e ) {
128+ // A workaround for OKHTTP instrumentation tests
129+ // where the version of OKHTTP conflicts with the one used in this module.
130+ // This should never happen in "real life" as OKHTTP classes
131+ // used by the tracer core are relocated to a different package
132+ }
133+
120134 builder
121- .eventListenerFactory (
122- call -> {
123- Request request = call .request ();
124- CustomListener listener = request .tag (CustomListener .class );
125- return listener != null ? listener : EventListener .NONE ;
126- })
127135 .connectTimeout (timeoutMillis , MILLISECONDS )
128136 .writeTimeout (timeoutMillis , MILLISECONDS )
129137 .readTimeout (timeoutMillis , MILLISECONDS )
Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ public void onTestSuiteStart(
6767
6868 if (testFramework != null ) {
6969 testSuite .setTag (Tags .TEST_FRAMEWORK , testFramework );
70- }
71- if ( testFrameworkVersion != null ) {
72- testSuite . setTag ( Tags . TEST_FRAMEWORK_VERSION , testFrameworkVersion );
70+ if ( testFrameworkVersion != null ) {
71+ testSuite . setTag ( Tags . TEST_FRAMEWORK_VERSION , testFrameworkVersion );
72+ }
7373 }
7474 if (categories != null && !categories .isEmpty ()) {
7575 testSuite .setTag (
@@ -154,9 +154,9 @@ public void onTestStart(
154154
155155 if (testFramework != null ) {
156156 test .setTag (Tags .TEST_FRAMEWORK , testFramework );
157- }
158- if ( testFrameworkVersion != null ) {
159- test . setTag ( Tags . TEST_FRAMEWORK_VERSION , testFrameworkVersion );
157+ if ( testFrameworkVersion != null ) {
158+ test . setTag ( Tags . TEST_FRAMEWORK_VERSION , testFrameworkVersion );
159+ }
160160 }
161161 if (testParameters != null ) {
162162 test .setTag (Tags .TEST_PARAMETERS , testParameters );
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public class TracingListener implements EngineExecutionListener {
2020
2121 public TracingListener (TestEngine testEngine ) {
2222 String engineId = testEngine .getId ();
23- testFramework = engineId != null && engineId .startsWith ("junit" ) ? "junit5" : engineId ;
23+ testFramework = engineId == null || engineId .startsWith ("junit" ) ? "junit5" : engineId ;
2424 testFrameworkVersion = testEngine .getVersion ().orElse (null );
2525 }
2626
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ private static String buildIntakeTelemetryUrl(Config config) {
5959 String prefix = "" ;
6060 if (site .endsWith ("datad0g.com" )) {
6161 prefix = "all-http-intake.logs." ;
62- } else if (site .endsWith ("datadoghq.com" )) {
62+ } else if (site .endsWith ("datadoghq.com" ) || site . endsWith ( "datadoghq.eu" ) ) {
6363 prefix = "instrumentation-telemetry-intake." ;
6464 }
6565 return "https://" + prefix + site + "/api/v2/apmtelemetry" ;
Original file line number Diff line number Diff line change @@ -5,6 +5,29 @@ import spock.lang.Specification
55
66class TelemetryClientTest extends Specification {
77
8+ def " Intake client uses correct URL for site #site" () {
9+ setup :
10+ def config = Stub (Config )
11+ config. getApiKey() >> " dummy-key"
12+ config. getAgentTimeout() >> 123
13+ config. getSite() >> site
14+
15+ when :
16+ def intakeClient = TelemetryClient . buildIntakeClient(config)
17+
18+ then :
19+ intakeClient. getUrl(). toString() == expectedUrl
20+
21+ where :
22+ site | expectedUrl
23+ " datadoghq.com" | " https://instrumentation-telemetry-intake.datadoghq.com/api/v2/apmtelemetry"
24+ " us3.datadoghq.com" | " https://instrumentation-telemetry-intake.us3.datadoghq.com/api/v2/apmtelemetry"
25+ " us5.datadoghq.com" | " https://instrumentation-telemetry-intake.us5.datadoghq.com/api/v2/apmtelemetry"
26+ " ap1.datadoghq.com" | " https://instrumentation-telemetry-intake.ap1.datadoghq.com/api/v2/apmtelemetry"
27+ " datadoghq.eu" | " https://instrumentation-telemetry-intake.datadoghq.eu/api/v2/apmtelemetry"
28+ " datad0g.com" | " https://all-http-intake.logs.datad0g.com/api/v2/apmtelemetry"
29+ }
30+
831 def " Intake client uses CI Visibility agentless URL if configured to do so" () {
932 setup :
1033 def config = Stub (Config )
You can’t perform that action at this time.
0 commit comments