MCPcopy Index your code
hub / github.com/deepnote/deepnote / startMetricsMonitoring

Function startMetricsMonitoring

packages/cli/src/commands/run.ts:1009–1033  ·  view source on GitHub ↗
(
  engine: ExecutionEngine,
  showTop: boolean
)

Source from the content-addressed store, hash-verified

1007}
1008
1009async function startMetricsMonitoring(
1010 engine: ExecutionEngine,
1011 showTop: boolean
1012): Promise<ReturnType<typeof setInterval> | null> {
1013 if (!showTop || !engine.serverPort) {
1014 return null
1015 }
1016
1017 const port = engine.serverPort
1018 const initialMetrics = await fetchMetrics(port)
1019 if (initialMetrics) {
1020 displayMetrics(initialMetrics)
1021 output('')
1022 }
1023
1024 return setInterval(async () => {
1025 const metrics = await fetchMetrics(port)
1026 if (metrics) {
1027 // Move cursor up, clear line, display metrics, move back down
1028 process.stdout.write('\x1b[s') // Save cursor position
1029 displayMetrics(metrics)
1030 process.stdout.write('\x1b[u') // Restore cursor position
1031 }
1032 }, 2000)
1033}
1034
1035function createRunProjectCallbacks({
1036 engine,

Callers 1

runDeepnoteProjectFunction · 0.85

Calls 3

fetchMetricsFunction · 0.90
displayMetricsFunction · 0.90
outputFunction · 0.90

Tested by

no test coverage detected