forked from jupyterlab/jupyterlab-desktop
-
Notifications
You must be signed in to change notification settings - Fork 1
Release v1.0.0-6 #27
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
Release v1.0.0-6 #27
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b47dc80
Added segment package
ngafar 1088f3a
Added basic logging utils
ngafar 0daae70
logging install steps
ngafar 5cd946c
Removed email
ngafar dabe8dd
Refactor telemetry utility functions to use constants for file paths
ngafar 34f7b85
Moved getUserId into logging functions
ngafar 683fba2
Removed userID param
ngafar 4bdac63
Added install time param
ngafar 30151db
Added dev mode and email to user profile
ngafar 71c3a9b
Merge pull request #24 from mito-ds/first-time-setup-logging
ngafar 65b53b7
release october 15, 2025
aarondr77 e26a8d7
Update auto-release logs
aarondr77 377fb12
Merge branch 'master' into release-v1.0.0-6
aarondr77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 1760037168 | ||
| 1760566089 |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import fs from 'fs'; | ||
| import os from 'os'; | ||
| import path from 'path'; | ||
| import crypto from 'crypto'; | ||
| import { Analytics } from '@segment/analytics-node' | ||
| import { isDevMode } from './utils'; | ||
|
|
||
| const MITO_FOLDER = path.join(os.homedir(), '.mito'); | ||
| const USER_JSON_FILE = 'user.json'; | ||
| const TEMP_USER_ID_FILE = 'temp_user_id.txt'; | ||
|
|
||
| const analytics = new Analytics({ | ||
| writeKey: '6I7ptc5wcIGC4WZ0N1t0NXvvAbjRGUgX', | ||
| flushAt: 1, // Send events immediately | ||
| flushInterval: 1000 // Flush every second | ||
| }); | ||
|
|
||
| export const createMitoFolder = () => { | ||
| // Create a mito folder, if it doesn't exist | ||
| if (!fs.existsSync(MITO_FOLDER)) { | ||
| fs.mkdirSync(MITO_FOLDER); | ||
| } | ||
| } | ||
|
|
||
| export const checkIfUserAlreadyMitoUser = () => { | ||
| // First look for the mito folder | ||
| if (!fs.existsSync(MITO_FOLDER)) { | ||
| return { isMitoUser: false, userId: "" }; | ||
| } | ||
|
|
||
| // Then look for the user.json file | ||
| const userJsonFile = path.join(MITO_FOLDER, USER_JSON_FILE); | ||
| if (!fs.existsSync(userJsonFile)) { | ||
| return { isMitoUser: false, userId: null }; | ||
| } | ||
|
|
||
| // Finally, read the user.json file | ||
| const userJson = JSON.parse(fs.readFileSync(userJsonFile, 'utf8')); | ||
| return { isMitoUser: true, userId: userJson.static_user_id }; | ||
| } | ||
|
|
||
| export const createTempUserId = () => { | ||
| // If the temp user id file already exists, return the user id from the file | ||
| if (fs.existsSync(path.join(MITO_FOLDER, TEMP_USER_ID_FILE))) { | ||
| return fs.readFileSync(path.join(MITO_FOLDER, TEMP_USER_ID_FILE), 'utf8'); | ||
| } | ||
|
|
||
| // Create a temp user id, and save it to a temp file. | ||
| // This temp file will be picked up by the mito-ai package | ||
| // when it creates the user.json file. | ||
| createMitoFolder(); | ||
| const tempUserId = crypto.randomUUID(); | ||
| const tempUserIdFile = path.join(MITO_FOLDER, TEMP_USER_ID_FILE); | ||
| fs.writeFileSync(tempUserIdFile, tempUserId); | ||
| return tempUserId; | ||
| } | ||
|
|
||
| export const getUserId = () => { | ||
| // First check if the user is already a Mito user | ||
| const { isMitoUser, userId } = checkIfUserAlreadyMitoUser(); | ||
| if (isMitoUser) { | ||
| return userId; | ||
| } | ||
| // If not, create a new temp user id | ||
| return createTempUserId(); | ||
| } | ||
|
|
||
| export const identifyUser = () => { | ||
| analytics.identify({ | ||
| userId: getUserId(), | ||
| traits: { | ||
| operating_system: process.platform, | ||
| version_mito_desktop: process.env.npm_package_version, | ||
| is_dev_mode: isDevMode(), | ||
| email: isDevMode() ? 'dev@trymito.io' : undefined | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| export const logEvent = (event: string, properties: any = {}) => { | ||
| analytics.track({ | ||
| userId: getUserId(), | ||
| event: event, | ||
| properties: { | ||
| ...properties, | ||
| operating_system: process.platform, | ||
| version_mito_desktop: process.env.npm_package_version, | ||
| } | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Bug: Telemetry Missing Version Data in Electron Builds
The
version_mito_desktoptelemetry property relies onprocess.env.npm_package_version. This environment variable is typically only present during npm script execution and may be undefined in a built Electron application, leading to missing version data in telemetry.Additional Locations (1)
src/main/telemetry_utils.ts#L86-L87