-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from github/hugodorea/adds-get-hot-threads-method
adds GetHotThreads to es client
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2042,3 +2042,34 @@ func TestReloadSecureSettingsWithPassword(t *testing.T) { | |
t.Errorf("Expected to parse bad node response correctly, got %#v", goodNode) | ||
} | ||
} | ||
|
||
func TestGetHotThreads(t *testing.T) { | ||
testSetup := &ServerSetup{ | ||
Method: "GET", | ||
Path: "/_nodes/hot_threads", | ||
Response: ` | ||
::: {Mister Sinister}{c0k7r8tKS0CGObWF7yzgQQ}{127.0.0.1}{127.0.0.1:9300} | ||
Hot threads at 2022-08-04T20:30:34.357Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true: | ||
0.0% (172.8micros out of 500ms) cpu usage by thread 'elasticsearch[Mister Sinister][transport_client_timer][T#1]{Hashed wheel timer #1}' | ||
10/10 snapshots sharing following 5 elements | ||
[email protected]/java.lang.Thread.sleep(Native Method) | ||
app//org.jboss.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:445) | ||
app//org.jboss.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:364) | ||
app//org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) | ||
[email protected]/java.lang.Thread.run(Thread.java:829)`, | ||
} | ||
|
||
host, port, ts := setupTestServers(t, []*ServerSetup{testSetup}) | ||
defer ts.Close() | ||
client := NewClient(host, port) | ||
|
||
hotThreads, err := client.GetHotThreads() | ||
if err != nil { | ||
t.Fatalf("Unexpected error expected nil, got %s", err) | ||
} | ||
|
||
if hotThreads != testSetup.Response { | ||
t.Errorf("Unexpected response. got %v want %v", hotThreads, testSetup.Response) | ||
} | ||
} |