update(telemetry): add hashed_extension_name to field to extension events (#15025)

Co-authored-by: Shnatu <snatu@google.com>
This commit is contained in:
Shardul Natu
2025-12-15 09:40:54 -08:00
committed by GitHub
parent fc2a5a42ce
commit d030a1f62f
5 changed files with 46 additions and 9 deletions

View File

@@ -327,6 +327,7 @@ export class ExtensionManager extends ExtensionLoader {
await logExtensionUpdateEvent(
this.telemetryConfig,
new ExtensionUpdateEvent(
newExtensionConfig.name,
hashValue(newExtensionConfig.name),
getExtensionId(newExtensionConfig, installMetadata),
newExtensionConfig.version,
@@ -339,6 +340,7 @@ export class ExtensionManager extends ExtensionLoader {
await logExtensionInstallEvent(
this.telemetryConfig,
new ExtensionInstallEvent(
newExtensionConfig.name,
hashValue(newExtensionConfig.name),
getExtensionId(newExtensionConfig, installMetadata),
newExtensionConfig.version,
@@ -375,6 +377,7 @@ export class ExtensionManager extends ExtensionLoader {
await logExtensionUpdateEvent(
this.telemetryConfig,
new ExtensionUpdateEvent(
config?.name ?? '',
hashValue(config?.name ?? ''),
extensionId ?? '',
newExtensionConfig?.version ?? '',
@@ -387,6 +390,7 @@ export class ExtensionManager extends ExtensionLoader {
await logExtensionInstallEvent(
this.telemetryConfig,
new ExtensionInstallEvent(
newExtensionConfig?.name ?? '',
hashValue(newExtensionConfig?.name ?? ''),
extensionId ?? '',
newExtensionConfig?.version ?? '',
@@ -434,6 +438,7 @@ export class ExtensionManager extends ExtensionLoader {
await logExtensionUninstall(
this.telemetryConfig,
new ExtensionUninstallEvent(
extension.name,
hashValue(extension.name),
extension.id,
'success',
@@ -716,7 +721,7 @@ export class ExtensionManager extends ExtensionLoader {
}
await logExtensionDisable(
this.telemetryConfig,
new ExtensionDisableEvent(hashValue(name), extension.id, scope),
new ExtensionDisableEvent(name, hashValue(name), extension.id, scope),
);
if (!this.config || this.config.getEnableExtensionReloading()) {
// Only toggle the isActive state if we are actually going to disable it
@@ -751,7 +756,7 @@ export class ExtensionManager extends ExtensionLoader {
}
await logExtensionEnable(
this.telemetryConfig,
new ExtensionEnableEvent(hashValue(name), extension.id, scope),
new ExtensionEnableEvent(name, hashValue(name), extension.id, scope),
);
if (!this.config || this.config.getEnableExtensionReloading()) {
// Only toggle the isActive state if we are actually going to disable it

View File

@@ -1771,6 +1771,7 @@ This extension will run the following MCP servers:
} else {
expect(mockLogExtensionUninstall).toHaveBeenCalled();
expect(ExtensionUninstallEvent).toHaveBeenCalledWith(
'my-local-extension',
hashValue('my-local-extension'),
hashValue(userExtensionsDir),
'success',
@@ -1818,6 +1819,7 @@ This extension will run the following MCP servers:
expect(fs.existsSync(sourceExtDir)).toBe(false);
expect(mockLogExtensionUninstall).toHaveBeenCalled();
expect(ExtensionUninstallEvent).toHaveBeenCalledWith(
'gemini-sql-extension',
hashValue('gemini-sql-extension'),
hashValue('https://github.com/google/gemini-sql-extension'),
'success',
@@ -1935,6 +1937,7 @@ This extension will run the following MCP servers:
expect(mockLogExtensionDisable).toHaveBeenCalled();
expect(ExtensionDisableEvent).toHaveBeenCalledWith(
'ext1',
hashValue('ext1'),
hashValue(userExtensionsDir),
SettingScope.Workspace,
@@ -2002,6 +2005,7 @@ This extension will run the following MCP servers:
expect(mockLogExtensionEnable).toHaveBeenCalled();
expect(ExtensionEnableEvent).toHaveBeenCalledWith(
'ext1',
hashValue('ext1'),
hashValue(userExtensionsDir),
SettingScope.Workspace,