Skip to content
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ab74705
add first changes
ajleong623 Aug 20, 2025
ad9e107
test for breaking detection
ajleong623 Aug 21, 2025
9e3af03
test for breaking detection
ajleong623 Aug 21, 2025
7e9374a
add changes
ajleong623 Aug 21, 2025
fe21417
fix compile issues
ajleong623 Aug 21, 2025
a345b21
fix breaking changes
ajleong623 Aug 21, 2025
ae2c661
fix breaking changes
ajleong623 Aug 21, 2025
ad95bff
added integration tests
ajleong623 Aug 22, 2025
c9ad00b
fix null pointer and breaking changes
ajleong623 Aug 22, 2025
32a2fae
test runner not found
ajleong623 Aug 22, 2025
8589524
test compilation
ajleong623 Aug 22, 2025
3bcb07b
spotless
ajleong623 Aug 22, 2025
c0755e4
spotless
ajleong623 Aug 22, 2025
f77335c
it should pass
ajleong623 Aug 22, 2025
49e6d5e
refactor doc status
ajleong623 Aug 23, 2025
50b5682
refactor doc status
ajleong623 Aug 23, 2025
20a7a41
refactor doc status
ajleong623 Aug 23, 2025
dcacf86
rerun
ajleong623 Aug 23, 2025
b9e2dcc
skip old versions without status counter
ajleong623 Aug 23, 2025
aea2644
updated license
ajleong623 Sep 3, 2025
7f6d8f5
retry for flaky
ajleong623 Sep 3, 2025
d16acf5
retry for flaky
ajleong623 Sep 3, 2025
5e8d8e5
retry for flaky
ajleong623 Sep 3, 2025
7e81293
retry for flaky
ajleong623 Sep 4, 2025
ac7ffc3
Merge branch 'opensearch-project:main' into upgrade-cluster-endpoints
ajleong623 Sep 5, 2025
ad026c2
keystore test timed out
ajleong623 Sep 5, 2025
9bd2985
Merge branch 'upgrade-cluster-endpoints' of https://github.com/ajleon…
ajleong623 Sep 5, 2025
9e84290
keystore test timed out
ajleong623 Sep 6, 2025
b544e35
Merge branch 'opensearch-project:main' into upgrade-cluster-endpoints
ajleong623 Sep 23, 2025
dc043dd
refactor enum and stat holders
ajleong623 Sep 23, 2025
3455efb
Merge branch 'upgrade-cluster-endpoints' of https://github.com/ajleon…
ajleong623 Sep 23, 2025
a2aa335
applied suggestions
ajleong623 Sep 24, 2025
93f508f
retry for flaky
ajleong623 Sep 24, 2025
eb19367
Merge branch 'opensearch-project:main' into upgrade-cluster-endpoints
ajleong623 Sep 24, 2025
536c20b
retry for flaky
ajleong623 Sep 25, 2025
de8b27d
retry for flaky
ajleong623 Sep 25, 2025
917722c
Merge branch 'main' into upgrade-cluster-endpoints
ajleong623 Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased 3.x]
### Added
- Add search API tracker ([#18601](https://github.com/opensearch-project/OpenSearch/pull/18601))
- Expand fetch phase profiling to support inner hits and top hits aggregation phases ([##18936](https://github.com/opensearch-project/OpenSearch/pull/18936))
- Add temporal routing processors for time-based document routing ([#18920](https://github.com/opensearch-project/OpenSearch/issues/18920))
- Implement Query Rewriting Infrastructure ([#19060](https://github.com/opensearch-project/OpenSearch/pull/19060))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,17 @@ public int getStatusFamilyCode() {
return status / 100;
}

public String getErrorType() {
int family = getStatusFamilyCode();
if (family <= 3) {
return "success";
} else if (family == 4) {
return "user_error";
} else {
return "system_failure";
}
Comment on lines 545 to 547
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets move the numeric values into well defined constants/Enums then directly use, StatusCode.from(getStatusFamilyCode)

}

public static RestStatus readFrom(StreamInput in) throws IOException {
return RestStatus.valueOf(in.readString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
"Metric - blank":
- skip:
version: " - 3.2.99"
features: [arbitrary_key]
reason: "Status Counter was introduced in v3.3.0"
- do:
nodes.info: {}
- set:
Expand All @@ -25,11 +27,14 @@
- is_true: nodes.$node_id.indices.segments
- is_true: nodes.$node_id.indices.translog
- is_true: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.status_counter

---
"Metric - _all":
- skip:
features: [arbitrary_key]
version: " - 3.2.99"
reason: "Status Counter was introduced in v3.3.0"
- do:
nodes.info: {}
- set:
Expand All @@ -53,11 +58,14 @@
- is_true: nodes.$node_id.indices.segments
- is_true: nodes.$node_id.indices.translog
- is_true: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.status_counter

---
"Metric - indices _all":
- skip:
features: [arbitrary_key]
version: " - 3.2.99"
reason: "Status Counter was introduced in v3.3.0"
- do:
nodes.info: {}
- set:
Expand All @@ -81,11 +89,14 @@
- is_true: nodes.$node_id.indices.segments
- is_true: nodes.$node_id.indices.translog
- is_true: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.status_counter

---
"Metric - one":
- skip:
features: [arbitrary_key]
version: " - 3.2.99"
reason: "Status Counter was introduced in v3.3.0"
- do:
nodes.info: {}
- set:
Expand All @@ -109,11 +120,14 @@
- is_false: nodes.$node_id.indices.segments
- is_false: nodes.$node_id.indices.translog
- is_false: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.status_counter

---
"Metric - multi":
- skip:
features: [arbitrary_key]
version: " - 3.2.99"
reason: "Status Counter was introduced in v3.3.0"
- do:
nodes.info: {}
- set:
Expand All @@ -137,12 +151,13 @@
- is_false: nodes.$node_id.indices.segments
- is_false: nodes.$node_id.indices.translog
- is_false: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.status_counter

---
"Metric - indexing doc_status":
- skip:
version: " - 2.10.99"
reason: "Doc Status Stats were introduced in v2.11.0"
version: " - 3.2.99"
reason: "Doc Status Stats were introduced in v2.11.0 and moved to Status Counter in v3.3.0"
- do:
nodes.info: {}
- set:
Expand All @@ -154,7 +169,6 @@
- is_false: nodes.$node_id.indices.docs
- is_false: nodes.$node_id.indices.store
- is_true: nodes.$node_id.indices.indexing
- is_true: nodes.$node_id.indices.indexing.doc_status
- is_false: nodes.$node_id.indices.get
- is_false: nodes.$node_id.indices.search
- is_false: nodes.$node_id.indices.merges
Expand All @@ -167,6 +181,39 @@
- is_false: nodes.$node_id.indices.segments
- is_false: nodes.$node_id.indices.translog
- is_false: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.status_counter
- is_true: nodes.$node_id.indices.status_counter.doc_status

---
"Metric - indexing search_response_status":
- skip:
version: " - 3.2.99"
reason: "Search Response Status Stats were introduced in v3.3.0"
- do:
nodes.info: {}
- set:
nodes._arbitrary_key_: node_id

- do:
nodes.stats: { metric: indices, index_metric: indexing }

- is_false: nodes.$node_id.indices.docs
- is_false: nodes.$node_id.indices.store
- is_true: nodes.$node_id.indices.indexing
- is_false: nodes.$node_id.indices.get
- is_false: nodes.$node_id.indices.search
- is_false: nodes.$node_id.indices.merges
- is_false: nodes.$node_id.indices.refresh
- is_false: nodes.$node_id.indices.flush
- is_false: nodes.$node_id.indices.warmer
- is_false: nodes.$node_id.indices.query_cache
- is_false: nodes.$node_id.indices.fielddata
- is_false: nodes.$node_id.indices.completion
- is_false: nodes.$node_id.indices.segments
- is_false: nodes.$node_id.indices.translog
- is_false: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.status_counter
- is_true: nodes.$node_id.indices.status_counter.search_response_status

---
"Metric - recovery":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.opensearch.action.admin.cluster.node.stats.NodeStats;
import org.opensearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.opensearch.action.admin.indices.stats.CommonStatsFlags;
import org.opensearch.action.admin.indices.stats.DocStatusStats;
import org.opensearch.action.bulk.BulkItemResponse;
import org.opensearch.action.bulk.BulkRequest;
import org.opensearch.action.bulk.BulkResponse;
Expand All @@ -32,7 +33,6 @@
import org.opensearch.index.IndexNotFoundException;
import org.opensearch.index.engine.DocumentMissingException;
import org.opensearch.index.engine.VersionConflictEngineException;
import org.opensearch.index.shard.IndexingStats.Stats.DocStatusStats;
import org.opensearch.indices.NodeIndicesStats;
import org.opensearch.test.OpenSearchIntegTestCase;
import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope;
Expand All @@ -47,7 +47,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.LongAdder;

import static java.util.Collections.singletonMap;
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
Expand Down Expand Up @@ -281,15 +281,14 @@ public void testNodeIndicesStatsDocStatsWithAggregations() {
.getNodes()
.get(0)
.getIndices()
.getIndexing()
.getTotal()
.getStatusCounterStats()
.getDocStatusStats();

assertTrue(
Arrays.equals(
docStatusStats.getDocStatusCounter(),
expectedDocStatusStats.getDocStatusCounter(),
Comparator.comparingLong(AtomicLong::longValue)
Comparator.comparingLong(LongAdder::longValue)
)
);
}
Expand Down Expand Up @@ -543,15 +542,14 @@ private void assertDocStatusStats() {
.getNodes()
.get(0)
.getIndices()
.getIndexing()
.getTotal()
.getStatusCounterStats()
.getDocStatusStats();

assertTrue(
Arrays.equals(
docStatusStats.getDocStatusCounter(),
expectedDocStatusStats.getDocStatusCounter(),
Comparator.comparingLong(AtomicLong::longValue)
Comparator.comparingLong(LongAdder::longValue)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.search.msearch;

import org.opensearch.ExceptionsHelper;
import org.opensearch.action.admin.indices.stats.SearchResponseStatusStats;
import org.opensearch.action.search.MultiSearchRequestBuilder;
import org.opensearch.action.search.MultiSearchResponse;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.test.OpenSearchIntegTestCase;
import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope;
import org.opensearch.test.OpenSearchIntegTestCase.Scope;

import java.util.Arrays;
import java.util.Comparator;
import java.util.concurrent.atomic.LongAdder;

@ClusterScope(scope = Scope.TEST, numDataNodes = 1, numClientNodes = 0, supportsDedicatedMasters = false)
public class MultiSearchStatsIT extends OpenSearchIntegTestCase {
private final SearchResponseStatusStats expectedSearchResponseStatusStats = new SearchResponseStatusStats();

public void testNodeIndicesStatsDocStatusStatsIndexBulk() {
createIndex("test");
ensureGreen();
client().prepareIndex("test").setId("1").setSource("field", "xxx").get();
client().prepareIndex("test").setId("2").setSource("field", "yyy").get();
refresh();

int failureCount = randomIntBetween(0, 50);
int successCount = randomIntBetween(0, 50);

MultiSearchRequestBuilder multiSearchRequestBuilder = client().prepareMultiSearch();

for (int i = 0; i < failureCount; i++) {
multiSearchRequestBuilder.add(client().prepareSearch("noIndex").setQuery(QueryBuilders.termQuery("field", "yyy")));
}

for (int i = 0; i < successCount; i++) {
multiSearchRequestBuilder.add(client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery()));
}

MultiSearchResponse response = multiSearchRequestBuilder.get();

for (MultiSearchResponse.Item item : response) {
if (item.isFailure()) {
updateExpectedDocStatusCounter(expectedSearchResponseStatusStats, item.getFailure());
} else {
updateExpectedDocStatusCounter(expectedSearchResponseStatusStats, item.getResponse());
}
}
assertSearchResponseStatusStats();
}

private void assertSearchResponseStatusStats() {
SearchResponseStatusStats searchResponseStatusStats = client().admin()
.cluster()
.prepareNodesStats()
.execute()
.actionGet()
.getNodes()
.get(0)
.getIndices()
.getStatusCounterStats()
.getSearchResponseStatusStats();

Arrays.equals(
searchResponseStatusStats.getSearchResponseStatusCounter(),
expectedSearchResponseStatusStats.getSearchResponseStatusCounter(),
Comparator.comparingLong(LongAdder::longValue)
);
}

private void updateExpectedDocStatusCounter(SearchResponseStatusStats expectedSearchResponseStatusStats, SearchResponse r) {
expectedSearchResponseStatusStats.inc(r.status());
}

private void updateExpectedDocStatusCounter(SearchResponseStatusStats expectedSearchResponseStatusStats, Exception e) {
expectedSearchResponseStatusStats.inc(ExceptionsHelper.status(e));
}
}
Loading
Loading