-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(core): add id, start and end time to lifecycle hooks #32583
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
View your CI Pipeline Execution ↗ for commit e409e9e
☁️ Nx Cloud last updated this comment at |
| @@ -1,5 +1,5 @@ | |||
| import type { ProjectGraph } from '../../config/project-graph'; | |||
| import { readNxJson, type PluginConfiguration } from '../../config/nx-json'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are unused
| groupId: number; | ||
| } | ||
|
|
||
| interface RustRunningTask extends RunningTask { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unused
FrozenPandaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems very easy to get if users run Date.now() in their pre and post hooks. I don't think we need to be the one providing this.
@FrozenPandaz, it might not be trivial when you run several commands in parallel. Providing this information out of the box instead of forcing the user to track the collection of start times in memory per args combo is better, in my opinion. Also, it prevents other (potentially long-running) Pre and Post hooks from skewing the numbers. |
| ].join('\n')}\n` | ||
| ); | ||
| } | ||
| const taskId = hashArray([...process.argv, Date.now().toString()]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please call this a tasksExecutionId or executionId... or even just id. Just definitely not task.id
| }; | ||
|
|
||
| export type PreTasksExecutionContext = { | ||
| readonly taskId: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this just id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to just id.
| import { shouldStreamOutput } from './utils'; | ||
| import { signalToCode } from '../utils/exit-codes'; | ||
| import chalk = require('chalk'); | ||
| import { randomUUID } from 'node:crypto'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, AI autocomplete leftover. Let me kick that out.
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Pre and post hooks lack corellation Id which might make it difficult to culculate stats for task using pre and post hooks.
Additionally, post hook does not expose the duration or time span for the task. Using pre/post hook might not be precise enough.
Expected Behavior
Hooks expose the unique taskId so we can corellate pre hook of a task to the post hook of the same task. Post hook should expose start and end time of the task run.
Related Issue(s)
Resolves discussion 31076