You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2018/10/03 21:58:02 UTC
[1/2] storm git commit: STORM-3239: Adding dumpjstack action and
removing wrong timeout parameter
Repository: storm
Updated Branches:
refs/heads/master a6f76df3f -> 2bc519f08
STORM-3239: Adding dumpjstack action and removing wrong timeout parameter
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/954c810e
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/954c810e
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/954c810e
Branch: refs/heads/master
Commit: 954c810e150971e94219ec192f16fdd7d772d8df
Parents: c367f9a
Author: Govind Menon <go...@gmail.com>
Authored: Sun Sep 30 19:30:23 2018 -0500
Committer: Govind Menon <go...@gmail.com>
Committed: Sun Sep 30 19:30:23 2018 -0500
----------------------------------------------------------------------
.../org/apache/storm/daemon/ui/UIHelpers.java | 48 +++++++++++-------
.../daemon/ui/resources/StormApiResource.java | 52 +++++++++++++-------
2 files changed, 64 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/954c810e/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java
----------------------------------------------------------------------
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java
index 8237009..8192311 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java
@@ -1846,11 +1846,11 @@ public class UIHelpers {
public static Map<String, Object> getActiveAction(ProfileRequest profileRequest, Map config, String topologyId) {
Map<String, Object> result = new HashMap();
result.put("host", profileRequest.get_nodeInfo().get_node());
- result.put("port", String.valueOf(profileRequest.get_nodeInfo().get_port().iterator().next()));
+ result.put("port", String.valueOf(profileRequest.get_nodeInfo().get_port().toArray()[0]));
result.put("dumplink",
getWorkerDumpLink(
profileRequest.get_nodeInfo().get_node(),
- profileRequest.get_nodeInfo().get_port().iterator().next(), topologyId, config
+ (Long) profileRequest.get_nodeInfo().get_port().toArray()[0], topologyId, config
));
result.put("timestamp", System.currentTimeMillis() - profileRequest.get_time_stamp());
return result;
@@ -2165,21 +2165,20 @@ public class UIHelpers {
* @param client client
* @param id id
* @param hostPort hostPort
- * @param timeout timeout
+ * @param timestamp timestamp
* @param config config
* @param profileAction profileAction
* @throws TException TException
*/
public static void getTopologyProfilingAction(
Nimbus.Iface client, String id,
- String hostPort, String timeout, Map<String,
+ String hostPort, Long timestamp, Map<String,
Object> config, ProfileAction profileAction) throws TException {
String host = hostPort.split(":")[0];
Set<Long> ports = new HashSet();
String port = hostPort.split(":")[1];
ports.add(Long.valueOf(port));
NodeInfo nodeInfo = new NodeInfo(host, ports);
- Long timestamp = System.currentTimeMillis() + Long.valueOf(timeout);
ProfileRequest profileRequest = new ProfileRequest(nodeInfo, profileAction);
profileRequest.set_time_stamp(timestamp);
client.setWorkerProfiler(id, profileRequest);
@@ -2198,7 +2197,9 @@ public class UIHelpers {
public static Map<String, Object> getTopologyProfilingStart(Nimbus.Iface client, String id,
String hostPort, String timeout,
Map<String, Object> config) throws TException {
- getTopologyProfilingAction(client, id , hostPort, timeout, config, ProfileAction.JPROFILE_START);
+ getTopologyProfilingAction(
+ client, id , hostPort, System.currentTimeMillis() + Long.valueOf(timeout),
+ config, ProfileAction.JPROFILE_START);
Map<String, Object> result = new HashMap();
String host = hostPort.split(":")[0];
String port = hostPort.split(":")[1];
@@ -2214,15 +2215,14 @@ public class UIHelpers {
* @param client client
* @param id id
* @param hostPort hostPort
- * @param timeout timeout
* @param config config
* @return getTopologyProfilingStop
* @throws TException TException
*/
public static Map<String, Object> getTopologyProfilingStop(Nimbus.Iface client, String id,
- String hostPort, String timeout,
+ String hostPort,
Map<String, Object> config) throws TException {
- getTopologyProfilingAction(client, id , hostPort, timeout, config, ProfileAction.JPROFILE_STOP);
+ getTopologyProfilingAction(client, id , hostPort, 0L, config, ProfileAction.JPROFILE_STOP);
Map<String, Object> result = new HashMap();
result.put("status", "ok");
result.put("id", hostPort);
@@ -2245,15 +2245,28 @@ public class UIHelpers {
* @param client client
* @param id id
* @param hostPort hostPort
- * @param timeout timeout
* @param config config
* @return getTopologyProfilingDump
* @throws TException TException
*/
public static Map<String, Object> getTopologyProfilingDump(Nimbus.Iface client, String id, String hostPort,
- String timeout,
Map<String,Object> config) throws TException {
- getTopologyProfilingAction(client, id , hostPort, timeout, config, ProfileAction.JPROFILE_DUMP);
+ getTopologyProfilingAction(
+ client, id , hostPort, System.currentTimeMillis(),
+ config, ProfileAction.JPROFILE_DUMP
+ );
+ Map<String, Object> result = new HashMap();
+ result.put("status", "ok");
+ result.put("id", hostPort);
+ return result;
+ }
+
+ public static Map<String, Object> getTopologyProfilingDumpJstack(Nimbus.Iface client, String id,
+ String hostPort, Map<String,
+ Object> config) throws TException {
+ getTopologyProfilingAction(
+ client, id , hostPort, System.currentTimeMillis(), config, ProfileAction.JSTACK_DUMP
+ );
Map<String, Object> result = new HashMap();
result.put("status", "ok");
result.put("id", hostPort);
@@ -2265,15 +2278,16 @@ public class UIHelpers {
* @param client client
* @param id id
* @param hostPort hostPort
- * @param timeout timeout
* @param config config
* @return getTopologyProfilingRestartWorker
* @throws TException TException
*/
public static Map<String, Object> getTopologyProfilingRestartWorker(Nimbus.Iface client,
- String id, String hostPort, String timeout,
+ String id, String hostPort,
Map<String,Object> config) throws TException {
- getTopologyProfilingAction(client, id , hostPort, timeout, config, ProfileAction.JVM_RESTART);
+ getTopologyProfilingAction(
+ client, id , hostPort, System.currentTimeMillis(), config, ProfileAction.JVM_RESTART
+ );
Map<String, Object> result = new HashMap();
result.put("status", "ok");
result.put("id", hostPort);
@@ -2285,15 +2299,13 @@ public class UIHelpers {
* @param client client
* @param id id
* @param hostPort hostport
- * @param timeout timeout
* @param config config
* @return getTopologyProfilingDumpHeap
* @throws TException TException
*/
public static Map<String, Object> getTopologyProfilingDumpHeap(Nimbus.Iface client, String id, String hostPort,
- String timeout,
Map<String,Object> config) throws TException {
- getTopologyProfilingAction(client, id , hostPort, timeout, config, ProfileAction.JMAP_DUMP);
+ getTopologyProfilingAction(client, id , hostPort, System.currentTimeMillis(), config, ProfileAction.JMAP_DUMP);
Map<String, Object> result = new HashMap();
result.put("status", "ok");
result.put("id", hostPort);
http://git-wip-us.apache.org/repos/asf/storm/blob/954c810e/storm-webapp/src/main/java/org/apache/storm/daemon/ui/resources/StormApiResource.java
----------------------------------------------------------------------
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/resources/StormApiResource.java b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/resources/StormApiResource.java
index 24c00ef..f9f80a7 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/resources/StormApiResource.java
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/resources/StormApiResource.java
@@ -405,7 +405,7 @@ public class StormApiResource {
}
/**
- * /api/v1//topology/:id/component/:component -> component.
+ * /api/v1/topology/:id/component/:component -> component.
*/
@GET
@Path("/topology/{id}/component/{component}")
@@ -596,7 +596,7 @@ public class StormApiResource {
}
/**
- * /api/v1/topology/:id/profiling/start/:host-port/:timeout -> profiling tart.
+ * /api/v1/topology/:id/profiling/start/:host-port/:timeout -> profiling start.
*/
@GET
@Path("/topology/{id}/profiling/start/{host-port}/{timeout}")
@@ -615,58 +615,75 @@ public class StormApiResource {
}
/**
- * /api/v1/topology/:id/profiling/stop/:host-port/:timeout -> profiling stop.
+ * /api/v1/topology/:id/profiling/stop/:host-port -> profiling stop.
*/
@GET
- @Path("/topology/{id}/profiling/stop/{host-port}/{timeout}")
+ @Path("/topology/{id}/profiling/stop/{host-port}")
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
@Produces("application/json")
public Response getTopologyProfilingStop(@PathParam("id") String id,
@PathParam("host-port") String hostPort,
- @PathParam("timeout") String timeout,
@QueryParam(callbackParameterName) String callback) throws TException {
try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) {
return UIHelpers.makeStandardResponse(
- UIHelpers.getTopologyProfilingStop(nimbusClient.getClient(), id, hostPort, timeout, config),
+ UIHelpers.getTopologyProfilingStop(nimbusClient.getClient(), id, hostPort, config),
callback
);
}
}
/**
- * /api/v1/topology/:id/profiling/dumpprofile/:host-port/:timeout -> dump profile.
+ * /api/v1/topology/:id/profiling/dumpprofile/:host-port -> dump profile.
*/
@GET
- @Path("/topology/{id}/profiling/dumpprofile/{host-port}/{timeout}")
+ @Path("/topology/{id}/profiling/dumpprofile/{host-port}")
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
@Produces("application/json")
public Response getTopologyProfilingDumpProfile(@PathParam("id") String id,
@PathParam("host-port") String hostPort,
- @PathParam("timeout") String timeout,
@QueryParam(callbackParameterName) String callback) throws TException {
try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) {
return UIHelpers.makeStandardResponse(
- UIHelpers.getTopologyProfilingDump(nimbusClient.getClient(), id, hostPort, timeout, config),
+ UIHelpers.getTopologyProfilingDump(nimbusClient.getClient(), id, hostPort, config),
callback
);
}
}
/**
- * /api/v1/topology/:id/profiling/restartworker/:host-port/:timeout -> restart worker.
+ * /api/v1/topology/:id/profiling/dumpjstack/:host-port -> dump jstack.
*/
@GET
- @Path("/topology/{id}/profiling/restartworker/{host-port}/{timeout}")
+ @Path("/topology/{id}/profiling/dumpjstack/{host-port}")
+ @AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
+ @Produces("application/json")
+ public Response getTopologyProfilingDumpJstack(@PathParam("id") String id,
+ @PathParam("host-port") String hostPort,
+ @QueryParam(callbackParameterName) String callback) throws TException {
+ try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) {
+ return UIHelpers.makeStandardResponse(
+ UIHelpers.getTopologyProfilingDumpJstack(
+ nimbusClient.getClient(), id, hostPort, config
+ ),
+ callback
+ );
+ }
+ }
+
+ /**
+ * /api/v1/topology/:id/profiling/restartworker/:host-port -> restart worker.
+ */
+ @GET
+ @Path("/topology/{id}/profiling/restartworker/{host-port}")
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
@Produces("application/json")
public Response getTopologyProfilingRestartWorker(@PathParam("id") String id,
@PathParam("host-port") String hostPort,
- @PathParam("timeout") String timeout,
@QueryParam(callbackParameterName) String callback) throws TException {
try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) {
return UIHelpers.makeStandardResponse(
UIHelpers.getTopologyProfilingRestartWorker(
- nimbusClient.getClient(), id, hostPort, timeout, config
+ nimbusClient.getClient(), id, hostPort, config
),
callback
);
@@ -674,20 +691,19 @@ public class StormApiResource {
}
/**
- * /api/v1/topology/:id/profiling/dumpheap/:host-port/:timeout -> dump heap.
+ * /api/v1/topology/:id/profiling/dumpheap/:host-port -> dump heap.
*/
@GET
- @Path("/topology/{id}/profiling/dumpheap/{host-port}/{timeout}")
+ @Path("/topology/{id}/profiling/dumpheap/{host-port}")
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
@Produces("application/json")
public Response getTopologyProfilingDumpheap(@PathParam("id") String id,
@PathParam("host-port") String hostPort,
- @PathParam("timeout") String timeout,
@QueryParam(callbackParameterName) String callback) throws TException {
try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) {
return UIHelpers.makeStandardResponse(
UIHelpers.getTopologyProfilingDumpHeap(
- nimbusClient.getClient(), id, hostPort, timeout, config
+ nimbusClient.getClient(), id, hostPort, config
),
callback
);
[2/2] storm git commit: Merge branch 'STORM-3239' of
https://github.com/govind-menon/storm into STORM-3239
Posted by bo...@apache.org.
Merge branch 'STORM-3239' of https://github.com/govind-menon/storm into STORM-3239
STORM-3239: Adding dumpjstack action and removing wrong timeout param
This closes #2854
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/2bc519f0
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/2bc519f0
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/2bc519f0
Branch: refs/heads/master
Commit: 2bc519f083832bd1b5a458c6b6529c6c16fd69ce
Parents: a6f76df 954c810
Author: Robert Evans <ev...@yahoo-inc.com>
Authored: Wed Oct 3 16:27:29 2018 -0500
Committer: Robert Evans <ev...@yahoo-inc.com>
Committed: Wed Oct 3 16:27:29 2018 -0500
----------------------------------------------------------------------
.../org/apache/storm/daemon/ui/UIHelpers.java | 48 +++++++++++-------
.../daemon/ui/resources/StormApiResource.java | 52 +++++++++++++-------
2 files changed, 64 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/2bc519f0/storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java
----------------------------------------------------------------------