-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Add other time accounting in HotThreads #79392
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
Changes from all commits
5d8c9ca
a434a16
75d7e85
d6e5947
d9d746c
16520a2
22c3be8
423ad61
ec7848e
5dd7579
1417916
4bc05a0
3dcec18
9eb0804
f06b946
25ab3d7
c1c57d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
|
||
package org.elasticsearch.action.admin.cluster.node.hotthreads; | ||
|
||
import org.elasticsearch.Version; | ||
import org.elasticsearch.action.support.nodes.BaseNodesRequest; | ||
import org.elasticsearch.cluster.node.DiscoveryNode; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
|
@@ -22,6 +23,7 @@ public class NodesHotThreadsRequest extends BaseNodesRequest<NodesHotThreadsRequ | |
|
||
int threads = 3; | ||
HotThreads.ReportType type = HotThreads.ReportType.CPU; | ||
HotThreads.SortOrder sortOrder = HotThreads.SortOrder.TOTAL; | ||
TimeValue interval = new TimeValue(500, TimeUnit.MILLISECONDS); | ||
int snapshots = 10; | ||
boolean ignoreIdleThreads = true; | ||
|
@@ -34,6 +36,9 @@ public NodesHotThreadsRequest(StreamInput in) throws IOException { | |
type = HotThreads.ReportType.of(in.readString()); | ||
interval = in.readTimeValue(); | ||
snapshots = in.readInt(); | ||
if (in.getVersion().onOrAfter(Version.V_8_0_0)) { | ||
sortOrder = HotThreads.SortOrder.of(in.readString()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice (as a followup) to look at changing read/write enum to use the value, instead of ordinal. As it is, the enum methods for stream input/output are brittle since they rely on the enum definition not changing. |
||
} | ||
} | ||
|
||
/** | ||
|
@@ -78,6 +83,15 @@ public HotThreads.ReportType type() { | |
return this.type; | ||
} | ||
|
||
public NodesHotThreadsRequest sortOrder(HotThreads.SortOrder sortOrder) { | ||
this.sortOrder = sortOrder; | ||
return this; | ||
} | ||
|
||
public HotThreads.SortOrder sortOrder() { | ||
return this.sortOrder; | ||
} | ||
|
||
public NodesHotThreadsRequest interval(TimeValue interval) { | ||
this.interval = interval; | ||
return this; | ||
|
@@ -104,5 +118,8 @@ public void writeTo(StreamOutput out) throws IOException { | |
out.writeString(type.getTypeValue()); | ||
out.writeTimeValue(interval); | ||
out.writeInt(snapshots); | ||
if (out.getVersion().onOrAfter(Version.V_8_0_0)) { | ||
out.writeString(sortOrder.getOrderValue()); | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,6 @@ grant codeBase "${codebase.elasticsearch-secure-sm}" { | |
grant codeBase "${codebase.elasticsearch}" { | ||
// needed for loading plugins which may expect the context class loader to be set | ||
permission java.lang.RuntimePermission "setContextClassLoader"; | ||
// needed by HotThreads to enable wait/block time accounting on demand | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer needed since we now enable the monitoring before we install the security manager. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's great to see permissions removed. :) |
||
permission java.lang.management.ManagementPermission "control"; | ||
}; | ||
|
||
//// Very special jar permissions: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ public void testBWCSerialization() throws IOException { | |
out.setVersion(previous); | ||
request.writeTo(out); | ||
try (StreamInput in = out.bytes().streamInput()) { | ||
in.setVersion(latest); | ||
in.setVersion(previous); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had this wrong before, |
||
NodesHotThreadsRequest deserialized = new NodesHotThreadsRequest(in); | ||
assertEquals(request.threads(), deserialized.threads()); | ||
assertEquals(request.ignoreIdleThreads(), deserialized.ignoreIdleThreads()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should all be final, I'm surprised they are not. We should have a ctor to take all the members. That can be a followup, though (doesn't have to make 7.16 since this is already the state of the class).