Skip to content

Conversation

@sandeshkr419
Copy link
Member

@sandeshkr419 sandeshkr419 commented Jul 8, 2025

Description

Adding metric data for star-tree search queries.

  • search.startree_query_total
  • search.startree_query_time_in_millis
  • search.startree_query_current

Documentation: opensearch-project/documentation-website#10667

/_nodes/stats/indices/search

{
    "_nodes": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "cluster_name": "runTask",
    "nodes": {
        "ZVVPzxDISt2bzCcpeam25A": {
            "timestamp": 1752005128826,
            "name": "runTask-0",
            "transport_address": "127.0.0.1:9300",
            "host": "127.0.0.1",
            "ip": "127.0.0.1:9300",
            "roles": [
                "cluster_manager",
                "data",
                "ingest",
                "remote_cluster_client"
            ],
            "attributes": {
                "testattr": "test",
                "shard_indexing_pressure_enabled": "true"
            },
            "indices": {
                "search": {
                    "open_contexts": 0,
                    "query_total": 7,
                    "query_time_in_millis": 74,
                    "query_current": 0,
                    "concurrent_query_total": 7,
                    "concurrent_query_time_in_millis": 74,
                    "concurrent_query_current": 0,
                    "concurrent_avg_slice_count": 1.0,
                    "startree_query_total": 4,
                    "startree_query_time_in_millis": 40,
                    "startree_query_current": 0,
                    "fetch_total": 7,
                    "fetch_time_in_millis": 1,
                    "fetch_current": 0,
                    "scroll_total": 0,
                    "scroll_time_in_millis": 0,
                    "scroll_current": 0,
                    "point_in_time_total": 0,
                    "point_in_time_time_in_millis": 0,
                    "point_in_time_current": 0,
                    "suggest_total": 0,
                    "suggest_time_in_millis": 0,
                    "suggest_current": 0,
                    "search_idle_reactivate_count_total": 0,
                    "request": {
                        "took": {
                            "time_in_millis": 136,
                            "current": 0,
                            "total": 7
                        },
                        "dfs_pre_query": {
                            "time_in_millis": 0,
                            "current": 0,
                            "total": 0
                        },
                        "query": {
                            "time_in_millis": 112,
                            "current": 0,
                            "total": 7
                        },
                        "fetch": {
                            "time_in_millis": 3,
                            "current": 0,
                            "total": 7
                        },
                        "dfs_query": {
                            "time_in_millis": 0,
                            "current": 0,
                            "total": 0
                        },
                        "expand": {
                            "time_in_millis": 0,
                            "current": 0,
                            "total": 7
                        },
                        "can_match": {
                            "time_in_millis": 0,
                            "current": 0,
                            "total": 0
                        }
                    }
                }
            }
        }
    }
}
_stats/search

{
    "_shards": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "_all": {
        "primaries": {
            "search": {
                "open_contexts": 0,
                "query_total": 7,
                "query_time_in_millis": 74,
                "query_current": 0,
                "concurrent_query_total": 7,
                "concurrent_query_time_in_millis": 74,
                "concurrent_query_current": 0,
                "concurrent_avg_slice_count": 1.0,
                "startree_query_total": 4,
                "startree_query_time_in_millis": 40,
                "startree_query_current": 0,
                "fetch_total": 7,
                "fetch_time_in_millis": 1,
                "fetch_current": 0,
                "scroll_total": 0,
                "scroll_time_in_millis": 0,
                "scroll_current": 0,
                "point_in_time_total": 0,
                "point_in_time_time_in_millis": 0,
                "point_in_time_current": 0,
                "suggest_total": 0,
                "suggest_time_in_millis": 0,
                "suggest_current": 0,
                "search_idle_reactivate_count_total": 0
            }
        },
        "total": {
            "search": {
                "open_contexts": 0,
                "query_total": 7,
                "query_time_in_millis": 74,
                "query_current": 0,
                "concurrent_query_total": 7,
                "concurrent_query_time_in_millis": 74,
                "concurrent_query_current": 0,
                "concurrent_avg_slice_count": 1.0,
                "startree_query_total": 4,
                "startree_query_time_in_millis": 40,
                "fetch_total": 7,
                "fetch_time_in_millis": 1,
                "fetch_current": 0,
                "scroll_total": 0,
                "scroll_time_in_millis": 0,
                "scroll_current": 0,
                "point_in_time_total": 0,
                "point_in_time_time_in_millis": 0,
                "point_in_time_current": 0,
                "suggest_total": 0,
                "suggest_time_in_millis": 0,
                "suggest_current": 0,
                "search_idle_reactivate_count_total": 0
            }
        }
    },
    "indices": {
        "logs-241998": {
            "uuid": "vcsLlw6ERyaLXI7mJ295nw",
            "primaries": {
                "search": {
                    "open_contexts": 0,
                    "query_total": 7,
                    "query_time_in_millis": 74,
                    "query_current": 0,
                    "concurrent_query_total": 7,
                    "concurrent_query_time_in_millis": 74,
                    "concurrent_query_current": 0,
                    "concurrent_avg_slice_count": 1.0,
                    "startree_query_total": 4,
                    "startree_query_time_in_millis": 40,
                    "fetch_total": 7,
                    "fetch_time_in_millis": 1,
                    "fetch_current": 0,
                    "scroll_total": 0,
                    "scroll_time_in_millis": 0,
                    "scroll_current": 0,
                    "point_in_time_total": 0,
                    "point_in_time_time_in_millis": 0,
                    "point_in_time_current": 0,
                    "suggest_total": 0,
                    "suggest_time_in_millis": 0,
                    "suggest_current": 0,
                    "search_idle_reactivate_count_total": 0
                }
            },
            "total": {
                "search": {
                    "open_contexts": 0,
                    "query_total": 7,
                    "query_time_in_millis": 74,
                    "query_current": 0,
                    "concurrent_query_total": 7,
                    "concurrent_query_time_in_millis": 74,
                    "concurrent_query_current": 0,
                    "concurrent_avg_slice_count": 1.0,
                    "startree_query_total": 4,
                    "startree_query_time_in_millis": 40,
                    "fetch_total": 7,
                    "fetch_time_in_millis": 1,
                    "fetch_current": 0,
                    "scroll_total": 0,
                    "scroll_time_in_millis": 0,
                    "scroll_current": 0,
                    "point_in_time_total": 0,
                    "point_in_time_time_in_millis": 0,
                    "point_in_time_current": 0,
                    "suggest_total": 0,
                    "suggest_time_in_millis": 0,
                    "suggest_current": 0,
                    "search_idle_reactivate_count_total": 0
                }
            }
        }
    }
}
_stats/search?pretty&level=shards

{
    "_shards": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "_all": {
        "primaries": {
            "search": {
                "open_contexts": 0,
                "query_total": 7,
                "query_time_in_millis": 74,
                "query_current": 0,
                "concurrent_query_total": 7,
                "concurrent_query_time_in_millis": 74,
                "concurrent_query_current": 0,
                "concurrent_avg_slice_count": 1.0,
                "startree_query_total": 4,
                "startree_query_time_in_millis": 40,
                "startree_query_current": 0,
                "fetch_total": 7,
                "fetch_time_in_millis": 1,
                "fetch_current": 0,
                "scroll_total": 0,
                "scroll_time_in_millis": 0,
                "scroll_current": 0,
                "point_in_time_total": 0,
                "point_in_time_time_in_millis": 0,
                "point_in_time_current": 0,
                "suggest_total": 0,
                "suggest_time_in_millis": 0,
                "suggest_current": 0,
                "search_idle_reactivate_count_total": 0
            }
        },
        "total": {
            "search": {
                "open_contexts": 0,
                "query_total": 7,
                "query_time_in_millis": 74,
                "query_current": 0,
                "concurrent_query_total": 7,
                "concurrent_query_time_in_millis": 74,
                "concurrent_query_current": 0,
                "concurrent_avg_slice_count": 1.0,
                "startree_query_total": 4,
                "startree_query_time_in_millis": 40,
                "fetch_total": 7,
                "fetch_time_in_millis": 1,
                "fetch_current": 0,
                "scroll_total": 0,
                "scroll_time_in_millis": 0,
                "scroll_current": 0,
                "point_in_time_total": 0,
                "point_in_time_time_in_millis": 0,
                "point_in_time_current": 0,
                "suggest_total": 0,
                "suggest_time_in_millis": 0,
                "suggest_current": 0,
                "search_idle_reactivate_count_total": 0
            }
        }
    },
    "indices": {
        "logs-241998": {
            "uuid": "vcsLlw6ERyaLXI7mJ295nw",
            "primaries": {
                "search": {
                    "open_contexts": 0,
                    "query_total": 7,
                    "query_time_in_millis": 74,
                    "query_current": 0,
                    "concurrent_query_total": 7,
                    "concurrent_query_time_in_millis": 74,
                    "concurrent_query_current": 0,
                    "concurrent_avg_slice_count": 1.0,
                    "startree_query_total": 4,
                    "startree_query_time_in_millis": 40,
                    "fetch_total": 7,
                    "fetch_time_in_millis": 1,
                    "fetch_current": 0,
                    "scroll_total": 0,
                    "scroll_time_in_millis": 0,
                    "scroll_current": 0,
                    "point_in_time_total": 0,
                    "point_in_time_time_in_millis": 0,
                    "point_in_time_current": 0,
                    "suggest_total": 0,
                    "suggest_time_in_millis": 0,
                    "suggest_current": 0,
                    "search_idle_reactivate_count_total": 0
                }
            },
            "total": {
                "search": {
                    "open_contexts": 0,
                    "query_total": 7,
                    "query_time_in_millis": 74,
                    "query_current": 0,
                    "concurrent_query_total": 7,
                    "concurrent_query_time_in_millis": 74,
                    "concurrent_query_current": 0,
                    "concurrent_avg_slice_count": 1.0,
                    "startree_query_total": 4,
                    "startree_query_time_in_millis": 40,
                    "fetch_total": 7,
                    "fetch_time_in_millis": 1,
                    "fetch_current": 0,
                    "scroll_total": 0,
                    "scroll_time_in_millis": 0,
                    "scroll_current": 0,
                    "point_in_time_total": 0,
                    "point_in_time_time_in_millis": 0,
                    "point_in_time_current": 0,
                    "suggest_total": 0,
                    "suggest_time_in_millis": 0,
                    "suggest_current": 0,
                    "search_idle_reactivate_count_total": 0
                }
            },
            "shards": {
                "0": [
                    {
                        "routing": {
                            "state": "STARTED",
                            "primary": true,
                            "node": "ZVVPzxDISt2bzCcpeam25A",
                            "relocating_node": null
                        },
                        "search": {
                            "open_contexts": 0,
                            "query_total": 7,
                            "query_time_in_millis": 74,
                            "query_current": 0,
                            "concurrent_query_total": 7,
                            "concurrent_query_time_in_millis": 74,
                            "concurrent_query_current": 0,
                            "concurrent_avg_slice_count": 1.0,
                            "startree_query_total": 4,
                            "startree_query_time_in_millis": 40,
                            "fetch_total": 7,
                            "fetch_time_in_millis": 1,
                            "fetch_current": 0,
                            "scroll_total": 0,
                            "scroll_time_in_millis": 0,
                            "scroll_current": 0,
                            "point_in_time_total": 0,
                            "point_in_time_time_in_millis": 0,
                            "point_in_time_current": 0,
                            "suggest_total": 0,
                            "suggest_time_in_millis": 0,
                            "suggest_current": 0,
                            "search_idle_reactivate_count_total": 0,
                            "request": {
                                "took": {
                                    "time_in_millis": 0,
                                    "current": 0,
                                    "total": 0
                                },
                                "dfs_pre_query": {
                                    "time_in_millis": 0,
                                    "current": 0,
                                    "total": 0
                                },
                                "query": {
                                    "time_in_millis": 0,
                                    "current": 0,
                                    "total": 0
                                },
                                "fetch": {
                                    "time_in_millis": 0,
                                    "current": 0,
                                    "total": 0
                                },
                                "dfs_query": {
                                    "time_in_millis": 0,
                                    "current": 0,
                                    "total": 0
                                },
                                "expand": {
                                    "time_in_millis": 0,
                                    "current": 0,
                                    "total": 0
                                },
                                "can_match": {
                                    "time_in_millis": 0,
                                    "current": 0,
                                    "total": 0
                                }
                            }
                        },
                        "commit": {
                            "id": "rG1Y/6BUJM/miP6EBZWeDA==",
                            "generation": 3,
                            "user_data": {
                                "local_checkpoint": "1000",
                                "max_unsafe_auto_id_timestamp": "-1",
                                "min_retained_seq_no": "0",
                                "translog_uuid": "YLsJ70EGSxSBK8PYKzg8gw",
                                "force_merge_uuid": "yB9uwBF6TuS03_Mz23NYaw",
                                "history_uuid": "bQ8HgtAKSXWxPIMZZhUDmg",
                                "max_seq_no": "1000"
                            },
                            "num_docs": 1001
                        },
                        "seq_no": {
                            "max_seq_no": 1000,
                            "local_checkpoint": 1000,
                            "global_checkpoint": 1000
                        },
                        "retention_leases": {
                            "primary_term": 1,
                            "version": 2,
                            "leases": [
                                {
                                    "id": "peer_recovery/ZVVPzxDISt2bzCcpeam25A",
                                    "retaining_seq_no": 1001,
                                    "timestamp": 1751997664441,
                                    "source": "peer recovery"
                                }
                            ]
                        },
                        "shard_path": {
                            "state_path": "/Users/<hidden>/workplace/opensearch/OpenSearch/build/testclusters/runTask-0/data/nodes/0",
                            "data_path": "/Users/<hidden>/workplace/opensearch/OpenSearch/build/testclusters/runTask-0/data/nodes/0",
                            "is_custom_data_path": false
                        }
                    }
                ]
            }
        }
    }
}

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2025

