Skip to content

Commit 868e40e

Browse files
committed
Add realtime telemetry flag
1 parent 6a8779c commit 868e40e

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

genkit-tools/cli/src/commands/start.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ interface RunOptions {
2626
noui?: boolean;
2727
port?: string;
2828
open?: boolean;
29+
experimentalRealtimeTelemetry?: boolean;
2930
}
3031

3132
/** Command to run code in dev mode and/or the Dev UI. */
@@ -34,6 +35,10 @@ export const start = new Command('start')
3435
.option('-n, --noui', 'do not start the Dev UI', false)
3536
.option('-p, --port <port>', 'port for the Dev UI')
3637
.option('-o, --open', 'Open the browser on UI start up')
38+
.option(
39+
'--experimental-realtime-telemetry',
40+
'Enable real-time telemetry streaming (experimental)'
41+
)
3742
.action(async (options: RunOptions) => {
3843
const projectRoot = await findProjectRoot();
3944
if (projectRoot.includes('/.Trash/')) {
@@ -49,7 +54,8 @@ export const start = new Command('start')
4954
const result = await startDevProcessManager(
5055
projectRoot,
5156
start.args[0],
52-
start.args.slice(1)
57+
start.args.slice(1),
58+
{ enableRealtimeTelemetry: options.experimentalRealtimeTelemetry }
5359
);
5460
manager = result.manager;
5561
processPromise = result.processPromise;

genkit-tools/cli/src/utils/manager-utils.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,25 @@ export async function startManager(
6666
return manager;
6767
}
6868

69+
export interface DevProcessManagerOptions {
70+
enableRealtimeTelemetry?: boolean;
71+
}
72+
6973
export async function startDevProcessManager(
7074
projectRoot: string,
7175
command: string,
72-
args: string[]
76+
args: string[],
77+
options?: DevProcessManagerOptions
7378
): Promise<{ manager: RuntimeManager; processPromise: Promise<void> }> {
7479
const telemetryServerUrl = await resolveTelemetryServer(projectRoot);
75-
const processManager = new ProcessManager(command, args, {
80+
const envVars: Record<string, string> = {
7681
GENKIT_TELEMETRY_SERVER: telemetryServerUrl,
7782
GENKIT_ENV: 'dev',
78-
});
83+
};
84+
if (options?.enableRealtimeTelemetry) {
85+
envVars.GENKIT_ENABLE_REALTIME_TELEMETRY = 'true';
86+
}
87+
const processManager = new ProcessManager(command, args, envVars);
7988
const manager = await RuntimeManager.create({
8089
telemetryServerUrl,
8190
manageHealth: true,

0 commit comments

Comments
 (0)