Skip to content

Conversation

su-shivanshmathur
Copy link
Contributor

@su-shivanshmathur su-shivanshmathur commented Apr 23, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Reference #7810

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

When you don't have OpenSearch deployed for Global Search feature on dashboard , the /health/ready ( deep health check ) API which checks health of all the underlying queryable resources fails because OpenSearch is not present.

To make it optional based on the deployment type needs changes and should be dependent on a config which should be given out on time of router deployment

Currently if you don't have OpenSearch Deployment and have router running

curl http://localhost:8080/health/ready -v
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /health/ready HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 500 Internal Server Error
< content-length: 136
< access-control-expose-headers: x-request-id, content-type, via, strict-transport-security
< via: HyperSwitch
< x-request-id: 019634f7-a837-7d50-9a50-bb8e7651bd62
< content-type: application/json
< vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
< strict-transport-security: max-age=31536000
< date: Mon, 14 Apr 2025 15:42:47 GMT
< 
{ [136 bytes data]
100   136  100   136    0     0   7613      0 --:--:-- --:--:-- --:--:--  8000
{
  "error": {
    "type": "api",
    "message": "Opensearch health check failed with error: Error while executing query in Opensearch",
    "code": "HE_00"
  }
}

How did you test it?

curl http://localhost:8080/health/ready -v | jq .
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /health/ready HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< content-length: 90
< content-type: application/json
< x-request-id: 01963e0a-e41d-7251-b20a-e9a0a6d1a67a
< vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
< access-control-expose-headers: content-type, strict-transport-security, x-request-id, via
< strict-transport-security: max-age=31536000
< via: HyperSwitch
< date: Wed, 16 Apr 2025 10:00:23 GMT
< 
{ [90 bytes data]
100    90  100    90    0     0    236      0 --:--:-- --:--:-- --:--:--   236
{
  "database": true,
  "redis": true,
  "analytics": true,
  "opensearch": false,
  "outgoing_request": true
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@su-shivanshmathur su-shivanshmathur requested review from a team as code owners April 23, 2025 09:21
Copy link

semanticdiff-com bot commented Apr 23, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/analytics.rs  81% smaller
  crates/router/src/core/health_check.rs  56% smaller
  crates/router/src/routes/app.rs  40% smaller
  crates/analytics/src/opensearch.rs  34% smaller
  config/config.example.toml Unsupported file format
  config/deployments/env_specific.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format

@su-shivanshmathur su-shivanshmathur self-assigned this Apr 23, 2025
@su-shivanshmathur su-shivanshmathur linked an issue Apr 23, 2025 that may be closed by this pull request
@su-shivanshmathur su-shivanshmathur changed the title chore(analytics): opensearch hotfix chore(analytics): opensearch changes for opensearch-client creation based on config Apr 23, 2025
@SanchithHegde SanchithHegde changed the title chore(analytics): opensearch changes for opensearch-client creation based on config chore(analytics): opensearch client creation based on config Apr 23, 2025
@Gnanasundari24 Gnanasundari24 merged commit a387bd4 into hotfix-2025.04.09.0 Apr 23, 2025
30 of 39 checks passed
@Gnanasundari24 Gnanasundari24 deleted the chore/opensearch_hotfix branch April 23, 2025 14:25
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.

Deep health check failing because of OpenSearch
5 participants