feat: support fetching monitor status from different dates#472
Closed
victorboissiere wants to merge 1 commit intorajnandan1:mainfrom
Closed
feat: support fetching monitor status from different dates#472victorboissiere wants to merge 1 commit intorajnandan1:mainfrom
victorboissiere wants to merge 1 commit intorajnandan1:mainfrom
Conversation
Signed-off-by: Victor Boissiere <victor.boissiere@gmail.com>
rajnandan1
reviewed
Aug 5, 2025
| } | ||
| let start = GetDayStartTimestampUTC(now); | ||
|
|
||
| let start, end; |
Owner
There was a problem hiding this comment.
start and end change to UTC, rest every api we use UTC
rajnandan1
reviewed
Aug 5, 2025
| // Handle date range parameters | ||
| if (startDate && endDate) { | ||
| // Parse start_date and end_date (expecting YYYY-MM-DD format) | ||
| try { |
Owner
There was a problem hiding this comment.
do not need try catch here if you handle it
rajnandan1
reviewed
Aug 5, 2025
| let start, end; | ||
|
|
||
| // Handle date range parameters | ||
| if (startDate && endDate) { |
Owner
There was a problem hiding this comment.
this code block could be simplified
handle error conditions and return as soon as possible in code, less if else
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've enhanced the /api/status endpoint to support time range queries. Here's what was changed:
Current behavior was: Uptime calculated from start of current day to now (or specified timestamp).
Enhanced functionality:
- start_date: Start date in YYYY-MM-DD format
- end_date: End date in YYYY-MM-DD format
- GET /api/status?tag=your-monitor&start_date=2025-07-01&end_date=2025-07-31 - July uptime
- GET /api/status?tag=your-monitor&start_date=2025-07-01 - From July 1st to now
- GET /api/status?tag=your-monitor&end_date=2025-07-31 - July 31st (full day)
- GET /api/status?tag=your-monitor - Current day (existing behavior)
- time_range.start: Start timestamp
- time_range.end: End timestamp
- Original fields: status, uptime, last_updated_at
- Invalid date formats
- Start date after end date
- No data for time range
The uptime calculation now works across any specified date range, giving you exactly what you requested - the ability to query uptime between
specific dates like July 1-31.