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

feat: add deep health check #3210

Merged
merged 18 commits into from
Jan 5, 2024
Merged

feat: add deep health check #3210

merged 18 commits into from
Jan 5, 2024

Conversation

Chethan-rao
Copy link
Contributor

@Chethan-rao Chethan-rao commented Dec 27, 2023

Type of Change

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

Description

This PR adds support for performing a deeper health check of the application which includes:

  • Database connection check with read, write and delete queries (Added support for database transaction too)
  • Redis connection check with set, get and delete key (Set key with expiry of 30sec)
  • Locker health call from Hyperswitch application

The deep health check API returns a 200 status code if all the components are in good health, but returns 500 if at least one component's health is down

Additional Changes

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

Motivation and Context

How did you test it?

  1. Hit /health for getting just the application health.
  2. Hit /health/deep_check for getting deep report of components health
  • Test case 1 (Application not able to connect to database because postgresql is down)

image

  • Test case 2 (Database Insert query failing because of duplication)

image

  • Test case 3 (Locker is down)

image

  • Test case 4 (Locker is up but key custodian locked)

image

  • Test case 5 (Locker is up with key custodian unlocked)

image

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
  • I added a CHANGELOG entry if applicable

@Chethan-rao Chethan-rao added C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Dec 27, 2023
@Chethan-rao Chethan-rao added this to the December 2023 Release milestone Dec 27, 2023
@Chethan-rao Chethan-rao self-assigned this Dec 27, 2023
@Chethan-rao Chethan-rao requested a review from a team as a code owner December 27, 2023 15:29
crates/router/src/db/health_check.rs Outdated Show resolved Hide resolved
crates/router/src/routes/health.rs Outdated Show resolved Hide resolved
SanchithHegde
SanchithHegde previously approved these changes Dec 28, 2023
SanchithHegde
SanchithHegde previously approved these changes Dec 29, 2023
crates/api_models/src/health_check.rs Outdated Show resolved Hide resolved
crates/router/src/db/health_check.rs Show resolved Hide resolved
crates/router/src/db/health_check.rs Show resolved Hide resolved
crates/router/src/db/kafka_store.rs Show resolved Hide resolved
crates/router/src/routes/app.rs Show resolved Hide resolved
crates/router/src/db/health_check.rs Outdated Show resolved Hide resolved
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 5, 2024
Merged via the queue into main with commit f30ba89 Jan 5, 2024
10 of 12 checks passed
@likhinbopanna likhinbopanna deleted the health_checks branch January 5, 2024 11:05
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jan 7, 2024
pixincreate added a commit that referenced this pull request Jan 8, 2024
* 'main' of github.com:juspay/hyperswitch:
  fix(connector): [Stripe] Deserialization Error while parsing Dispute Webhook Body (#3256)
  refactor(euclid_wasm): Update wasm config (#3222)
  fix(analytics): added response to the connector outgoing event (#3129)
  fix(analytics): fixed response code to 501 (#3119)
  fix(connector): [NMI] Populating `ErrorResponse` with required fields and Mapping `connector_response_reference_id` (#3214)
  feat(merchant_account): Add list multiple merchants in `MerchantAccountInterface` (#3220)
  feat: include version number in response headers and on application startup (#3045)
  chore: address Rust 1.75 clippy lints (#3231)
  feat: add deep health check (#3210)
  feat(analytics): adding outgoing webhooks kafka event (#3140)
  refactor: address panics due to indexing and slicing (#3233)
  fix(users): Fix wrong redirection url in magic link (#3217)
  fix(user): add integration_completed enum in metadata type (#3245)
  chore(version): v1.106.1
  fix(connector): [iatapay] change refund amount (#3244)
  chore(version): v1.106.0
  test(postman): update postman collection files
  fix(core): fix recurring mandates flow for cyber source (#3224)
  chore: fix channel handling for consumer workflow loop (#3223)
@Chethan-rao Chethan-rao linked an issue Jan 8, 2024 that may be closed by this pull request
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: Feature request or enhancement
Projects
No open projects
Status: Under Development
Development

Successfully merging this pull request may close these issues.

Deep health check for Hyperswitch Server
4 participants