PROP-45 - Seperate History and Last Hearbeat Endpoints#183
Open
JeffMboya wants to merge 2 commits intoabsmach:mainfrom
Open
PROP-45 - Seperate History and Last Hearbeat Endpoints#183JeffMboya wants to merge 2 commits intoabsmach:mainfrom
JeffMboya wants to merge 2 commits intoabsmach:mainfrom
Conversation
Removes AliveHistory from the proplet response and exposes it via a
new GET /proplets/{id}/alive-history endpoint with offset/limit
pagination. The single-proplet response retains alive (bool) and gains
last_alive_at (the most recent heartbeat timestamp).
Adds GetAliveHistory to all storage backends (postgres, sqlite, badger,
memory) and wires GetPropletAliveHistory through the full manager stack:
service, endpoint, transport, logging/metrics/tracing middleware, mock,
and SDK.
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.
What type of PR is this?
This is a feature because it separates the proplet heartbeat history into its own dedicated endpoint, resolving issue #45.
What does this do?
Previously,
GET /proplets/{id}returned the fullalive_atarray (every heartbeat timestamp) as part of the proplet object, which polluted every proplet response with unbounded history data.This PR makes the following changes:
alive_atfrom theGET /proplets/{id}andGET /propletsresponses. A newlast_alive_atfield (the most recent heartbeat timestamp) is added to the response so clients can still display last-seen time without fetching the full history.GET /proplets/{id}/alive-history?offset=N&limit=Nthat returns the full heartbeat history for a specific proplet.GetAliveHistoryto all storage backends (postgres, sqlite, badger, memory). The history is retrieved from the existingalive_historycolumn and paginated in-memory using offset and limit.GetPropletAliveHistorythrough the full manager stack: service interface, implementation, HTTP endpoint, transport route, logging/metrics/tracing middleware, service mock, and storage repository mock.GetPropletAliveHistoryto the SDK interface and implements it inpkg/sdk/proplet.go.Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
No new tests were added. The existing manager and sqlite storage tests pass without modification. The
pkg/propletpackage has no test file (pre-existing gap), soPropletViewand the.View()converters are covered only by the build and integration flow.Did you document any new/modified features?
The new endpoint follows the same conventions as the existing
GET /proplets/{id}/metricsendpoint. The SDK method includes an inline usage example consistent with all other SDK methods.Notes
The
alive_historycolumn in postgres and sqlite stores timestamps as a JSON blob on the proplet row.GetAliveHistoryretrieves the full blob and slices it. This is consistent with the existing storage approach and avoids a schema migration. A separatealive_historytable would allow server-side pagination but is left as future work.