Skip to content

🩺 Add Health Check and Sessions Endpoints #925

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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

aacic
Copy link
Collaborator

@aacic aacic commented Apr 23, 2025

This PR introduces the healthcheck endpoint and the sessions endpoint.

The purpose of the healthcheck endpoint is to tell if the TileServer is running.

The purpose of the sessions endpoint is to return a mapping of all active sessions and their loaded Whole Slide Images (WSIs).

@aacic aacic requested a review from shaneahmed April 23, 2025 16:19
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.70%. Comparing base (bae6c2e) to head (1fbf80e).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #925   +/-   ##
========================================
  Coverage    99.70%   99.70%           
========================================
  Files           71       71           
  Lines         8848     8859   +11     
  Branches      1154     1156    +2     
========================================
+ Hits          8822     8833   +11     
  Misses          23       23           
  Partials         3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shaneahmed shaneahmed changed the title Add healthcheck and sessions endpoints 🩺 Add Health Check and Sessions Endpoints Apr 24, 2025
@shaneahmed shaneahmed added the enhancement New feature or request label Apr 25, 2025
@shaneahmed shaneahmed added this to the Release v1.7.0 milestone Apr 25, 2025
@shaneahmed shaneahmed requested a review from measty April 25, 2025 15:04
aacic and others added 2 commits April 28, 2025 09:22
Fix docs.

Co-authored-by: Shan E Ahmed Raza <[email protected]>
Fix docs.

Co-authored-by: Shan E Ahmed Raza <[email protected]>
@aacic aacic requested a review from shaneahmed April 28, 2025 14:23
@Jiaqi-Lv Jiaqi-Lv requested a review from Copilot May 9, 2025 10:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds two new endpoints – one for verifying the server's health and another for retrieving active session-to-slide mappings – along with corresponding API documentation and tests.

  • Adds documentation for the healthcheck and sessions endpoints in the OpenAPI spec (tileserver_api.yml).
  • Implements route handlers for the healthcheck and sessions endpoints in the TileServer class.
  • Provides unit tests for both endpoints in tests/test_tileserver.py.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tiatoolbox/visualization/tileserver_api.yml Adds API documentation for sessions and healthcheck endpoints.
tiatoolbox/visualization/tileserver.py Implements sessions and healthcheck endpoints; duplicate route registration observed.
tests/test_tileserver.py Adds tests to verify the behavior of the new endpoints.

@@ -165,6 +165,8 @@ def __init__( # noqa: PLR0915
self.route("/tileserver/tap_query/<x>/<y>")(self.tap_query)
self.route("/tileserver/prop_range", methods=["PUT"])(self.prop_range)
self.route("/tileserver/shutdown", methods=["POST"])(self.shutdown)
self.route("/tileserver/sessions", methods=["GET"])(self.sessions)
Copy link
Preview

Copilot AI May 9, 2025

Choose a reason for hiding this comment

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

The sessions endpoint is registered twice in the init method, which may lead to confusion. Consider removing the duplicate registration to keep the endpoint configuration clear and maintainable.

Suggested change
self.route("/tileserver/sessions", methods=["GET"])(self.sessions)
# Removed duplicate registration of the /tileserver/sessions endpoint

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The sessions endpoint is registered only once, this is a false statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants