Skip to content

Update logs api object#473

Open
lucarin91 wants to merge 3 commits into
arduino:mainfrom
lucarin91:update-logs-api-object
Open

Update logs api object#473
lucarin91 wants to merge 3 commits into
arduino:mainfrom
lucarin91:update-logs-api-object

Conversation

@lucarin91

Copy link
Copy Markdown
Contributor

Motivation

Change description

Additional Notes

Reviewer checklist

  • PR addresses a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.
@lucarin91 lucarin91 marked this pull request as ready for review June 23, 2026 12:22
@lucarin91 lucarin91 requested review from a team, Copilot and mirkoCrobu and removed request for mirkoCrobu June 23, 2026 12:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) containing source, id, and message, and use it as the SSE data: payload.
  • Update OpenAPI/gendoc to reference the new response shape for the logs SSE endpoint.
  • Add python_runner to the OpenAPI ConfigResponse schema.

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 thread cmd/gendoc/docs.go
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"`
@per1234 per1234 added the enhancement New feature or request label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

3 participants