Skip to content

PROP-45 - Seperate History and Last Hearbeat Endpoints#183

Open
JeffMboya wants to merge 2 commits intoabsmach:mainfrom
JeffMboya:PROP-45
Open

PROP-45 - Seperate History and Last Hearbeat Endpoints#183
JeffMboya wants to merge 2 commits intoabsmach:mainfrom
JeffMboya:PROP-45

Conversation

@JeffMboya
Copy link
Copy Markdown
Contributor

@JeffMboya JeffMboya commented Apr 8, 2026

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 full alive_at array (every heartbeat timestamp) as part of the proplet object, which polluted every proplet response with unbounded history data.

This PR makes the following changes:

  • Removes alive_at from the GET /proplets/{id} and GET /proplets responses. A new last_alive_at field (the most recent heartbeat timestamp) is added to the response so clients can still display last-seen time without fetching the full history.
  • Adds a new paginated endpoint GET /proplets/{id}/alive-history?offset=N&limit=N that returns the full heartbeat history for a specific proplet.
  • Adds GetAliveHistory to all storage backends (postgres, sqlite, badger, memory). The history is retrieved from the existing alive_history column and paginated in-memory using offset and limit.
  • Wires GetPropletAliveHistory through the full manager stack: service interface, implementation, HTTP endpoint, transport route, logging/metrics/tracing middleware, service mock, and storage repository mock.
  • Adds GetPropletAliveHistory to the SDK interface and implements it in pkg/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/proplet package has no test file (pre-existing gap), so PropletView and 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}/metrics endpoint. The SDK method includes an inline usage example consistent with all other SDK methods.

Notes

The alive_history column in postgres and sqlite stores timestamps as a JSON blob on the proplet row. GetAliveHistory retrieves the full blob and slices it. This is consistent with the existing storage approach and avoids a schema migration. A separate alive_history table would allow server-side pagination but is left as future work.

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.
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.

Feature: Seperate History and Last Hearbeat Endpoints

1 participant