Skip to content

Conversation

@LuboViluda
Copy link
Contributor

@LuboViluda LuboViluda commented May 16, 2022

What Does This Do

  • providing support for Vert.x web 4
  • Vert.x HttpServerResponseImpl class was replaced between versions 3 and 4. Reflect changes in instrumentation.
  • Migrate other parts of code to Vert.x 4
  • Migrate all Vert.x 3 tests to 4.

Motivation

  • provide instrumentation for Vert.x 4 (currently broken)

Additional Notes / open questions

  • main instrumentation related change is in HttpServerResponseEndHandlerInstrumentation class when the change in underlying Vert.x classes is reflected
  • some test fails currently:
./gradlew :dd-java-agent:instrumentation:vertx-web-4.0:test
136 tests completed, 90 failed, 23 skipped
  • What is a minimal test suite to get this merged? I couldn't really see from run of Vert.x vertx-3.4 tests what is the number of successful tests there as the final output doesn't provide this (the immediate step before the success message is showing around 130). But some constructs seem suspicious for Vert.x 3 test suite (fe. setting Vert.x clustering port for local test server - but maybe I'm lacking some internal Vert.x knowledge, why this is there)

@LuboViluda LuboViluda requested a review from a team as a code owner May 16, 2022 10:34
@devinsba
Copy link
Contributor

Thanks @LuboViluda, I'm going to try to review this this week but unfortunately the vertx integrations are large so it may take a while

Copy link
Contributor

@devinsba devinsba left a comment

Choose a reason for hiding this comment

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

The version numbers will need to be addressed. Then just the one question

Copy link
Contributor

@devinsba devinsba left a comment

Choose a reason for hiding this comment

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

This will probably fix the tests

@devinsba
Copy link
Contributor

You can see the failing tests here: https://app.circleci.com/pipelines/github/DataDog/dd-trace-java/13590/workflows/64d950e9-c130-4d62-83b3-cecc8415eb39/jobs/298083/tests

Don't worry about the "instrumentation gateway" ones for now. The others like like they might just be a slight difference in how things were implemented

@ValentinZakharov can you see if there's an obvious reason that the instrumentation gateway tests failed?

@LuboViluda
Copy link
Contributor Author

LuboViluda commented May 22, 2022

You can see the failing tests here: https://app.circleci.com/pipelines/github/DataDog/dd-trace-java/13590/workflows/64d950e9-c130-4d62-83b3-cecc8415eb39/jobs/298083/tests

Don't worry about the "instrumentation gateway" ones for now. The others like like they might just be a slight difference in how things were implemented

@ValentinZakharov can you see if there's an obvious reason that the instrumentation gateway tests failed?

  • Thanks, double "/" in span resourceName is probably cause for a lot of failure, not sure if some toString/reporting Vert.x. method changed and broke this
  • if I find what change, what is the simplest path to fix this? (fe. implement some interceptor?)
assert span.resourceName.toString() == name
       |    |            |          |  |
       |    |            |          |  'GET /sub/success'
       |    |            |          false
       |    |            'GET /sub//success'
       |    GET /sub//success

from server.VertxSubrouterForkedTest

@LuboViluda
Copy link
Contributor Author

Hello devinsba,

I have committed change for correct path concatenation (deduplication of "//" to "/"). It fixed a nice number of tests. Fe. z_test_8_inst went from 32 failed tests to 4 failed tests (3 mentioning Gateway directly). Any idea how to fix Gateway related tests?

ext {
minJavaVersionForTests = JavaVersion.VERSION_1_8
// TODO Java 17: This version of vertx-web doesn't support Java 17
maxJavaVersionForTests = JavaVersion.VERSION_15
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this true, or does this version work on Java 17?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems Java 17 is supported by Vertx web 4.2 and above

https://vertx.io/blog/whats-new-in-vert-x-4-2/#java-17

@LuboViluda
Copy link
Contributor Author

@bantonsson @devinsba
tests are passing now, thanks for all the suggestions. I fixed the static analysis check as well (was failing on usage String.replaceAll).

Do you have any suggestions for failing the system-tests and muzzle build step?

@devinsba
Copy link
Contributor

devinsba commented Jun 1, 2022

You can ignore the system-tests but we do need to fix muzzle. What the failure seems to be telling us is that one of the instrumentation classes works for more versions than the range [4.0.0,5)

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.4.2 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.8.5 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.9.13 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.9.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.5.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.7.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.7.1 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.5.4 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.4.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.6.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.6.3 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.8.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

We usually fix this by adding a method to the advice class that depends on something that was added in the lowest version, see: https://github.com/DataDog/dd-trace-java/blob/master/dd-java-agent/instrumentation/jetty-9/src/main/java/datadog/trace/instrumentation/jetty9/JettyServerInstrumentation.java#L147

@LuboViluda
Copy link
Contributor Author

You can ignore the system-tests but we do need to fix muzzle. What the failure seems to be telling us is that one of the instrumentation classes works for more versions than the range [4.0.0,5)

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.4.2 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.8.5 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.9.13 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.9.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.5.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.7.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.7.1 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.5.4 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.4.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.6.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.6.3 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

> Task :dd-java-agent:instrumentation:vertx-web-4.0:muzzle-AssertFail-io.vertx-vertx-web-3.8.0 FAILED
MUZZLE PASSED HttpServerResponseEndHandlerInstrumentation BUT FAILURE WAS EXPECTED

We usually fix this by adding a method to the advice class that depends on something that was added in the lowest version, see: https://github.com/DataDog/dd-trace-java/blob/master/dd-java-agent/instrumentation/jetty-9/src/main/java/datadog/trace/instrumentation/jetty9/JettyServerInstrumentation.java#L147

Thanks for the suggestion @devinsba. I have already bound instrumentation on the class which was added in Vert.x 4 (similar as Vertx 3 instrumentation is doing it) in VertxVersionMatcher. The class should be in Vertx 4, but not in the Vertx 3. I will take another look, at if I ported changes correctly and what possibly could go wrong (maybe the class exist on other path in Vert.x 3.x)

@devinsba
Copy link
Contributor

devinsba commented Jun 8, 2022

@LuboViluda
Copy link
Contributor Author

@devinsba
Copy link
Contributor

devinsba commented Jun 8, 2022

Ah, thanks. My git config was wrong

@devinsba devinsba force-pushed the 3143-addSupportFor-vertx-web-4 branch from 1f87744 to 662b63f Compare June 8, 2022 18:10
@devinsba devinsba added inst: others All other instrumentations tag: community Community contribution inst: vertx Eclipse Vert.x instrumentation labels Jun 8, 2022
Copy link
Contributor

@devinsba devinsba left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@devinsba devinsba merged commit 5e25caf into DataDog:master Jun 14, 2022
@devinsba devinsba added this to the 0.103.0 milestone Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: others All other instrumentations inst: vertx Eclipse Vert.x instrumentation tag: community Community contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants