Skip to content
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

Query Insights API spec #625

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

ansjcy
Copy link
Member

@ansjcy ansjcy commented Oct 17, 2024

Description

API spec for query insights, more specifically, for the top n queries API.
Related API: https://opensearch.org/docs/latest/observing-your-data/query-insights/top-n-queries/

Issues Resolved

#624

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.

Copy link
Contributor

github-actions bot commented Oct 17, 2024

Changes Analysis

Commit SHA: 9609a02
Comparing To SHA: 8255f1b

API Changes

Summary

├─┬Paths
│ └──[➕] path (2771:3)
└─┬Components
  ├──[➕] responses (28372:7)
  ├──[➕] parameters (21217:7)
  ├──[➕] schemas (50413:7)
  ├──[➕] schemas (50270:7)
  ├──[➕] schemas (50291:7)
  ├──[➕] schemas (50440:7)
  ├──[➕] schemas (50279:7)
  ├──[➕] schemas (50450:7)
  └──[➕] schemas (50422:7)

Document Element Total Changes Breaking Changes
components 9 0
paths 1 0
  • Total Changes: 10
  • Additions: 10

Report

The full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/11473076195/artifacts/2091621613

API Coverage

Before After Δ
Covered (%) 588 (57.59 %) 588 (57.59 %) 0 (0 %)
Uncovered (%) 433 (42.41 %) 433 (42.41 %) 0 (0 %)
Unknown 29 30 1

Copy link
Contributor

Spec Test Coverage Analysis

Total Tested
505 317 (62.77 %)

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Looks good! Some asks below, iterate till tests/lints pass, add to CHANGELOG.

spec/namespaces/query_insights.yaml Outdated Show resolved Hide resolved
tests/plugins/query_insights/top_queries/top_queries.yaml Outdated Show resolved Hide resolved
Signed-off-by: Chenyang Ji <cyji@amazon.com>
Signed-off-by: Chenyang Ji <cyji@amazon.com>
@ansjcy ansjcy force-pushed the query-insights-api-spec branch 2 times, most recently from f6ce283 to 0a3d14b Compare October 22, 2024 18:49
Signed-off-by: Chenyang Ji <cyji@amazon.com>
@ansjcy
Copy link
Member Author

ansjcy commented Oct 22, 2024

Hi @dblock! Thanks a lot for your review. I just pushed a commit based on your comments, let me know if it looks good to you!

@kkhatua kkhatua requested a review from dblock October 22, 2024 20:12
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

@@ -40,6 +40,8 @@ jobs:
tests: plugins/streaming
- version: 2.17.0
tests: plugins/notifications
- version: 2.18.0
Copy link
Member

Choose a reason for hiding this comment

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

2.18 hasn't been released so you need to have a ref and hub like below for a 2.18 build if you want to use that, but if query insights was added in 2.15 you should use 2.17, the latest stable release here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it. Just updated to 2.17. Thank you!

@ansjcy ansjcy force-pushed the query-insights-api-spec branch 4 times, most recently from 00c9b30 to 0070d84 Compare October 23, 2024 04:29
Signed-off-by: Chenyang Ji <cyji@amazon.com>
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

👏 Good work, thanks for hanging in here with me!

@dblock dblock merged commit abc7163 into opensearch-project:main Oct 23, 2024
20 checks passed
@dblock
Copy link
Member

dblock commented Oct 23, 2024

@ansjcy I also see an intermittent CI failure, e.g. in https://github.com/opensearch-project/opensearch-api-specification/actions/runs/11487125212/job/31970965603?pr=637

I can reproduce it on a new docker start from tests/plugins/query_insights.

tests/plugins/query_insights $ docker compose up
npm run test:spec--insecure -- --tests tests/plugins/query_insights/insights/top_queries.yaml --verbose
        FAILED  Retrieve top queries by memory usage.
            PASSED  PARAMETERS
                PASSED  type
            PASSED  REQUEST BODY
            PASSED  RESPONSE STATUS
            PASSED  RESPONSE PAYLOAD BODY
            FAILED  RESPONSE PAYLOAD SCHEMA (data/top_queries/2/source/query/bool/adjust_pure_negative property is not defined in the spec)
            SKIPPED RESPONSE OUTPUT VALUES

Here's the response:

"top_queries": [
    {
      "timestamp": 1729713532744,
      "source": {
        "size": 10000,
        "query": {
          "bool": {
            "must_not": [
              {
                "exists": {
                  "field": "source",
                  "boost": 1
                }
              }
            ],
            "adjust_pure_negative": true,
            "boost": 1
          }
        }
      },
      "phase_latency_map": {
        "expand": 0,
        "query": 53,
        "fetch": 2
      },
      "search_type": "query_then_fetch",
      "indices": [
        ".opensearch-sap-log-types-config"
      ],
      "node_id": "G9AF1X_gQtWHg5VZjUVgtw",
      "total_shards": 1,
      "labels": {},
      "task_resource_usages": [
        {
          "action": "indices:data/read/search",
          "taskId": 43,
          "parentTaskId": -1,
          "nodeId": "G9AF1X_gQtWHg5VZjUVgtw",
          "taskResourceUsage": {
            "cpu_time_in_nanos": 1731501,
            "memory_in_bytes": 97912
          }
        }
      ],

#638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants