-
Notifications
You must be signed in to change notification settings - Fork 109
chore: expose a hook to specify telemetry hosting mode MCP-166 #501
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 all 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 |
---|---|---|
|
@@ -35,14 +35,21 @@ export class Telemetry { | |
userConfig: UserConfig, | ||
deviceId: DeviceId, | ||
{ | ||
commonProperties = { ...MACHINE_METADATA }, | ||
commonProperties = {}, | ||
eventCache = EventCache.getInstance(), | ||
}: { | ||
commonProperties?: Partial<CommonProperties>; | ||
eventCache?: EventCache; | ||
commonProperties?: CommonProperties; | ||
} = {} | ||
): Telemetry { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assignment will throw a TypeError if Copilot uses AI. Check for mistakes. |
||
const instance = new Telemetry(session, userConfig, commonProperties, { eventCache, deviceId }); | ||
const mergedProperties = { | ||
...MACHINE_METADATA, | ||
...commonProperties, | ||
}; | ||
const instance = new Telemetry(session, userConfig, mergedProperties, { | ||
eventCache, | ||
deviceId, | ||
}); | ||
|
||
void instance.setup(); | ||
return instance; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,24 +53,85 @@ export type ServerEvent = TelemetryEvent<ServerEventProperties>; | |
* Interface for static properties, they can be fetched once and reused. | ||
*/ | ||
export type CommonStaticProperties = { | ||
/** | ||
* The version of the MCP server (as read from package.json). | ||
*/ | ||
mcp_server_version: string; | ||
|
||
/** | ||
* The name of the MCP server (as read from package.json). | ||
*/ | ||
mcp_server_name: string; | ||
|
||
/** | ||
* The platform/OS the MCP server is running on. | ||
*/ | ||
platform: string; | ||
|
||
/** | ||
* The architecture of the OS the server is running on. | ||
*/ | ||
arch: string; | ||
|
||
/** | ||
* Same as platform. | ||
*/ | ||
os_type: string; | ||
|
||
/** | ||
* The version of the OS the server is running on. | ||
*/ | ||
os_version?: string; | ||
}; | ||
|
||
/** | ||
* Common properties for all events that might change. | ||
*/ | ||
export type CommonProperties = { | ||
/** | ||
* The device id - will be populated with the machine id when it resolves. | ||
*/ | ||
device_id?: string; | ||
|
||
/** | ||
* A boolean indicating whether the server is running in a container environment. | ||
*/ | ||
is_container_env?: boolean; | ||
|
||
/** | ||
* The version of the MCP client as reported by the client on session establishment. | ||
*/ | ||
mcp_client_version?: string; | ||
|
||
/** | ||
* The name of the MCP client as reported by the client on session establishment. | ||
*/ | ||
mcp_client_name?: string; | ||
|
||
/** | ||
* The transport protocol used by the MCP server. | ||
*/ | ||
transport?: "stdio" | "http"; | ||
|
||
/** | ||
* A boolean indicating whether Atlas credentials are configured. | ||
*/ | ||
config_atlas_auth?: TelemetryBoolSet; | ||
|
||
/** | ||
* A boolean indicating whether a connection string is configured. | ||
*/ | ||
config_connection_string?: TelemetryBoolSet; | ||
|
||
/** | ||
* The randomly generated session id. | ||
*/ | ||
session_id?: string; | ||
|
||
/** | ||
* The way the MCP server is hosted - e.g. standalone for a server running independently or | ||
* "vscode" if embedded in the VSCode extension. This field should be populated by the hosting | ||
* application to differentiate events coming from an MCP server it's hosting. | ||
*/ | ||
hosting_mode?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can we set the accepted strings here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The MCP server does not know them at this point - essentially, I want this to be a field populated by the application that hosts the server and we don't know beforehand what these applications are. |
||
} & CommonStaticProperties; |