Skip to content

Commit

Permalink
feat(agent): two-way communications (#1608)
Browse files Browse the repository at this point in the history
* feat(agent): implement Agent HTTP dynamic JFR start (#1566)

* chore(svc): extract EventOptionsBuilder to -core and use new CryostatFlightRecorderService

* test(smoketest): enable API writes on one agent-equipped sample app

* chore(serial): extract recording descriptor to -core

* chore(activerecordings): clean up an error handler

* feat(agent): implement dynamic start of JFR over HTTP

* bump -core version

* feat(agent): implement Agent HTTP dynamic JFR stop/delete (#1604)

* feat(agent): implement Agent HTTP recording retrieval (#1607)

* feat(agent): implement HTTP JFR snapshot creation (#1627)

Co-authored-by: Atif Ali <56743004+aali309@users.noreply.github.com>
  • Loading branch information
andrewazores and aali309 authored Sep 19, 2023
1 parent f4a314b commit 3b46806
Show file tree
Hide file tree
Showing 37 changed files with 550 additions and 516 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<com.google.dagger.version>2.47</com.google.dagger.version>
<com.google.dagger.compiler.version>${com.google.dagger.version}</com.google.dagger.compiler.version>

<io.cryostat.core.version>2.21.1</io.cryostat.core.version>
<io.cryostat.core.version>2.22.0</io.cryostat.core.version>

<org.openjdk.nashorn.core.version>15.4</org.openjdk.nashorn.core.version>
<org.apache.commons.lang3.version>3.12.0</org.apache.commons.lang3.version>
Expand Down
1 change: 1 addition & 0 deletions smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ runDemoApps() {
--env CRYOSTAT_AGENT_TRUST_ALL="true" \
--env CRYOSTAT_AGENT_AUTHORIZATION="Basic $(echo user:pass | base64)" \
--env CRYOSTAT_AGENT_REGISTRATION_PREFER_JMX="false" \
--env CRYOSTAT_AGENT_API_WRITES_ENABLED="true" \
--rm -d quay.io/andrewazores/quarkus-test:latest

# copy a jboss-client.jar into /clientlib first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.openjdk.jmc.rjmx.services.jfr.IRecordingDescriptor;
import org.openjdk.jmc.rjmx.services.jfr.IRecordingDescriptor.RecordingState;

import io.cryostat.core.serialization.SerializableRecordingDescriptor;
import io.cryostat.recordings.RecordingMetadataManager.Metadata;

import org.apache.commons.lang3.builder.EqualsBuilder;
Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions src/main/java/io/cryostat/messaging/MessagingServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import io.cryostat.messaging.notifications.NotificationFactory;
import io.cryostat.messaging.notifications.NotificationListener;
import io.cryostat.net.AuthManager;
import io.cryostat.net.AuthorizationErrorException;
import io.cryostat.net.AuthenticationErrorException;
import io.cryostat.net.HttpServer;
import io.cryostat.net.security.ResourceAction;
import io.cryostat.net.web.http.HttpMimeType;
Expand Down Expand Up @@ -132,7 +132,7 @@ public void start() throws SocketException, UnknownHostException {
.onFailure(
() ->
promise.fail(
new AuthorizationErrorException(
new AuthenticationErrorException(
"")))
.execute();
} catch (InterruptedException
Expand All @@ -146,9 +146,9 @@ public void start() throws SocketException, UnknownHostException {
if (result.failed()) {
if (ExceptionUtils.hasCause(
result.cause(),
AuthorizationErrorException.class)) {
AuthenticationErrorException.class)) {
logger.info(
(AuthorizationErrorException)
(AuthenticationErrorException)
result.cause());
logger.info(
"Disconnected remote client {} due to"
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/io/cryostat/net/AgentApiException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright The Cryostat Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cryostat.net;

public class AgentApiException extends RuntimeException {
public AgentApiException(int statusCode) {
super(String.format("Unexpected HTTP response code %d", statusCode));
}
}
Loading

0 comments on commit 3b46806

Please sign in to comment.