Skip to content

NEW @W-17915999@ Implemented engine-level telemetry framework. #265

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 8 commits into from
Apr 22, 2025

Conversation

jfeingold35
Copy link
Contributor

@jfeingold35 jfeingold35 commented Apr 21, 2025

This PR does the following:

  • Adds, at the engine-level, a framework for emitting Telemetry Events.
  • Adds, at the core-level, an ability to receive engine-level Telemetry Events and re-emit them for reception by CLI, VSCode, or other wrapper layers.

*/
export type TelemetryEvent = {
type: EventType.TelemetryEvent,
key: string,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A string-type key and a completely loose data object seemed to me to strike the balance between structure and flexibility that we want for telemetry.

toAbsolutePath,
UniqueIdGenerator
} from "./utils";
import {EngineProgressAggregator, SimpleUniqueIdGenerator, toAbsolutePath, UniqueIdGenerator} from "./utils";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why my IDE saw fit to change this. I can change it back if we care.

@jfeingold35 jfeingold35 changed the title @W-17915999@ Implemented engine-level telemetry framework. NEW @W-17915999@ Implemented engine-level telemetry framework. Apr 21, 2025
Copy link
Collaborator

@stephen-carter-at-sf stephen-carter-at-sf left a comment

Choose a reason for hiding this comment

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

You have a lint error (unused import to fix). And I left a few comments. Otherwise, approved.

Comment on lines +403 to +412
// istanbul ignore next
private emitTelemetryEvent(eventName: string, data: TelemetryData): void {
this.emitEvent({
type: EventType.TelemetryEvent,
timestamp: this.clock.now(),
eventName,
uuid: this.uniqueIdGenerator.getUniversallyUniqueId(),
data
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably didn't need to add this until we actually had a use for it. But if you want to update the CLI to prepare for the future scenario of possibly updating core with a core TelemetryEvent, that's fine to do now I suppose. Up to you.

@@ -395,6 +400,17 @@ export class CodeAnalyzer {
})
}

// istanbul ignore next
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we do add this in even though it isn't being used (which probably means we shouldn't have this added to our code yet), can we at least add in a comment saying that this is unused currently, but when used to remove that istanbul ignore next.

Comment on lines 1 to 2
import path from "node:path";
import crypto from "node:crypto";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should both of these instead be import * as path and import * as crypto instead of directly importing a namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do that for safety's sake, though I'm not positive it actually matters here.

@jfeingold35 jfeingold35 marked this pull request as ready for review April 22, 2025 14:23
@jfeingold35 jfeingold35 merged commit 62b2276 into dev Apr 22, 2025
7 checks passed
@stephen-carter-at-sf stephen-carter-at-sf deleted the d/W-17915999 branch May 14, 2025 19:54
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