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

Remove minimum constraint on OpenSearch hosts to allow empty host and refactor status API to not include OpenSearch status when host is empty #4701

Conversation

bandinib-amzn
Copy link
Member

@bandinib-amzn bandinib-amzn commented Aug 9, 2023

Description

  • Remove minimum constraint on OpenSearch hosts to allow empty host.
  • Bypass node compatibility check when empty opensearch host is configured.
  • 'Opensearch is not configured' message in status API when empty opensearch host is configured.

Please note no opensearch host is only considered when explicitly configured. That means you need to add opensearch.hosts: [] in opensearch_dashboards.yml file. Default value will remain same which is http://localhost:9200 in case opensearch.hosts is commented in opensearch_dashboards.yml file.

Issues Resolved

#4700

Screenshot

Status page when #opensearch.hosts: ["http://localhost:9200"] OR opensearch.hosts: ["http://localhost:9200"] in opensearch_dashboards.yml file.
Default Status Page

Status page when opensearch.hosts:[] in opensearch_dashboards.yml file.

Screenshot 2023-08-22 at 10 00 35 AM

API Status response:

% curl localhost:5601/api/status | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10279  100 10279    0     0  2987k      0 --:--:-- --:--:-- --:--:-- 3346k
{
  "name": "dev-dsk-bandinib-2c-1b8c3fb7.us-west-2.amazon.com",
  "uuid": "9e48a33a-9b44-4488-9cdc-22244cb1c8af",
  "version": {
    "number": "3.0.0",
    "build_hash": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "build_number": 9007199254740991,
    "build_snapshot": false
  },
  "status": {
    "overall": {
      "since": "2023-08-22T16:58:09.161Z",
      "state": "green",
      "title": "Green",
      "nickname": "Looking good",
      "icon": "success",
      "uiColor": "secondary"
    },
    "statuses": [
      {
        "id": "core:[email protected]",
        "message": "Opensearch is not configured",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "core:[email protected]",
        "message": "Saved Object Service is using Postgres and it is up",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      },
      {
        "id": "plugin:[email protected]",
        "message": "All dependencies are available",
        "since": "2023-08-22T16:58:09.161Z",
        "state": "green",
        "icon": "success",
        "uiColor": "secondary"
      }
    ]
  },
  "metrics": {
    "last_updated": "2023-08-22T16:58:07.854Z",
    "collection_interval_in_millis": 5000,
    "os": {
      "platform": "linux",
      "platformRelease": "linux-5.4.250-173.369.amzn2int.x86_64",
      "load": {
        "1m": 0.09,
        "5m": 0.11,
        "15m": 0.05
      },
      "memory": {
        "total_in_bytes": 16170184704,
        "free_in_bytes": 14283046912,
        "used_in_bytes": 1887137792
      },
      "uptime_in_millis": 134766270,
      "distro": "Amazon Linux",
      "distroRelease": "Amazon Linux-2 (Karoo)",
      "cpuacct": {
        "control_group": "/user.slice",
        "usage_nanos": 9161043095779
      },
      "cpu": {
        "control_group": "/user.slice",
        "cfs_period_micros": 100000,
        "cfs_quota_micros": -1,
        "stat": {
          "number_of_elapsed_periods": 0,
          "number_of_times_throttled": 0,
          "time_throttled_nanos": 0
        }
      }
    },
    "process": {
      "memory": {
        "heap": {
          "total_in_bytes": 127447040,
          "used_in_bytes": 110396848,
          "size_limit": 2197815296
        },
        "resident_set_size_in_bytes": 252866560
      },
      "pid": 19229,
      "event_loop_delay": 0.3745400011539459,
      "uptime_in_millis": 88092.057665
    },
    "response_times": {
      "avg_in_millis": 0,
      "max_in_millis": 0
    },
    "concurrent_connections": 6,
    "requests": {
      "disconnects": 0,
      "total": 0,
      "statusCodes": {},
      "status_codes": {}
    }
  }
}

Testing the changes

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #4701 (862d2ca) into main (d7c5577) will increase coverage by 0.00%.
The diff coverage is 83.33%.

