-
Notifications
You must be signed in to change notification settings - Fork 96
feat: core telemetry functionality #87
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 1 commit
9cf0447
1b8ea02
af714b4
40aaef0
8adc20d
cff01e0
5336e4a
76e2a6f
1850676
3a5d4c1
23fff05
754ce8d
8301e43
994b698
3bfc9f2
6d92021
7997c54
f18b916
a9cd835
6813518
65fad1d
7e98c33
5209073
2e33584
d92adf1
8ec7d9c
6ad2a19
807109d
f9a46f9
599201d
7a889b4
eb360e2
710b131
a15eeb6
90caa25
89113a5
143f898
f751a30
0927d28
fb0b8af
9e625aa
a61d9b4
2bd00cf
3636fde
0df870c
4b7563d
6dd1f79
807b2ca
139c3ee
3a05d31
8505d91
024a3d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import pkg from "../../package.json" with { type: "json" }; | ||
import config from "../config.js"; | ||
import { getMachineIdSync } from 'native-machine-id'; | ||
|
||
/** | ||
* Machine-specific metadata formatted for telemetry | ||
*/ | ||
export const MACHINE_METADATA = Object.freeze({ | ||
device_id: "id", // TODO: use @mongodb-js/machine-id | ||
device_id: getMachineIdSync(), | ||
mcp_server_version: pkg.version, | ||
mcp_server_name: config.mcpServerName, | ||
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 seems constant, do we need this? maybe we add useragent instead? 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. we need it for telemetry right? we could give user agent, but i figure that having the data split is better.. no strong opinion as we hope not to change server_name, but we might change after public preview |
||
platform: process.platform, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Type definitions for native-machine-id | ||
* Provides functionality to retrieve the machine ID of the current device. | ||
*/ | ||
|
||
declare module 'native-machine-id' { | ||
/** | ||
* Gets the machine ID synchronously. | ||
* @returns A string containing the machine ID. | ||
*/ | ||
export function getMachineIdSync(): string; | ||
|
||
/** | ||
* Gets the machine ID asynchronously. | ||
* @returns A Promise that resolves to a string containing the machine ID. | ||
*/ | ||
export function getMachineId(): Promise<string>; | ||
|
||
/** | ||
* Gets a machine ID that is based on the original ID but is "hashed" for privacy. | ||
* @param {string} [original] - The original ID to hash. If not provided, gets the machine ID first. | ||
* @param {string} [type='md5'] - The hashing algorithm to use. | ||
* @returns A Promise that resolves to a string containing the hashed machine ID. | ||
*/ | ||
export function machineIdSync(original?: string, type?: string): string; | ||
|
||
/** | ||
* Gets a machine ID that is based on the original ID but is "hashed" for privacy. | ||
* @param {string} [original] - The original ID to hash. If not provided, gets the machine ID first. | ||
* @param {string} [type='md5'] - The hashing algorithm to use. | ||
* @returns A Promise that resolves to a string containing the hashed machine ID. | ||
*/ | ||
export function machineId(original?: string, type?: string): Promise<string>; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.