Skip to content

chore: rename startup logs to agent logs #8649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 28, 2023
Merged

chore: rename startup logs to agent logs #8649

merged 16 commits into from
Jul 28, 2023

Conversation

kylecarbs
Copy link
Member

This also adds a source property to every agent log. It should allow us to group logs and display them nicer in the UI as they stream in.

This also adds a `source` property to every agent log. It
should allow us to group logs and display them nicer in
the UI as they stream in.
@kylecarbs kylecarbs requested a review from mafredri July 21, 2023 15:18
@kylecarbs kylecarbs self-assigned this Jul 21, 2023
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Love this change and that you went the extra mile with renaming code in the site as well!

Feel free to defer my suggestion about limit/source, as it's not critical for this refactor.

Didn't see any blockers so I'm approving. 👍🏻

@@ -757,7 +757,8 @@ func New(options *Options) *API {
// New agents will use /me/manifest instead.
r.Get("/metadata", api.workspaceAgentManifest)
r.Post("/startup", api.postWorkspaceAgentStartup)
r.Patch("/startup-logs", api.patchWorkspaceAgentStartupLogs)
r.Patch("/startup-logs", api.patchWorkspaceAgentLogsDeprecated)
Copy link
Member

Choose a reason for hiding this comment

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

❤️

CREATE TYPE workspace_agent_log_source AS ENUM ('startup_script', 'kubernetes_logs', 'envbox', 'envbuilder', 'external');
ALTER TABLE workspace_agent_startup_logs RENAME TO workspace_agent_logs;
ALTER TABLE workspace_agent_logs ADD COLUMN source workspace_agent_log_source NOT NULL DEFAULT 'startup_script';
ALTER TABLE workspace_agents RENAME COLUMN startup_logs_overflowed TO logs_overflowed;
Copy link
Member

Choose a reason for hiding this comment

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

Should we change this to be a limit/source? For instance, I'd like for us to start sending shutdown logs as well in the future, but if the log overflowed from one of the others, then we'd essentially lose that information.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, that's a good point. I will change this!

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll do this later. I was considering doing this with a jsonb column mapping sources to sizes, but it felt a bit wonky. Any ideas here?

Copy link
Member

Choose a reason for hiding this comment

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

I think a jsonb column, or a separate table (agent_id, log_source, size) (classic relational structure) would be fine. 👍🏻 In the relational variant we could move the overflow boolean to this new table as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Going to do this after. Good idea!

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Two more things 😄

@kylecarbs kylecarbs enabled auto-merge (squash) July 27, 2023 20:56
@kylecarbs kylecarbs merged commit bd944e0 into main Jul 28, 2023
@kylecarbs kylecarbs deleted the agentlogging branch July 28, 2023 15:57
@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants