diff --git a/package-lock.json b/package-lock.json index 736079ece..27159066b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,8 +15,13 @@ "@aws-sdk/client-eks": "^3.670.0", "@aws-sdk/credential-providers": "^3.670.0", "@buf/grpc_grpc.community_timostamm-protobuf-ts": "^2.9.4-20240904201038-e0425cfebb28.4", +<<<<<<< HEAD "@buf/jlewi_foyle.bufbuild_es": "^1.10.0-20241018224331-ac296bc95724.1", "@buf/jlewi_foyle.connectrpc_es": "^1.5.0-20241018224331-ac296bc95724.1", +======= + "@buf/jlewi_foyle.bufbuild_es": "^1.10.0-20241018000047-325e896f72bd.1", + "@buf/jlewi_foyle.connectrpc_es": "^1.5.0-20241018000047-325e896f72bd.1", +>>>>>>> jlewi/fixexecute "@buf/stateful_runme.community_timostamm-protobuf-ts": "^2.9.4-20240913234806-45813f39881a.4", "@connectrpc/connect": "^1.4.0", "@connectrpc/connect-node": "^1.6.1", @@ -2402,8 +2407,13 @@ } }, "node_modules/@buf/jlewi_foyle.bufbuild_es": { +<<<<<<< HEAD "version": "1.10.0-20241018224331-ac296bc95724.1", "resolved": "https://buf.build/gen/npm/v1/@buf/jlewi_foyle.bufbuild_es/-/jlewi_foyle.bufbuild_es-1.10.0-20241018224331-ac296bc95724.1.tgz", +======= + "version": "1.10.0-20241018000047-325e896f72bd.1", + "resolved": "https://buf.build/gen/npm/v1/@buf/jlewi_foyle.bufbuild_es/-/jlewi_foyle.bufbuild_es-1.10.0-20241018000047-325e896f72bd.1.tgz", +>>>>>>> jlewi/fixexecute "dependencies": { "@buf/bufbuild_protovalidate.bufbuild_es": "1.10.0-20240212200630-3014d81c3a48.1", "@buf/stateful_runme.bufbuild_es": "1.10.0-20240913234806-45813f39881a.1" @@ -2413,11 +2423,19 @@ } }, "node_modules/@buf/jlewi_foyle.connectrpc_es": { +<<<<<<< HEAD "version": "1.5.0-20241018224331-ac296bc95724.1", "resolved": "https://buf.build/gen/npm/v1/@buf/jlewi_foyle.connectrpc_es/-/jlewi_foyle.connectrpc_es-1.5.0-20241018224331-ac296bc95724.1.tgz", "dependencies": { "@buf/bufbuild_protovalidate.connectrpc_es": "1.5.0-20240212200630-3014d81c3a48.1", "@buf/jlewi_foyle.bufbuild_es": "1.10.0-20241018224331-ac296bc95724.1", +======= + "version": "1.5.0-20241018000047-325e896f72bd.1", + "resolved": "https://buf.build/gen/npm/v1/@buf/jlewi_foyle.connectrpc_es/-/jlewi_foyle.connectrpc_es-1.5.0-20241018000047-325e896f72bd.1.tgz", + "dependencies": { + "@buf/bufbuild_protovalidate.connectrpc_es": "1.5.0-20240212200630-3014d81c3a48.1", + "@buf/jlewi_foyle.bufbuild_es": "1.10.0-20241018000047-325e896f72bd.1", +>>>>>>> jlewi/fixexecute "@buf/stateful_runme.connectrpc_es": "1.5.0-20240913234806-45813f39881a.1" }, "peerDependencies": { diff --git a/package.json b/package.json index a822f1500..8f8302b43 100644 --- a/package.json +++ b/package.json @@ -1266,8 +1266,13 @@ "@aws-sdk/client-eks": "^3.670.0", "@aws-sdk/credential-providers": "^3.670.0", "@buf/grpc_grpc.community_timostamm-protobuf-ts": "^2.9.4-20240904201038-e0425cfebb28.4", +<<<<<<< HEAD "@buf/jlewi_foyle.bufbuild_es": "^1.10.0-20241018224331-ac296bc95724.1", "@buf/jlewi_foyle.connectrpc_es": "^1.5.0-20241018224331-ac296bc95724.1", +======= + "@buf/jlewi_foyle.bufbuild_es": "^1.10.0-20241018000047-325e896f72bd.1", + "@buf/jlewi_foyle.connectrpc_es": "^1.5.0-20241018000047-325e896f72bd.1", +>>>>>>> jlewi/fixexecute "@buf/stateful_runme.community_timostamm-protobuf-ts": "^2.9.4-20240913234806-45813f39881a.4", "@connectrpc/connect": "^1.4.0", "@connectrpc/connect-node": "^1.6.1", diff --git a/src/extension/ai/events.ts b/src/extension/ai/events.ts index a4924237c..71b9e4e5c 100644 --- a/src/extension/ai/events.ts +++ b/src/extension/ai/events.ts @@ -4,6 +4,7 @@ import { LogEventsRequest, LogEventType, LogEvent, + LogEvent_ExecuteStatus, } from '@buf/jlewi_foyle.bufbuild_es/foyle/v1alpha1/agent_pb' import * as vscode from 'vscode' import { ulid } from 'ulidx' @@ -17,7 +18,7 @@ import * as converters from './converters' // Interface for the event reporter // This allows us to swap in a null op logger when AI isn't enabled export interface IEventReporter { - reportExecution(cell: vscode.NotebookCell): Promise + reportExecution(cell: vscode.NotebookCell, status: boolean): Promise reportEvents(events: LogEvent[]): Promise } @@ -31,7 +32,7 @@ export class EventReporter implements IEventReporter { this.log = getLogger('AIEventReporter') } - async reportExecution(cell: vscode.NotebookCell) { + async reportExecution(cell: vscode.NotebookCell, executionSuccess: boolean) { const contextCells: vscode.NotebookCell[] = [] // Include some previous cells as context. @@ -58,6 +59,12 @@ export class EventReporter implements IEventReporter { event.type = LogEventType.EXECUTE event.cells = cells event.contextId = SessionManager.getManager().getID() + + if (executionSuccess) { + event.executeStatus = LogEvent_ExecuteStatus.SUCCEEDED + } else { + event.executeStatus = LogEvent_ExecuteStatus.FAILED + } return this.reportEvents([event]) } @@ -77,7 +84,7 @@ export class EventReporter implements IEventReporter { // NullOpEventReporter is a null op implementation of the event reporter export class NullOpEventReporter implements IEventReporter { - async reportExecution(_cell: vscode.NotebookCell) { + async reportExecution(_cell: vscode.NotebookCell, _status: boolean) { // Do nothing } diff --git a/src/extension/kernel.ts b/src/extension/kernel.ts index 0f07b1053..c5320f42b 100644 --- a/src/extension/kernel.ts +++ b/src/extension/kernel.ts @@ -773,8 +773,6 @@ export class Kernel implements Disposable { } TelemetryReporter.sendTelemetryEvent('cell.startExecute') - // todo(sebastian): rewrite to use non-blocking impl - const execCellReport = getEventReporter().reportExecution(cell) runmeExec.start(Date.now()) const annotations = getAnnotations(cell) @@ -821,10 +819,12 @@ export class Kernel implements Disposable { successfulCellExecution = false log.error('Error executing cell', e.message) window.showErrorMessage(e.message) - } finally { - await execCellReport } + // todo(sebastian): rewrite to use non-blocking impl + const execCellReport = getEventReporter().reportExecution(cell, successfulCellExecution) + await execCellReport + TelemetryReporter.sendTelemetryEvent('cell.endExecute', { 'cell.success': successfulCellExecution?.toString(), 'cell.mimeType': annotations.mimeType,