Add monitor response log API endpoints#2129
Open
potofpie wants to merge 4 commits intoopenstatusHQ:mainfrom
Open
Add monitor response log API endpoints#2129potofpie wants to merge 4 commits intoopenstatusHQ:mainfrom
potofpie wants to merge 4 commits intoopenstatusHQ:mainfrom
Conversation
|
@potofpie is attempting to deploy a commit to the OpenStatus Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
1 issue found across 12 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/server/src/routes/rpc/handlers/monitor/__tests__/monitor.test.ts">
<violation number="1" location="apps/server/src/routes/rpc/handlers/monitor/__tests__/monitor.test.ts:2511">
P2: The workspace-isolation test uses a hardcoded id instead of a real foreign-workspace monitor, so it does not actually prove the authorization boundary it claims to cover.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
Why
When an OpenStatus monitor alerts, the dashboard has useful per-request debugging context: the exact response-log row, region, status code, latency, response headers, assertions, and timing data. Today that information is only practical to inspect manually in the dashboard.
This adds a programmatic way for operators and agents to fetch the same response-log context from an API key, so an alert can be turned into an investigation payload without screen-scraping the dashboard.
The main use case is incident investigation. Many internal platforms include correlation identifiers in response headers, such as trace IDs, request IDs, session IDs, deployment IDs, or thread IDs. Those IDs are often the thing an operator needs to kick off a deeper investigation in tracing/logging systems. If a monitor fails, the agent can fetch the failed response log, read the non-sensitive correlation headers, and use those IDs to start the next investigation step.
Example workflow:
x-trace-id,x-request-id, or deployment/session identifiers.What changed
ListMonitorResponseLogsGetMonitorResponseLogresponse-logsworkspace entitlement.limit,offset,hasMore, andnextOffset.limit/offsetare optional and existing dashboard callers are not capped by default.Privacy and safety
x-openstatus-keyand resolves the workspace from that key before reading any monitor/log data.Possible follow-up
A useful next step would be monitor-level configuration for response-log header exposure. The monitor settings UI could let users define an allow list of headers that should remain visible in API responses, while all other headers are redacted by default. That would make the operational debugging contract explicit per monitor, for example allowing
x-trace-id,x-request-id, orx-deployment, without relying only on global redaction heuristics.Validation
bun --env-file=apps/server/.env.test test apps/server/src/routes/rpc/handlers/monitor/__tests__/monitor.test.ts apps/server/src/routes/rpc/handlers/monitor/response-logs.test.ts apps/server/src/routes/v1/monitors/get.test.tsgit diff --check6Notes
This intentionally keeps offset pagination because the existing ConnectRPC list APIs in this repo use
limit/offset. The response-log request also supports timestamp bounds, so callers that need a stable time window can page within an explicitfromTimestamp/toTimestamprange.