Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Show Initiator in Build Logs #2029

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

Closed
Tracked by #1939
ammario opened this issue Jun 3, 2022 · 20 comments · Fixed by #2446
Closed
Tracked by #1939

Show Initiator in Build Logs #2029

ammario opened this issue Jun 3, 2022 · 20 comments · Fixed by #2446
Assignees
Labels
site Area: frontend dashboard
Milestone

Comments

@ammario
Copy link
Member

ammario commented Jun 3, 2022

There have been cases where either:

  1. Auto-start/Auto-stop triggers a start/stop
  2. An admin user triggers a start/stop

And it's unclear why a workspace transitioned state. I used this opaqueness to troll Kyle for multiple days.

I suggest we add an "Actor" Initiated By column to the Timeline table in the Workspace page and an Actor field on the Build Log page.

Implementation notes:

We should add a system user here to report in the logs for what user is taking what actions.

AC

Show a human readable name for the initiator ID for all builds.
Add another column in the build logs for initiator
Testing: storybook for UI, human readable name, check that the name appears on the page, unit test for API returning human readable name

@tjcran
Copy link

tjcran commented Jun 7, 2022

DigitalOcean logs just have a "User" column and it has your own user, system, and sometimes distinguishes it with other parts of the system.

image

@misskniss misskniss changed the title Show Actor in Build Logs Show Initiator in Build Logs Jun 7, 2022
@Emyrk Emyrk self-assigned this Jun 7, 2022
@Emyrk
Copy link
Member

Emyrk commented Jun 7, 2022

I will add initiator_name to the payload response for the api to use

@Emyrk
Copy link
Member

Emyrk commented Jun 9, 2022

#2174 adds the initiator_name to the API calls. FE still needs an update

@Emyrk Emyrk added site Area: frontend dashboard and removed api Area: HTTP API labels Jun 9, 2022
@Emyrk Emyrk assigned Emyrk and unassigned Emyrk Jun 9, 2022
@Emyrk
Copy link
Member

Emyrk commented Jun 9, 2022

Should we add a system user? Without a special user in the database, and foreign key relations will not work. So the field will have to be null for the intiator_id? And we'd treat null special?

Does anyone oppose adding a system user much like Github's Ghost user?

@kylecarbs
Copy link
Member

I'm a fan of this.

I'm uncertain whether having it in the database is best, or making it a static UUID instead like reserving uuid.Nil is safer.

@Emyrk
Copy link
Member

Emyrk commented Jun 9, 2022

@kylecarbs I was thinking a special uuid, but if we have foreign key relations setup, we will need a row in the db to satisfy constraints.

I imagine we'd do both. Use a special uuid, and insert into the db.

@AbhineetJain
Copy link
Contributor

AbhineetJain commented Jun 15, 2022

@kylecarbs @Emyrk Just wanted to reach a decision on the discussion here. Considering the foreign key behavior of initiator_id, we might need a db reference, unless we handle the null value in code. I wonder if the field should be nullable or not - personally, I'd prefer it to be non-null.

@kylecarbs
Copy link
Member

I'd also prefer non-null.

@Emyrk
Copy link
Member

Emyrk commented Jun 15, 2022

Keep it non-null. I'm curious if we ever need to distinguish between initiated_by being system and autostart. Or something akin to that. I don't want to populate the db with a bunch of random system users. Maybe just system is enough for now...

Would be nice to know it started because of autostart though, rather than the vague system.

@AbhineetJain
Copy link
Contributor

I understand if it is really out there, but I'd love for it to be named coderbot. 😂 Not sure if autostart is a good name for the stop action, would prefer something more generic.

@Emyrk
Copy link
Member

Emyrk commented Jun 15, 2022

autostart was not a good suggestion, you are correct. Maybe scheduler or something idk. Regardless, that would either require 2 system users, or some sort of meta data field to elaborate the system user. (w/e that system user's name is, idc)

@ketang
Copy link
Contributor

ketang commented Jun 15, 2022

I like both coderbot and scheduler. The latter has more specificity, although maybe we need to put that information in a different column (reason?) rather than relying on the name, and we still might need to call it coder-scheduler or something. And perhaps highlight system users in a different color.

@AbhineetJain
Copy link
Contributor

AbhineetJain commented Jun 15, 2022

The column name in the UI can be called Initiated by which should alleviate the need to use a different column imo. We can add the highlighting to indicate it is a system user for sure.

@ketang
Copy link
Contributor

ketang commented Jun 15, 2022

The separate column idea, which is totally optional right now, is because we might have multiple reasons to perform a particular action. For instance, a workspace could get (re)started or built as part of administrators forcing all workspaces to update the project.

@AbhineetJain
Copy link
Contributor

That makes sense. This looks like a separate issue of its own though. I wonder if we'd wanna figure out the reasons ourselves, or let admins/users input their reasons when taking the action. In case we end up always assigning the same reason when the initiator is the same, it would seem moot to add the column.

@ketang
Copy link
Contributor

ketang commented Jun 15, 2022

Yep, can be separate.

@ammario
Copy link
Member Author

ammario commented Jun 16, 2022

system is the name I usually see used for these kinds of operations. If we wanted to delineate the subsystem perhaps we could use an actor like system/scheduler.

I also like the idea of coloring this user differently when it appears in the UI.

@tjcran
Copy link

tjcran commented Jun 16, 2022

+1 on "system" and +1000 on different color

@AbhineetJain
Copy link
Contributor

@ketang I filed #2410 for discussion on the reason column.

@ammario I like system/scheduler.

@AbhineetJain
Copy link
Contributor

#2428 adds a system user with a special uuid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site Area: frontend dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants