Skip to content

[rush] Differentiate remote and local execution in telemetry. #4755

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 6 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Adds a new `wasExecutedOnThisMachine` property to operation telemetry events, to simplify reporting about cobuilt operations.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
1 change: 1 addition & 0 deletions common/reviews/api/rush-lib.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ export interface ITelemetryOperationResult {
nonCachedDurationMs?: number;
result: string;
startTimestampMs?: number;
wasExecutedOnThisMachine?: boolean;
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ export class PhasedScriptAction extends BaseScriptAction<IPhasedCommandConfig> {
executionManagerOptions
);

const { isInitial, isWatch } = options.executeOperationsContext;
const { isInitial, isWatch, cobuildConfiguration } = options.executeOperationsContext;

let success: boolean = false;
let result: IExecutionResult | undefined;
Expand Down Expand Up @@ -902,6 +902,9 @@ export class PhasedScriptAction extends BaseScriptAction<IPhasedCommandConfig> {
startTimestampMs: startTime,
endTimestampMs: endTime,
nonCachedDurationMs: operationResult.nonCachedDurationMs,
wasExecutedOnThisMachine:
!operationResult.cobuildRunnerId ||
operationResult.cobuildRunnerId === cobuildConfiguration?.cobuildRunnerId,
result: operationResult.status,
dependencies: Array.from(getNonSilentDependencies(operation)).sort()
};
Expand Down
6 changes: 6 additions & 0 deletions libraries/rush-lib/src/logic/Telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export interface ITelemetryOperationResult {
* Duration in milliseconds when the operation does not hit cache
*/
nonCachedDurationMs?: number;

/**
* Was this operation built on this machine? If so, the duration can be calculated from `startTimestampMs` and `endTimestampMs`.
* If not, you should use the metrics from the machine that built it.
*/
wasExecutedOnThisMachine?: boolean;
}

/**
Expand Down
Loading