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

Including health check response in telemetry #151

Merged
merged 10 commits into from
Mar 13, 2025
Merged

Conversation

kattameghana
Copy link
Collaborator

No description provided.

@paigerube14
Copy link
Contributor

Let's also add the healthCheck details to the elastic model as well:

class ElasticChaosRunTelemetry(Document):

url = Text()
status= Boolean()
status_code= Text()
start_timestamp= Text()
Copy link
Contributor

Choose a reason for hiding this comment

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

wondering if these two timestamps should be Date types

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Modified to the Date() datetype

status_code= Text()
start_timestamp= Text()
end_timestamp= Text()
duration= Text()
Copy link
Contributor

@paigerube14 paigerube14 Mar 10, 2025

Choose a reason for hiding this comment

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

@tsebastiani @chaitanyaenr what are your thoughts on putting this as an int/float (number of seconds) that the url had a certain status? Meghana had put in HH:MM:SS which is nice to look at but wondering for consistency if seconds would be better and easier to put into graphs for visualization. Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed the duration into integer type

Copy link
Collaborator

@tsebastiani tsebastiani left a comment

Choose a reason for hiding this comment

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

/lgtm

@kattameghana
Copy link
Collaborator Author

kattameghana commented Mar 11, 2025

The health check response follows the below format.

Success case:
"health_checks" : [
{
"url" : "http://example.com",
"status" : true,
"status_code" : 200,
"start_timestamp" : "2025-03-11T16:56:31.407462",
"end_timestamp" : "2025-03-11T16:59:56.903850",
"duration" : 205.496388
}
]

Failure case:
"health_checks" : [
{
"url" : "http://example.com",
"status" : false,
"status_code" : "503",
"start_timestamp" : "2025-03-11T17:56:07.677704",
"end_timestamp" : "2025-03-11T17:56:12.656610",
"duration" : 4.978906
}
]

When the health check configuration is empty, no data will be pushed to Elasticsearch. the following data will be displayed in telemetry.
"health_checks": null

"status_code": "503",
"start_timestamp": "2025-03-05 12:47:59",
"end_timestamp": "2025-03-05 12:48:02",
"duration": "0:00:03"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should align the tests with the new duration format

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made the changes

self.assertEqual(elastic_telemetry.health_checks[0].status_code, "503")
self.assertEqual(elastic_telemetry.health_checks[0].start_timestamp, "2025-03-05 12:47:59")
self.assertEqual(elastic_telemetry.health_checks[0].end_timestamp, "2025-03-05 12:48:02")
self.assertEqual(elastic_telemetry.health_checks[0].duration, "0:00:03")
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made the changes

@paigerube14
Copy link
Contributor

@kattameghana when you get your PR into a place where your tests are passing, you should try to squash your commits into one commit: https://github.com/krkn-chaos/krkn/blob/main/docs/contribute.md#squash-commits

@tsebastiani tsebastiani merged commit d482a26 into main Mar 13, 2025
3 of 4 checks passed
@tsebastiani tsebastiani deleted the health_checks branch March 13, 2025 15:32
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.

3 participants