Update logs api object#473
Open
lucarin91 wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the /v1/apps/{id}/logs SSE API to emit a structured JSON payload (instead of the previous inline struct) and aligns the OpenAPI + gendoc generator to describe that payload. It also updates the OpenAPI schema for ConfigResponse to include python_runner.
Changes:
- Introduce a dedicated log-message response type (
ResponceLogs) containingsource,id, andmessage, and use it as the SSEdata:payload. - Update OpenAPI/gendoc to reference the new response shape for the logs SSE endpoint.
- Add
python_runnerto the OpenAPIConfigResponseschema.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| internal/api/handlers/app_logs.go | Defines and emits the new structured SSE log payload; adjusts default log filtering and filter key. |
| internal/api/docs/openapi.yaml | Updates /v1/apps/{id}/logs response schema to reference the new object; adds python_runner to ConfigResponse; defines ResponceLogs component. |
| cmd/gendoc/docs.go | Updates OpenAPI generator config to use the new handler response type for the logs SSE endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "github.com/arduino/arduino-app-cli/internal/render" | ||
| ) | ||
|
|
||
| type ResponceLogs struct { |
Comment on lines
+55
to
59
| showAppLogs, showServicesLogs := true, true | ||
| if filter := queryParams.Get("filter"); filter != "" { | ||
| filters := strings.Split(strings.TrimSpace(filter), ",") | ||
| showServicesLogs = slices.Contains(filters, "services") | ||
| showServicesLogs = slices.Contains(filters, "bricks") | ||
| showAppLogs = slices.Contains(filters, "app") |
Comment on lines
669
to
+671
| text/event-stream: | ||
| schema: | ||
| type: string | ||
| $ref: '#/components/schemas/ResponceLogs' |
Comment on lines
+1951
to
+1952
| ResponceLogs: | ||
| properties: |
Comment on lines
685
to
688
| CustomSuccessResponse: &CustomResponseDef{ | ||
| ContentType: "text/event-stream", | ||
| DataStructure: orchestrator.LogMessage{}, | ||
| DataStructure: handlers.ResponceLogs{}, | ||
| }, |
Comment on lines
+100
to
+103
| sseStream.Send(render.SSEEvent{Type: "message", Data: ResponceLogs{ | ||
| Message: item.Content, | ||
| BrickID: item.BrickName, | ||
| ID: item.Name, | ||
| Source: cmp.Or(item.BrickName, "python"), |
Comment on lines
+26
to
+29
| // Source is either `python` or the name of the brick that produced the log message. | ||
| Source string `json:"source"` | ||
| // ID is the low-level docker container identifier. | ||
| ID string `json:"id"` |
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.
Motivation
Change description
Additional Notes
Reviewer checklist
main.