Skip to content
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

Send a list of request ids to monorail #5119

Merged
merged 7 commits into from
Dec 18, 2024

Conversation

isaacroldan
Copy link
Contributor

@isaacroldan isaacroldan commented Dec 17, 2024

WHY are these changes introduced?

Enable tracking and reporting of request IDs from GraphQL API calls in analytics events.

WHAT is this pull request doing?

  • Introduces a new RequestIDCollection class to manage and store request IDs during command execution
  • Integrates request ID collection with GraphQL API calls
  • Adds collected request IDs to analytics payload
  • Limits storage to the first 100 request IDs
  • Removes empty HTTP API file

How to test your changes?

  1. Execute any CLI command that makes GraphQL API calls
  2. Verify that request IDs are being collected and included in analytics events using --verbose
  3. Confirm that the request ID collection clears between command executions

Measuring impact

How do we know this change was effective? Please choose one:

  • Existing analytics will cater for this addition

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

github-actions bot commented Dec 17, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.4% (+0.17% 🔼)
8835/11718
🟡 Branches
70.66% (+0.12% 🔼)
4297/6081
🟡 Functions
75.2% (+0.17% 🔼)
2313/3076
🟡 Lines
75.94% (+0.18% 🔼)
8351/10997
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / request-ids.ts
100% 83.33% 100% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / context.ts
70.75%
60% (-2.07% 🔻)
73.91% 73.33%
🟢
... / app-event-watcher.ts
93.83% (-1.23% 🔻)
86.49% (-2.7% 🔻)
90.48% 98.61%

Test suite run success

1996 tests passing in 900 suites.

Report generated by 🧪jest coverage report action from 7d02d54

@isaacroldan isaacroldan marked this pull request as ready for review December 17, 2024 11:23
@isaacroldan isaacroldan requested a review from a team as a code owner December 17, 2024 11:23
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

Copy link
Contributor

@dmerand dmerand left a comment

Choose a reason for hiding this comment

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

LGTM! I confirmed that request IDs are being emitted to analytics via app commands.

image

packages/cli-kit/src/private/node/request-ids.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

packages/cli-kit/dist/private/node/request-ids.d.ts
export declare const MAX_REQUEST_IDS = 100;
/**
 * Manages collection of request IDs during command execution
 */
declare class RequestIDCollection {
    private static instance;
    static getInstance(): RequestIDCollection;
    private requestIds;
    /**
     * Add a request ID to the collection
     * We only report the first MAX_REQUEST_IDS request IDs.
     */
    addRequestId(requestId: string | undefined | null): void;
    /**
     * Get all collected request IDs
     */
    getRequestIds(): string[];
    /**
     * Clear all stored request IDs
     */
    clear(): void;
}
export declare const requestIdsCollection: RequestIDCollection;
export {};

Existing type declarations

packages/cli-kit/dist/public/node/monorail.d.ts
@@ -2,7 +2,7 @@ import { JsonMap } from '../../private/common/json.js';
 import { DeepRequired } from '../common/ts/deep-required.js';
 export { DeepRequired };
 type Optional<T> = T | null;
-export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.15";
+export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.16";
 export interface Schemas {
     [MONORAIL_COMMAND_TOPIC]: {
         sensitive: {

@isaacroldan isaacroldan added this pull request to the merge queue Dec 18, 2024
Merged via the queue into main with commit a795b00 Dec 18, 2024
27 checks passed
@isaacroldan isaacroldan deleted the 12-17-send_a_list_of_request_ids_to_monorail branch December 18, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants