Skip to content

Commit

Permalink
Fix bwc on main for threadpool wait time metric (opensearch-project#1…
Browse files Browse the repository at this point in the history
…0004)

Signed-off-by: Jay Deng <jayd0104@gmail.com>
  • Loading branch information
jed326 authored Sep 13, 2023
1 parent 443cfca commit 91821c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"Test cat thread_pool total_wait_time output":
- skip:
version: " - 3.0.0"
reason: thread_pool total_wait_time stats were introduced in V_3.0.0
version: " - 2.10.99"
reason: thread_pool total_wait_time stats were introduced in V_2.11.0

- do:
cat.thread_pool: {}
Expand All @@ -19,11 +19,10 @@

- match:
$body: |
/^ id \s+ name \s+ total_wait_time \s+ twt \n
(\S+ \s+ search \s+ \d+s \s+ \d+ \n
\S+ \s+ search_throttled \s+ \d+s \s+ \d+ \n
\S+ \s+ index_searcher \s+ \d+s \s+ \d+ \n
\S+ \s+ generic \s+ -1 \s+ -1 \n)+ $/
/^ name \s+ total_wait_time \s+ twt \n
(generic \s+ -1 \s+ -1 \n
search \s+ \d*\.*\d*\D+ \s+ \d*\.*\d*\D+ \n
search_throttled \s+ \d*\.*\d*\D+ \s+ \d*\.*\d*\D+ \n)+ $/
---
"Test cat thread_pool output":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Stats(StreamInput in) throws IOException {
rejected = in.readLong();
largest = in.readInt();
completed = in.readLong();
waitTimeNanos = in.getVersion().onOrAfter(Version.V_3_0_0) ? in.readLong() : -1;
waitTimeNanos = in.getVersion().onOrAfter(Version.V_2_11_0) ? in.readLong() : -1;
}

@Override
Expand All @@ -100,7 +100,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeLong(rejected);
out.writeInt(largest);
out.writeLong(completed);
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_11_0)) {
out.writeLong(waitTimeNanos);
}
}
Expand Down

0 comments on commit 91821c7

Please sign in to comment.