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

Easy way to add deployment methods in Dev UI #39469

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

phillip-kruger
Copy link
Member

@phillip-kruger phillip-kruger commented Mar 15, 2024

Currently to add Dev UI methods that executes against the deployment classpath, you need to add the methods supplier in your deployment module, then call it again in your JsonRPC service with the same name. You are also responsible to add a namespace for your methods to that thei do not clash with other extensions.

Eg:
Deployment module

DevConsoleManager.register("logstream-force-restart", ignored -> {
    RuntimeUpdatesProcessor.INSTANCE.doScan(true, true);
    return Map.of();
});

Note the name for the method includes a "logstream" namespace.

Runtime Module

public Map forceRestart() {
    return DevConsoleManager.invoke("logstream-force-restart");
}

Note the name is the same.

In your javascript web component you can now call this method as you would any other json-rpc method:

this.jsonRpc.forceRestart().then ...

This PR tries to make this easier to add these type of methods in Dev UI. It removes the need for:

  • Anything in the runtime module. We will now route directly from the JsonRPC Routes, no need to add anything in the JsonRPC Service class.
  • Namespace. Just name your method, no need to give it a namespace. We will add the namespace based on your extension.

Example:
Deployment module

BuildTimeActionBuildItem keyStrokeActions = new BuildTimeActionBuildItem();

keyStrokeActions.addAction("forceRestart", ignored -> {
    RuntimeUpdatesProcessor.INSTANCE.doScan(true, true);
    return Map.of();
});

Note there is no namespace, you are safe to just use a method name. The part in js stays the same. And no need for anything in the runtime module.

This is still a draft. I still need to add support for parameter, convert some of the old ones (although old way of doing it will still work) and update the documentation.

@phillip-kruger phillip-kruger force-pushed the dev-ui-deployment-methods branch 2 times, most recently from 5385586 to 3c3b812 Compare March 16, 2024 06:59
@phillip-kruger phillip-kruger marked this pull request as ready for review March 16, 2024 06:59
@quarkus-bot

This comment has been minimized.

@cescoffier
Copy link
Member

The CI issues are related I think.

Signed-off-by: Phillip Kruger <phillip.kruger@gmail.com>
@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@phillip-kruger phillip-kruger force-pushed the dev-ui-deployment-methods branch 2 times, most recently from c73ed4f to bfebb6d Compare March 18, 2024 04:03
@quarkus-bot

This comment has been minimized.

Signed-off-by: Phillip Kruger <phillip.kruger@gmail.com>
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 18, 2024

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 47eed63.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

⚠️ There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

github-actions bot commented Mar 18, 2024

🙈 The PR is closed and the preview is expired.

@quarkus-bot

This comment has been minimized.

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 18, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 47eed63.

Failing Jobs

Status Name Step Failures Logs Raw logs Build scan
MicroProfile TCKs Tests Verify Failures Logs Raw logs 🚧

Full information is available in the Build summary check run.

Failures

⚙️ MicroProfile TCKs Tests #

- Failing: tcks/microprofile-opentelemetry 

📦 tcks/microprofile-opentelemetry

org.eclipse.microprofile.telemetry.tracing.tck.async.MpRestClientAsyncTest.testIntegrationWithMpRestClientAsync - History - More details - Source on GitHub

java.util.concurrent.RejectedExecutionException: event executor terminated
	at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:934)
	at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:351)
	at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:344)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:836)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute0(SingleThreadEventExecutor.java:827)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:817)
	at io.vertx.core.impl.EventLoopExecutor.execute(EventLoopExecutor.java:35)

Flaky tests - Develocity

⚙️ JVM Tests - JDK 17 Windows

📦 extensions/websockets-next/server/deployment

io.quarkus.websockets.next.test.broadcast.BroadcastOnOpenTest.testLoMultiBidi - History

  • Messages: [c2] ==> expected: <true> but was: <false> - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: Messages: [c2] ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:214)
	at io.quarkus.websockets.next.test.broadcast.BroadcastOnOpenTest.assertBroadcast(BroadcastOnOpenTest.java:98)
	at io.quarkus.websockets.next.test.broadcast.BroadcastOnOpenTest.testLoMultiBidi(BroadcastOnOpenTest.java:50)

⚙️ JVM Tests - JDK 21

📦 integration-tests/opentelemetry

io.quarkus.it.opentelemetry.EndUserEnabledTest.baseTest - History

  • AttributesMap{data={code.function=dummy, http.target=/otel/enduser, net.host.name=localhost, user_agent.original=Apache-HttpClient/4.5.14 (Java/21.0.2), http.client_ip=127.0.0.1, http.route=/otel/enduser, http.status_code=200, net.host.port=8081, code.namespace=io.quarkus.it.opentelemetry.util.EndUserResource, http.response_content_length=0, http.scheme=http, http.method=GET, net.protocol.name=http}, capacity=128, totalAddedValues=13} ==> expected: <testUser> but was: <null> - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: AttributesMap{data={code.function=dummy, http.target=/otel/enduser, net.host.name=localhost, user_agent.original=Apache-HttpClient/4.5.14 (Java/21.0.2), http.client_ip=127.0.0.1, http.route=/otel/enduser, http.status_code=200, net.host.port=8081, code.namespace=io.quarkus.it.opentelemetry.util.EndUserResource, http.response_content_length=0, http.scheme=http, http.method=GET, net.protocol.name=http}, capacity=128, totalAddedValues=13} ==> expected: <testUser> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
	at io.quarkus.it.opentelemetry.EndUserEnabledTest.evaluateAttributes(...

@cescoffier cescoffier merged commit 82234f6 into quarkusio:main Mar 18, 2024
52 of 53 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.10 - main milestone Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants