Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export interface RuntimeEnvironment {
}

export interface TelemetryService {
send(arg: { name: string; properties?: unknown });
send(arg: { name: string; properties?: unknown }): Promise<void>;
sendStartupEvent(): Promise<void>;
}

export function startClient(
Expand Down Expand Up @@ -176,8 +177,7 @@ export function startClient(
client.onRequest(FSReadFile.type, (fsPath: string) => {
return workspace.fs.readFile(Uri.file(fsPath)).then((uint8array) => new TextDecoder().decode(uint8array));
});

runtime.telemetry.send({ name: 'yaml.server.initialized' });
runtime.telemetry.sendStartupEvent();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we send a boolean, for (un)successful startup?, and an error message in case of unsuccessful startup

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sendStartupEvent doesn't have any parameters, we already send all LS errors, including startup errors.
Or you mean, do not use sendStartupEvent and instead send some { name: 'yaml.server.initialized', successful : true/false } ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fbricon WDYT?

Copy link
Copy Markdown
Contributor

@fbricon fbricon Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can manually craft a startup event like:

{ 
name: 'startup', 
 properties: {
   'yaml.server.initialized' : true/false,
   'error': the error message if the server failed to initialize
 }
}

In that case, you wouldn't call sendStartupEvent()

// Adapted from:
// https://github.com/microsoft/vscode/blob/94c9ea46838a9a619aeafb7e8afd1170c967bb55/extensions/json-language-features/client/src/jsonClient.ts#L305-L318
client.onNotification(ResultLimitReachedNotification.type, async (message) => {
Expand Down
1 change: 0 additions & 1 deletion src/node/yamlClientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { JSONSchemaCache } from '../json-schema-cache';
export async function activate(context: ExtensionContext): Promise<SchemaExtensionAPI> {
// Create Telemetry Service
const telemetry = await (await getRedHatService(context)).getTelemetryService();
telemetry.sendStartupEvent();

// The YAML language server is implemented in node
const serverModule = context.asAbsolutePath('./dist/languageserver.js');
Expand Down
2 changes: 1 addition & 1 deletion src/webworker/yamlClientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function activate(context: ExtensionContext): Promise<SchemaExtensi
};

const runtime: RuntimeEnvironment = {
telemetry: { send: () => undefined },
telemetry: { send: () => undefined, sendStartupEvent: () => undefined },
schemaCache,
};
return startClient(context, newLanguageClient, runtime);
Expand Down