chore(telemetry): Log `FIREBASE_STUDIO` when using Gemini CLI within Firebase Studio (#5790)
This commit is contained in:
parent
0c32a4061d
commit
9bc0a4aff3
|
@ -51,6 +51,25 @@ export interface LogResponse {
|
||||||
nextRequestWaitMs?: number;
|
nextRequestWaitMs?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the surface that the user is currently using. Surface is effectively the
|
||||||
|
* distribution channel in which the user is using Gemini CLI. Gemini CLI comes bundled
|
||||||
|
* w/ Firebase Studio and Cloud Shell. Users that manually download themselves will
|
||||||
|
* likely be "SURFACE_NOT_SET".
|
||||||
|
*
|
||||||
|
* This is computed based upon a series of environment variables these distribution
|
||||||
|
* 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';
|
||||||
|
} else {
|
||||||
|
return process.env.SURFACE || 'SURFACE_NOT_SET';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Singleton class for batch posting log events to Clearcut. When a new event comes in, the elapsed time
|
// Singleton class for batch posting log events to Clearcut. When a new event comes in, the elapsed time
|
||||||
// is checked and events are flushed to Clearcut if at least a minute has passed since the last flush.
|
// is checked and events are flushed to Clearcut if at least a minute has passed since the last flush.
|
||||||
export class ClearcutLogger {
|
export class ClearcutLogger {
|
||||||
|
@ -237,10 +256,7 @@ export class ClearcutLogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
logStartSessionEvent(event: StartSessionEvent): void {
|
logStartSessionEvent(event: StartSessionEvent): void {
|
||||||
const surface =
|
const surface = determineSurface();
|
||||||
process.env.CLOUD_SHELL === 'true'
|
|
||||||
? 'CLOUD_SHELL'
|
|
||||||
: process.env.SURFACE || 'SURFACE_NOT_SET';
|
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue