@@ -7,6 +7,7 @@ import * as vscode from 'vscode';
77import { IAuthenticationService } from '../../../platform/authentication/common/authentication' ;
88import { IEndpointProvider } from '../../../platform/endpoint/common/endpointProvider' ;
99import { ILogService } from '../../../platform/log/common/logService' ;
10+ import { ITelemetryService } from '../../../platform/telemetry/common/telemetry' ;
1011import { Disposable } from '../../../util/vs/base/common/lifecycle' ;
1112import { IExtensionContribution } from '../../common/contributions' ;
1213import { IToolsService } from '../../tools/common/toolsService' ;
@@ -19,6 +20,7 @@ export class ExtensionStateCommandContribution extends Disposable implements IEx
1920 @IAuthenticationService private readonly _authenticationService : IAuthenticationService ,
2021 @IEndpointProvider private readonly _endpointProvider : IEndpointProvider ,
2122 @IToolsService private readonly _toolsService : IToolsService ,
23+ @ITelemetryService private readonly _telemetryService : ITelemetryService ,
2224 ) {
2325 super ( ) ;
2426
@@ -51,12 +53,22 @@ export class ExtensionStateCommandContribution extends Disposable implements IEx
5153 // Proxy setup
5254 const proxySupport = vscode . workspace . getConfiguration ( 'http' ) . get < string > ( 'proxySupport' , 'override' ) ;
5355 const proxyUrl = vscode . workspace . getConfiguration ( 'http' ) . get < string > ( 'proxy' , '' ) ;
56+ const proxyConfigured = proxyUrl ? 'true' : 'false' ;
5457 lines . push ( ` Proxy: http.proxySupport=${ proxySupport } , http.proxy=${ proxyUrl ? '(configured)' : '(not configured)' } ` ) ;
5558
59+ let languageModelsLoaded = 'false' ;
60+ let languageModelCount = 0 ;
61+ let copilotProviderRegistered = 'false' ;
62+ let copilotModelCount = 0 ;
63+ let copilotEmbeddingsRegistered = 'false' ;
64+ let toolCount = 0 ;
65+
5666 if ( session ) {
5767 // Language models
5868 try {
5969 const endpoints = await this . _endpointProvider . getAllChatEndpoints ( ) ;
70+ languageModelCount = endpoints . length ;
71+ languageModelsLoaded = String ( endpoints . length > 0 ) ;
6072 lines . push ( ` Language models loaded: ${ endpoints . length > 0 } (count: ${ endpoints . length } )` ) ;
6173 } catch ( e ) {
6274 lines . push ( ` Language models loaded: false (error: ${ e } )` ) ;
@@ -65,22 +77,61 @@ export class ExtensionStateCommandContribution extends Disposable implements IEx
6577 // Copilot chat provider registration
6678 try {
6779 const copilotModels = await vscode . lm . selectChatModels ( { vendor : 'copilot' } ) ;
80+ copilotModelCount = copilotModels . length ;
81+ copilotProviderRegistered = String ( copilotModels . length > 0 ) ;
6882 lines . push ( ` Copilot chat provider registered: ${ copilotModels . length > 0 } (models: ${ copilotModels . length } )` ) ;
6983 } catch ( e ) {
7084 lines . push ( ` Copilot chat provider registered: false (error: ${ e } )` ) ;
7185 }
7286
7387 // Copilot embeddings model registration
7488 const copilotEmbeddings = vscode . lm . embeddingModels . filter ( m => m . startsWith ( 'copilot.' ) ) ;
89+ copilotEmbeddingsRegistered = String ( copilotEmbeddings . length > 0 ) ;
7590 lines . push ( ` Copilot embeddings model registered: ${ copilotEmbeddings . length > 0 } (models: [${ copilotEmbeddings . join ( ', ' ) } ])` ) ;
7691
7792 // Tools
78- const toolCount = this . _toolsService . tools . length ;
93+ toolCount = this . _toolsService . tools . length ;
7994 lines . push ( ` Tools loaded: ${ toolCount > 0 } (count: ${ toolCount } )` ) ;
8095 }
8196
8297 lines . push ( '[ExtensionState] ===============================================================' ) ;
8398
8499 this . _logService . info ( lines . join ( '\n' ) ) ;
100+
101+ /* __GDPR__
102+ "extensionState" : {
103+ "owner": "TylerLeonhardt",
104+ "comment": "Extension state diagnostic information",
105+ "hasAnySession": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether a GitHub session exists" },
106+ "hasPermissiveSession": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether a permissive GitHub session exists" },
107+ "hasCopilotToken": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether a Copilot token exists" },
108+ "proxySupport": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The http.proxySupport setting value" },
109+ "proxyConfigured": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether an http proxy is configured" },
110+ "languageModelsLoaded": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether language models are loaded" },
111+ "copilotProviderRegistered": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the Copilot chat provider is registered" },
112+ "copilotEmbeddingsRegistered": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether Copilot embeddings models are registered" },
113+ "languageModelCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of language models loaded", "isMeasurement": true },
114+ "copilotModelCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of Copilot chat models", "isMeasurement": true },
115+ "toolCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tools loaded", "isMeasurement": true }
116+ }
117+ */
118+ this . _telemetryService . sendMSFTTelemetryEvent (
119+ 'extensionState' ,
120+ {
121+ hasAnySession : String ( hasAnySession ) ,
122+ hasPermissiveSession : String ( hasPermissiveSession ) ,
123+ hasCopilotToken : String ( hasCopilotToken ) ,
124+ proxySupport,
125+ proxyConfigured,
126+ languageModelsLoaded,
127+ copilotProviderRegistered,
128+ copilotEmbeddingsRegistered,
129+ } ,
130+ {
131+ languageModelCount,
132+ copilotModelCount,
133+ toolCount,
134+ }
135+ ) ;
85136 }
86137}
0 commit comments