chore(telemetry): Add various surface detection to determineSurface for logging. (#6074)

Co-authored-by: christine betts <chrstn@uw.edu>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
Richie Foreman
2025-08-13 17:45:53 -04:00
committed by GitHub
parent 501b78f303
commit d6f74ea2f0
4 changed files with 168 additions and 10 deletions

View File

@@ -30,6 +30,7 @@ import {
} from '../../utils/user_account.js';
import { getInstallationId } from '../../utils/user_id.js';
import { FixedDeque } from 'mnemonist';
import { DetectedIde, detectIde } from '../../ide/detect-ide.js';
const start_session_event_name = 'start_session';
const new_prompt_event_name = 'new_prompt';
@@ -85,12 +86,14 @@ export interface LogRequest {
* methods might have in their runtimes.
*/
function determineSurface(): string {
if (process.env.CLOUD_SHELL === 'true') {
return 'CLOUD_SHELL';
} else if (process.env.MONOSPACE_ENV === 'true') {
return 'FIREBASE_STUDIO';
if (process.env.SURFACE) {
return process.env.SURFACE;
} else if (process.env.GITHUB_SHA) {
return 'GitHub';
} else if (process.env.TERM_PROGRAM === 'vscode') {
return detectIde() || DetectedIde.VSCode;
} else {
return process.env.SURFACE || 'SURFACE_NOT_SET';
return 'SURFACE_NOT_SET';
}
}