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

FullMicroprofile ported to new tracing API, MP6+ Q3.6+ #227

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
247 changes: 247 additions & 0 deletions apps/quarkus-full-microprofile/quarkus_3.6.x.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
diff --git a/apps/quarkus-full-microprofile/pom.xml b/apps/quarkus-full-microprofile/pom.xml
index ce7df81..c047cd9 100644
--- a/apps/quarkus-full-microprofile/pom.xml
+++ b/apps/quarkus-full-microprofile/pom.xml
@@ -61,7 +61,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
- <artifactId>quarkus-smallrye-opentracing</artifactId>
+ <artifactId>quarkus-opentelemetry</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/HelloController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/HelloController.java
index 0694ce6..88d552c 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/HelloController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/HelloController.java
@@ -1,8 +1,8 @@
package com.example.quarkus;

-import javax.inject.Singleton;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;

@Path("/hello")
@Singleton
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/QuarkusRestApplication.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/QuarkusRestApplication.java
index 068ba12..410a130 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/QuarkusRestApplication.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/QuarkusRestApplication.java
@@ -1,7 +1,7 @@
package com.example.quarkus;

-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
+import jakarta.ws.rs.ApplicationPath;
+import jakarta.ws.rs.core.Application;

@ApplicationPath("/data")
public class QuarkusRestApplication extends Application {
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ClientController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ClientController.java
index 0f593eb..7360fcc 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ClientController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ClientController.java
@@ -2,11 +2,11 @@ package com.example.quarkus.client;

import org.eclipse.microprofile.rest.client.inject.RestClient;

-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;

@Path("/client")
@ApplicationScoped
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/Service.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/Service.java
index ac9a4a5..35bcb99 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/Service.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/Service.java
@@ -2,10 +2,10 @@ package com.example.quarkus.client;

import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

-import javax.enterprise.context.ApplicationScoped;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;

@RegisterRestClient
@ApplicationScoped
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ServiceController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ServiceController.java
index 24a228d..6ec43f9 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ServiceController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/client/ServiceController.java
@@ -1,8 +1,8 @@
package com.example.quarkus.client;

-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;

@Path("/client/service")
public class ServiceController {
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/config/ConfigTestController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/config/ConfigTestController.java
index 8119c23..517fe6f 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/config/ConfigTestController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/config/ConfigTestController.java
@@ -4,10 +4,10 @@ import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.inject.ConfigProperty;

-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;

/**
* !!! DO NOT TOUCH THE SOURCE WITHOUT EDITING GDBSession.java !!!
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceLiveHealthCheck.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceLiveHealthCheck.java
index fea754c..d1ad0a6 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceLiveHealthCheck.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceLiveHealthCheck.java
@@ -4,7 +4,7 @@ import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;

-import javax.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.context.ApplicationScoped;

@Liveness
@ApplicationScoped
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceReadyHealthCheck.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceReadyHealthCheck.java
index 6bb6374..cd7ac7a 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceReadyHealthCheck.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/health/ServiceReadyHealthCheck.java
@@ -4,7 +4,7 @@ import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Readiness;

-import javax.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.context.ApplicationScoped;

@Readiness
@ApplicationScoped
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/metric/MetricController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/metric/MetricController.java
index 1f4c2df..db4c9fa 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/metric/MetricController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/metric/MetricController.java
@@ -6,10 +6,10 @@ import org.eclipse.microprofile.metrics.annotation.Gauge;
import org.eclipse.microprofile.metrics.annotation.Metric;
import org.eclipse.microprofile.metrics.annotation.Timed;

-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
import java.util.Random;

@Path("/metric")
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/resilient/ResilienceController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/resilient/ResilienceController.java
index 04cf5fb..fc34f8e 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/resilient/ResilienceController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/resilient/ResilienceController.java
@@ -3,9 +3,9 @@ package com.example.quarkus.resilient;
import org.eclipse.microprofile.faulttolerance.Fallback;
import org.eclipse.microprofile.faulttolerance.Timeout;

-import javax.enterprise.context.ApplicationScoped;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;

@Path("/resilience")
@ApplicationScoped
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/ProtectedController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/ProtectedController.java
index 4447db7..1d54637 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/ProtectedController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/ProtectedController.java
@@ -3,11 +3,11 @@ package com.example.quarkus.secure;
import org.eclipse.microprofile.jwt.Claim;
import org.eclipse.microprofile.jwt.ClaimValue;

-import javax.annotation.security.RolesAllowed;
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
+import jakarta.annotation.security.RolesAllowed;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;

@Path("/protected")
@RequestScoped
diff --git a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/TestSecureController.java b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/TestSecureController.java
index fb82305..a95c3f0 100644
--- a/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/TestSecureController.java
+++ b/apps/quarkus-full-microprofile/src/main/java/com/example/quarkus/secure/TestSecureController.java
@@ -5,14 +5,14 @@ import io.vertx.ext.auth.PubSecKeyOptions;
import io.vertx.ext.auth.jwt.JWTAuth;
import io.vertx.ext.auth.jwt.JWTAuthOptions;

-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.WebApplicationException;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.core.Response;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
diff --git a/apps/quarkus-full-microprofile/src/main/resources/application.properties b/apps/quarkus-full-microprofile/src/main/resources/application.properties
index 30c3d85..aacd280 100644
--- a/apps/quarkus-full-microprofile/src/main/resources/application.properties
+++ b/apps/quarkus-full-microprofile/src/main/resources/application.properties
@@ -5,8 +5,10 @@ quarkus.ssl.native=true
mp.jwt.verify.publickey.location=META-INF/resources/publicKey.pem
mp.jwt.verify.issuer=https://server.example.com
quarkus.smallrye-jwt.enabled=true
-quarkus.jaeger.service-name=Demo-Service-A
-quarkus.jaeger.sampler-type=const
-quarkus.jaeger.sampler-param=1
-quarkus.jaeger.endpoint=http://localhost:14268/api/traces
+quarkus.otel.traces.exporter=cdi
+quarkus.otel.traces.sampler=parentbased_always_on
+quarkus.otel.traces.eusp.enabled=true
+quarkus.otel.service.name=Demo-Service-A
+quarkus.otel.exporter.otlp.endpoint=http://localhost:4317
+quarkus.otel.exporter.otlp.traces.endpoint=http://localhost:4317
quarkus.native.resources.includes=privateKey.pem
4 changes: 2 additions & 2 deletions apps/quarkus-full-microprofile/threshold.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
linux.time.to.first.ok.request.threshold.ms=300
linux.RSS.threshold.kB=120000
linux.executable.size.threshold.kB=73500
linux.executable.size.threshold.kB=79000
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to make these Quarkus/Mandrel specific.

My understanding is that you are increasing the threshold for Quarkus 3.6, but this will make us miss increases happening in 3.2 for instance.

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link
Owner Author

Choose a reason for hiding this comment

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

@zakkak Yes. The increase is caused by OpenTelemetry being a much bigger library than OpenTracing apparently.

The "design" of the property files did not take into account the Q versions.

We can start having some per-quarkus-version property files. Perhaps per Mandrel major.minor too.

Non-quarkus apps would have just the Mandrel major.minor?

Wondering how to make it nice and tidy without inflating the logic too much.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Non-quarkus apps would have just the Mandrel major.minor?

Yes

Wondering how to make it nice and tidy without inflating the logic too much.

I need something similar in quarkusio/quarkus#36108 and I was thinking about using a directory structure like <quarkus-version>/<mandrel-version>/threshold.properties. WDYT?

windows.time.to.first.ok.request.threshold.ms=1537
windows.RSS.threshold.kB=120000
windows.executable.size.threshold.kB=75000
windows.executable.size.threshold.kB=79000
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.graalvm.tests.integration.utils.GDBSession;
import org.graalvm.tests.integration.utils.Logs;
import org.graalvm.tests.integration.utils.WebpageTester;
import org.graalvm.tests.integration.utils.versions.IfQuarkusVersion;
import org.graalvm.tests.integration.utils.versions.QuarkusVersion;
import org.graalvm.tests.integration.utils.versions.UsedVersion;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -207,7 +206,6 @@ public void debugSymbolsSmokeGDB(TestInfo testInfo) throws IOException, Interrup
@Test
@Tag("debugSymbolsQuarkus")
@DisabledOnOs({OS.WINDOWS})
@IfQuarkusVersion(max = "3.5.999")
public void debugSymbolsQuarkus(TestInfo testInfo) throws IOException, InterruptedException {
final Apps app = Apps.DEBUG_QUARKUS_FULL_MICROPROFILE;
LOGGER.info("Testing app: " + app);
Expand All @@ -216,15 +214,22 @@ public void debugSymbolsQuarkus(TestInfo testInfo) throws IOException, Interrupt
final File appDir = Path.of(BASE_DIR, app.dir).toFile();
final String cn = testInfo.getTestClass().get().getCanonicalName();
final String mn = testInfo.getTestMethod().get().getName();
final String patch;
if (QUARKUS_VERSION.compareTo(new QuarkusVersion("3.6.0")) >= 0 || QUARKUS_VERSION.isSnapshot()) {
patch = "quarkus_3.6.x.patch";
} else if (QUARKUS_VERSION.majorIs(3)) {
patch = "quarkus_3.x.patch";
} else {
patch = null;
}
try {
// Cleanup
cleanTarget(app);
Files.createDirectories(Paths.get(appDir.getAbsolutePath() + File.separator + "logs"));

// Patch for compatibility
if (QUARKUS_VERSION.majorIs(3) || QUARKUS_VERSION.isSnapshot()) {
runCommand(getRunCommand("git", "apply", "quarkus_3.x.patch"),
Path.of(BASE_DIR, app.dir).toFile());
if (patch != null) {
runCommand(getRunCommand("git", "apply", patch), appDir);
}

// Build
Expand Down Expand Up @@ -294,9 +299,8 @@ public void debugSymbolsQuarkus(TestInfo testInfo) throws IOException, Interrupt
Logs.checkLog(cn, mn, app, processLog);
} finally {
cleanup(null, cn, mn, report, app, processLog);
if (QUARKUS_VERSION.majorIs(3) || QUARKUS_VERSION.isSnapshot()) {
runCommand(getRunCommand("git", "apply", "-R", "quarkus_3.x.patch"),
Path.of(BASE_DIR, app.dir).toFile());
if (patch != null) {
runCommand(getRunCommand("git", "apply", "-R", patch), appDir);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.graalvm.tests.integration.utils.Uploader;
import org.graalvm.tests.integration.utils.WebpageTester;
import org.graalvm.tests.integration.utils.versions.IfMandrelVersion;
import org.graalvm.tests.integration.utils.versions.IfQuarkusVersion;
import org.graalvm.tests.integration.utils.versions.QuarkusVersion;
import org.graalvm.tests.integration.utils.versions.UsedVersion;
import org.jboss.logging.Logger;
import org.jboss.resteasy.spi.HttpResponseCodes;
Expand Down Expand Up @@ -398,7 +398,6 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx

@Test
@IfMandrelVersion(min = "21.3")
@IfQuarkusVersion(max = "3.5.999")
public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, InterruptedException, URISyntaxException {
final Apps app = Apps.QUARKUS_FULL_MICROPROFILE_PERF;
LOGGER.info("Testing app: " + app);
Expand All @@ -408,22 +407,32 @@ public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, I
final String cn = testInfo.getTestClass().get().getCanonicalName();
final String mn = testInfo.getTestMethod().get().getName();
final List<Map<String, String>> reports = new ArrayList<>(2);
final String patch;
if (QUARKUS_VERSION.compareTo(new QuarkusVersion("3.6.0")) >= 0 || QUARKUS_VERSION.isSnapshot()) {
patch = "quarkus_3.6.x.patch";
} else if (QUARKUS_VERSION.majorIs(3)) {
patch = "quarkus_3.x.patch";
} else {
patch = null;
}
try {
// Cleanup
cleanTarget(app);
Files.createDirectories(Paths.get(appDir.getAbsolutePath(), "logs"));
assertTrue(app.buildAndRunCmds.cmds.length > 1);

if (QUARKUS_VERSION.majorIs(3) || QUARKUS_VERSION.isSnapshot()) {
runCommand(getRunCommand("git", "apply", "quarkus_3.x.patch"), appDir);
if (patch != null) {
runCommand(getRunCommand("git", "apply", patch), appDir);
}

// Build executables
final Map<String, String> switches = new HashMap<>();
if (UsedVersion.getVersion(false).compareTo(Version.create(22, 2, 0)) >= 0) {
switches.put(GRAALVM_BUILD_OUTPUT_JSON_FILE, "," + GRAALVM_BUILD_OUTPUT_JSON_FILE_SWITCH + "quarkus-json.json");
if (UsedVersion.getVersion(false).compareTo(Version.create(23, 1, 0)) >= 0) {
switches.put(GRAALVM_BUILD_OUTPUT_JSON_FILE, ",-H:+UnlockExperimentalVMOptions," + GRAALVM_BUILD_OUTPUT_JSON_FILE_SWITCH + "quarkus-json.json,-H:-UnlockExperimentalVMOptions");
switches.put("-H:Log=registerResource:", "-H:+UnlockExperimentalVMOptions,-H:Log=registerResource:,-H:-UnlockExperimentalVMOptions");
} else {
switches.put(GRAALVM_BUILD_OUTPUT_JSON_FILE, "," + GRAALVM_BUILD_OUTPUT_JSON_FILE_SWITCH + "quarkus-json.json");
}
} else {
switches.put(GRAALVM_BUILD_OUTPUT_JSON_FILE, "");
Expand Down Expand Up @@ -515,8 +524,8 @@ public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, I
"target", "quarkus-native-image-source-jar", "quarkus-json.json").toFile());
Logs.archiveLog(cn, mn, processLog);
cleanTarget(app);
if (QUARKUS_VERSION.majorIs(3) || QUARKUS_VERSION.isSnapshot()) {
runCommand(getRunCommand("git", "apply", "-R", "quarkus_3.x.patch"), appDir);
if (patch != null) {
runCommand(getRunCommand("git", "apply", "-R", patch), appDir);
}
}
}
Expand Down
Loading