@@           Coverage Diff           @@
##             main    #4701   +/-   ##
=======================================
  Coverage   66.30%   66.30%           
=======================================
  Files        3322     3322           
  Lines       63919    63923    +4     
  Branches    10115    10117    +2     
=======================================
+ Hits        42381    42384    +3     
  Misses      19050    19050           
- Partials     2488     2489    +1     
Flag Coverage Δ
Linux_1 34.84% <ø> (ø)
Linux_2 55.14% <83.33%> (+<0.01%) ⬆️
Linux_3 43.39% <0.00%> (-0.01%) ⬇️
Linux_4 35.10% <0.00%> (-0.01%) ⬇️
Windows_1 34.85% <ø> (ø)
Windows_2 55.10% <83.33%> (+<0.01%) ⬆️
Windows_3 43.40% <0.00%> (-0.01%) ⬇️
Windows_4 35.10% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/core/server/opensearch/opensearch_config.ts 93.58% <ø> (ø)
src/core/server/opensearch/status.ts 70.00% <0.00%> (-7.78%) ⬇️
...rc/core/server/opensearch/client/cluster_client.ts 84.21% <100.00%> (ø)
src/core/server/opensearch/opensearch_service.ts 84.61% <100.00%> (+1.28%) ⬆️

@bandinib-amzn bandinib-amzn force-pushed the relax-nodecompatibility-check branch from 61e10d7 to ce08007 Compare August 9, 2023 19:42
@bandinib-amzn bandinib-amzn marked this pull request as ready for review August 9, 2023 19:42
@bandinib-amzn bandinib-amzn changed the title Relax OpenSearch Node Compatibility check [WIP] Relax OpenSearch Node Compatibility check Aug 9, 2023
@bandinib-amzn bandinib-amzn force-pushed the relax-nodecompatibility-check branch 6 times, most recently from ab5b588 to 3b512ea Compare August 14, 2023 20:47
@bandinib-amzn bandinib-amzn changed the title [WIP] Relax OpenSearch Node Compatibility check Remove minimum constraint on OpenSearch hosts to allow empty host Aug 14, 2023
@bandinib-amzn bandinib-amzn changed the title Remove minimum constraint on OpenSearch hosts to allow empty host Remove minimum constraint on OpenSearch hosts to allow empty host and refactor status API to not include OpenSearch status when host is empty Aug 14, 2023
zhongnansu
zhongnansu previously approved these changes Aug 14, 2023
Copy link
Member

@zhongnansu zhongnansu left a comment

Choose a reason for hiding this comment

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

lgtm

@bandinib-amzn bandinib-amzn force-pushed the relax-nodecompatibility-check branch from 3b512ea to 70c87cb Compare August 21, 2023 20:29
@bandinib-amzn bandinib-amzn requested a review from curq as a code owner August 21, 2023 20:29
@bandinib-amzn bandinib-amzn force-pushed the relax-nodecompatibility-check branch 2 times, most recently from 202d8ba to 64c8a50 Compare August 21, 2023 23:28
@@ -77,7 +77,7 @@ export const calculateStatus$ = (

return {
level: ServiceStatusLevels.available,
summary: `OpenSearch is available`,
summary: message ?? `OpenSearch is available`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
summary: message ?? `OpenSearch is available`,
summary: message || `OpenSearch is available`,

|| is a safer operator to guard against '' and false.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Though, i would prefer to be stricter..

Suggested change
summary: message ?? `OpenSearch is available`,
summary: (message ?? `OpenSearch is available`) || `Unknown`,

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea! Refactored to be more stricter.

AMoo-Miki
AMoo-Miki previously approved these changes Aug 22, 2023
@zhongnansu zhongnansu merged commit 8e1ec99 into opensearch-project:main Aug 23, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 23, 2023
Signed-off-by: Bandini Bhopi <[email protected]>
(cherry picked from commit 8e1ec99)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
joshuarrrr added a commit that referenced this pull request Aug 28, 2023
Signed-off-by: Bandini Bhopi <[email protected]>
(cherry picked from commit 8e1ec99)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Josh Romero <[email protected]>
@bandinib-amzn bandinib-amzn deleted the relax-nodecompatibility-check branch December 20, 2023 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants