-
Notifications
You must be signed in to change notification settings - Fork 133
chore: reinstate telemetry/docker change after revert MCP-49 #339
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -7,6 +7,7 @@ import { MACHINE_METADATA } from "./constants.js"; | |||||
import { EventCache } from "./eventCache.js"; | ||||||
import nodeMachineId from "node-machine-id"; | ||||||
import { getDeviceId } from "@mongodb-js/device-id"; | ||||||
import fs from "fs/promises"; | ||||||
|
||||||
type EventResult = { | ||||||
success: boolean; | ||||||
|
@@ -18,7 +19,7 @@ export const DEVICE_ID_TIMEOUT = 3000; | |||||
export class Telemetry { | ||||||
private isBufferingEvents: boolean = true; | ||||||
/** Resolves when the device ID is retrieved or timeout occurs */ | ||||||
public deviceIdPromise: Promise<string> | undefined; | ||||||
public dataPromise: Promise<[string, boolean]> | undefined; | ||||||
|
public dataPromise: Promise<[string, boolean]> | undefined; | |
public setupPromise: Promise<[string, boolean]> | undefined; |
super nit, just may be a nicer name
Copilot
AI
Jul 3, 2025
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.
[nitpick] Consider using Promise.any
instead of Promise.all
when checking file existence to short-circuit on the first success and avoid unnecessary filesystem checks.
Copilot uses AI. Check for mistakes.
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.
wouldn't have thought of this myself but that is a good point 🤖
gagik marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
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.
private async start(): Promise<void> { | |
private async setup(): Promise<void> { |
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.
should we turn this abortcontroller into a generalized abort controller and use it with isContainerEnv as well?
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.
sounds like a good improvement for a next PR
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -138,6 +138,8 @@ describe("Telemetry", () => { | |||||
it("should send events successfully", async () => { | ||||||
const testEvent = createTestEvent(); | ||||||
|
||||||
await telemetry.dataPromise; | ||||||
|
||||||
await telemetry.emitEvents([testEvent]); | ||||||
|
||||||
verifyMockCalls({ | ||||||
|
@@ -152,6 +154,8 @@ describe("Telemetry", () => { | |||||
|
||||||
const testEvent = createTestEvent(); | ||||||
|
||||||
await telemetry.dataPromise; | ||||||
|
||||||
await telemetry.emitEvents([testEvent]); | ||||||
|
||||||
verifyMockCalls({ | ||||||
|
@@ -175,6 +179,8 @@ describe("Telemetry", () => { | |||||
// Set up mock to return cached events | ||||||
mockEventCache.getEvents.mockReturnValueOnce([cachedEvent]); | ||||||
|
||||||
await telemetry.dataPromise; | ||||||
|
||||||
await telemetry.emitEvents([newEvent]); | ||||||
|
||||||
verifyMockCalls({ | ||||||
|
@@ -184,7 +190,9 @@ describe("Telemetry", () => { | |||||
}); | ||||||
}); | ||||||
|
||||||
it("should correctly add common properties to events", () => { | ||||||
it("should correctly add common properties to events", async () => { | ||||||
await telemetry.dataPromise; | ||||||
|
await telemetry.dataPromise; | |
await telemetry.setupPromise; |
Outdated
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.
await telemetry.dataPromise; | |
await telemetry.setupPromise; |
Outdated
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.
await telemetry.dataPromise; | |
await telemetry.setupPromise; |
Outdated
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.
await telemetry.dataPromise; | |
await telemetry.setupPromise; |
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.