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

Health Endpoint Design Document #2503

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sezal98
Copy link
Contributor

@sezal98 sezal98 commented Dec 30, 2024

Why make this change?

Design DOcument for Health Endpoint
Resolves: 2504

What is this change?

  • Summary of how your changes work to give reviewers context of your intent.
    • Links to relevant documentation / StackOverflow, if applicable.

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

  • Example REST and/or GraphQL request to demonstrate modifications
  • Example of CLI usage to demonstrate modifications

@abhishekkumams
Copy link
Contributor

How would the health endpoint will function with hot reload? In case of bad config it might use last good known config which might give wrong status.

Would be good to add limitations.

@sezal98
Copy link
Contributor Author

sezal98 commented Jan 3, 2025

How would the health endpoint will function with hot reload? In case of bad config it might use last good known config which might give wrong status.

Would be good to add limitations.

I dont see an issue in this, If DAB Engine is working then health point should be consistent with that. If DAB engine is using the last known config, then health endpoint would also show the health of the last known config.
Showing health of the current config but running the engine with the last known config would create inconsistencies which would be incorrect for the user.
We should put this in documentation that we are using the last known config in case of hot reload and showing health of that old config not the bad config.

Another important point to note is.. Health is independent of Validity of config. Health endpoint is only shown when the config is valid (no errors) and DAB engine is running. So the case of bad config would not occur.

@JerryNixon , Any thoughts on this?

@abhishekkumams
Copy link
Contributor

How would the health endpoint will function with hot reload? In case of bad config it might use last good known config which might give wrong status.
Would be good to add limitations.

I dont see an issue in this, If DAB Engine is working then health point should be consistent with that. If DAB engine is using the last known config, then health endpoint would also show the health of the last known config. Showing health of the current config but running the engine with the last known config would create inconsistencies which would be incorrect for the user. We should put this in documentation that we are using the last known config in case of hot reload and showing health of that old config not the bad config.

Another important point to note is.. Health is independent of Validity of config. Health endpoint is only shown when the config is valid (no errors) and DAB engine is running. So the case of bad config would not occur.

@JerryNixon , Any thoughts on this?

Thanks for clarifying. can you add the same to your documentation as well.

@abhishekkumams
Copy link
Contributor

How will we be checking if an endpoint is healthy or not? Are we gonna make a db call internally? Or hit the endpoint itself to check the status? Or something else?

@sezal98
Copy link
Contributor Author

sezal98 commented Jan 9, 2025

How will we be checking if an endpoint is healthy or not? Are we gonna make a db call internally? Or hit the endpoint itself to check the status? Or something else?

Yes, as mentioned in the document, we would be making the call internally and hitting the specified query. If this query is sucessfull and within the threshold specified, the entity would be considered healthy. Else, we would say, its unhealthy with the exception message

| `enabled` | Boolean | No | `true` | Enables or disables health checks at the runtime level. |
| `cache-ttl` | Integer | No | `5` | Time-to-live (in seconds) for caching health check results. |
| `max-dop` | Integer | No | `1` | Maximum Degree of Parallelism for running health checks. |
| `roles` | Array | No | `*` | Roles allowed to access the health endpoint (e.g., `anonymous`, `authenticated`). |
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the * mean?


#### `data-source.health` Configuration

The data source config parameters specify the query that we should run on the data source and the threshold of ms if should come under to qualify as a healthy data source for DAB.
Copy link
Contributor

Choose a reason for hiding this comment

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

Change if to it

Suggested change
The data source config parameters specify the query that we should run on the data source and the threshold of ms if should come under to qualify as a healthy data source for DAB.
The data source config parameters specify the query that we should run on the data source and the threshold of ms it should come under to qualify as a healthy data source for DAB.


#### `<entity-name>.health` Configuration

The Entity config parameters contain information about the GET filter or query which needs to be carried out on the data source entiy and under what threshold should the response be received for it to qualify as a healthy entity.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be entity

Suggested change
The Entity config parameters contain information about the GET filter or query which needs to be carried out on the data source entiy and under what threshold should the response be received for it to qualify as a healthy entity.
The Entity config parameters contain information about the GET filter or query which needs to be carried out on the data source entity and under what threshold should the response be received for it to qualify as a healthy entity.

Comment on lines +3 to +4
The objective of this task is to enhance the "Health Endpoint" for DAB. Currently we only show whether the DAB Engine is healthy or not and which version of DAB is running. However, the objective under this task item is to enhance this to support delatiled description of each supported (enabled) endpoint with all different kinds of parameters that would be defined below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be detailed instead of delatiled

Suggested change
The objective of this task is to enhance the "Health Endpoint" for DAB. Currently we only show whether the DAB Engine is healthy or not and which version of DAB is running. However, the objective under this task item is to enhance this to support delatiled description of each supported (enabled) endpoint with all different kinds of parameters that would be defined below.
The objective of this task is to enhance the "Health Endpoint" for DAB. Currently we only show whether the DAB Engine is healthy or not and which version of DAB is running. However, the objective under this task item is to enhance this to support detailed description of each supported (enabled) endpoint with all different kinds of parameters that would be defined below.

| **Property** | **Data Type** | **Required** | **Default** | **Description** |
|------------------|---------------|--------------|-------------|------------------------------------------------------------------------------------------------------|
| `enabled` | Boolean | No | `true` | Enables or disables health checks for the specific entity. |
| `filter` | String | No | `null` | Filter condition applied to the health check query (e.g., `"Id eq 1"`). |
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would we need a filter for the health check?

Comment on lines +100 to +104
"health" : {
"moniker": "sqlserver", (optional default: NULL) // not required, on purpose, most have just one
"enabled": true, (default: true)
"query": "SELECT TOP 1 1", (option)
"threshold-ms": 100 (optional default: 10000)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be good to show how it would look like when there are multiple data-source

Comment on lines +127 to +128
"status": "Unhealthy",
"status": "Healthy",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are there 2 status?

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.

Design Document for Health Endpoint
3 participants