❌ Gradle check result for ad439e8: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@sandeshkr419 sandeshkr419 changed the title startree node,indices,shards stats [Star-Tree] Search level stats for nodes, indices and shards Jul 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2025

❌ Gradle check result for 7431dfd: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@sandeshkr419 sandeshkr419 added Search Search query, autocomplete ...etc v3.2.0 labels Jul 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2025

❌ Gradle check result for 26fd3d9: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2025

❌ Gradle check result for cb1a9de: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@getsaurabh02
Copy link
Member

getsaurabh02 commented Jul 9, 2025

Shouldn't we enable a new metric group for STAR TREE: https://docs.opensearch.org/docs/latest/api-reference/nodes-apis/nodes-stats/

@sandeshkr419
Copy link
Member Author

Shouldn't we enable a new metric group for STAR TREE: https://docs.opensearch.org/docs/latest/api-reference/nodes-apis/nodes-stats/

@getsaurabh02 I'd argue otherwise. The reason to place it inside search metric group was that similar metrics like concurrent search / PIT metrics are also part of this. Also, the metric related to star-tree like startree_query_total will be less than or equal to query_total for example. Placing it here gives a good picture of what is your star-tree usage with total queries and concurrent search queries as well.

@expani @bharath-techie Looping you both in the thread, please review/evaluate the placement of metrics if this needs any change than the current state.

@github-actions
Copy link
Contributor

❌ Gradle check result for e674fad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

❌ Gradle check result for 78480c6: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@sandeshkr419 sandeshkr419 marked this pull request as ready for review July 15, 2025 05:48
@codecov
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 88.70056% with 20 lines in your changes missing coverage. Please review.

Project coverage is 72.74%. Comparing base (8f69dcf) to head (7218ea6).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...pensearch/index/search/stats/ShardSearchStats.java 74.28% 7 Missing and 2 partials ⚠️
.../opensearch/rest/action/cat/RestIndicesAction.java 50.00% 0 Missing and 6 partials ⚠️
...rg/opensearch/rest/action/cat/RestNodesAction.java 50.00% 0 Missing and 3 partials ⚠️
...org/opensearch/index/search/stats/SearchStats.java 98.30% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18707      +/-   ##
============================================
- Coverage     72.79%   72.74%   -0.05%     
+ Complexity    68525    68447      -78     
============================================
  Files          5574     5566       -8     
  Lines        314807   314660     -147     
  Branches      45675    45649      -26     
============================================
- Hits         229178   228915     -263     
- Misses        67046    67133      +87     
- Partials      18583    18612      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bharath-techie
Copy link
Contributor

@sandeshkr419 PR looks good but lets add end to end test which utilizes star tree and assert the stats. Now that we don't have feature flag protection , we should be able to do this.

Signed-off-by: Sandesh Kumar <[email protected]>
Signed-off-by: Sandesh Kumar <[email protected]>
Signed-off-by: Sandesh Kumar <[email protected]>
Signed-off-by: Sandesh Kumar <[email protected]>
@github-actions
Copy link
Contributor

❌ Gradle check result for f75a836: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Sandesh Kumar <[email protected]>
@github-actions
Copy link
Contributor

✅ Gradle check result for 7218ea6: SUCCESS

@bharath-techie bharath-techie merged commit 1352627 into opensearch-project:main Jul 16, 2025
31 checks passed
@sandeshkr419 sandeshkr419 deleted the stats branch July 16, 2025 04:19
sandeshkr419 added a commit to sandeshkr419/OpenSearch that referenced this pull request Jul 16, 2025
…rch-project#18707)

* startree node,indices,shards stats

Signed-off-by: Sandesh Kumar <[email protected]>

* changing to builder pattern

Signed-off-by: Sandesh Kumar <[email protected]>

* add query current, fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* add integ test

Signed-off-by: Sandesh Kumar <[email protected]>

* typo

Signed-off-by: Sandesh Kumar <[email protected]>

---------

Signed-off-by: Sandesh Kumar <[email protected]>
sandeshkr419 added a commit to sandeshkr419/OpenSearch that referenced this pull request Jul 16, 2025
…rch-project#18707)

* startree node,indices,shards stats

Signed-off-by: Sandesh Kumar <[email protected]>

* changing to builder pattern

Signed-off-by: Sandesh Kumar <[email protected]>

* add query current, fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* add integ test

Signed-off-by: Sandesh Kumar <[email protected]>

* typo

Signed-off-by: Sandesh Kumar <[email protected]>

---------

Signed-off-by: Sandesh Kumar <[email protected]>
pranikum pushed a commit to pranikum/OpenSearch that referenced this pull request Jul 17, 2025
…rch-project#18707)

* startree node,indices,shards stats

Signed-off-by: Sandesh Kumar <[email protected]>

* changing to builder pattern

Signed-off-by: Sandesh Kumar <[email protected]>

* add query current, fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* add integ test

Signed-off-by: Sandesh Kumar <[email protected]>

* typo

Signed-off-by: Sandesh Kumar <[email protected]>

---------

Signed-off-by: Sandesh Kumar <[email protected]>
tandonks pushed a commit to tandonks/OpenSearch that referenced this pull request Aug 5, 2025
…rch-project#18707)

* startree node,indices,shards stats

Signed-off-by: Sandesh Kumar <[email protected]>

* changing to builder pattern

Signed-off-by: Sandesh Kumar <[email protected]>

* add query current, fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* fix version

Signed-off-by: Sandesh Kumar <[email protected]>

* add integ test

Signed-off-by: Sandesh Kumar <[email protected]>

* typo

Signed-off-by: Sandesh Kumar <[email protected]>

---------

Signed-off-by: Sandesh Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Search Search query, autocomplete ...etc v3.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants