Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f9bda104
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f9bda104
编写于
3月 05, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - extract a telemetry workbench contribution
上级
e8e7703a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
99 addition
and
51 deletion
+99
-51
src/vs/workbench/contrib/telemetry/browser/telemetry.contribution.ts
...bench/contrib/telemetry/browser/telemetry.contribution.ts
+90
-0
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+6
-51
src/vs/workbench/workbench.main.ts
src/vs/workbench/workbench.main.ts
+3
-0
未找到文件。
src/vs/workbench/contrib/telemetry/browser/telemetry.contribution.ts
0 → 100644
浏览文件 @
f9bda104
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContributionsRegistry
,
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
LifecyclePhase
,
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IActivityService
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IWorkbenchThemeService
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
language
}
from
'
vs/base/common/platform
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
ErrorTelemetry
from
'
vs/platform/telemetry/browser/errorTelemetry
'
;
import
{
configurationTelemetry
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
export
class
TelemetryContribution
extends
Disposable
implements
IWorkbenchContribution
{
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IActivityService
activityService
:
IActivityService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IEditorService
editorService
:
IEditorService
,
@
IKeybindingService
keybindingsService
:
IKeybindingService
,
@
IWorkbenchThemeService
themeService
:
IWorkbenchThemeService
,
@
IWindowService
windowService
:
IWindowService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IViewletService
viewletService
:
IViewletService
)
{
super
();
const
{
filesToOpen
,
filesToCreate
,
filesToDiff
}
=
windowService
.
getConfiguration
();
const
activeViewlet
=
viewletService
.
getActiveViewlet
();
/* __GDPR__
"workspaceLoad" : {
"userAgent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"windowSize.innerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"windowSize.innerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"windowSize.outerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"windowSize.outerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"emptyWorkbench": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"workbench.filesToOpen": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"workbench.filesToCreate": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"workbench.filesToDiff": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"customKeybindingsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"theme": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"language": { "classification": "SystemMetaData", "purpose": "BusinessInsight" },
"pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"restoredViewlet": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"restoredEditors": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"startupKind": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
}
*/
telemetryService
.
publicLog
(
'
workspaceLoad
'
,
{
userAgent
:
navigator
.
userAgent
,
windowSize
:
{
innerHeight
:
window
.
innerHeight
,
innerWidth
:
window
.
innerWidth
,
outerHeight
:
window
.
outerHeight
,
outerWidth
:
window
.
outerWidth
},
emptyWorkbench
:
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
,
'
workbench.filesToOpen
'
:
filesToOpen
&&
filesToOpen
.
length
||
0
,
'
workbench.filesToCreate
'
:
filesToCreate
&&
filesToCreate
.
length
||
0
,
'
workbench.filesToDiff
'
:
filesToDiff
&&
filesToDiff
.
length
||
0
,
customKeybindingsCount
:
keybindingsService
.
customKeybindingsCount
(),
theme
:
themeService
.
getColorTheme
().
id
,
language
,
pinnedViewlets
:
activityService
.
getPinnedViewletIds
(),
restoredViewlet
:
activeViewlet
?
activeViewlet
.
getId
()
:
undefined
,
restoredEditors
:
editorService
.
visibleEditors
.
length
,
startupKind
:
lifecycleService
.
startupKind
});
// Error Telemetry
this
.
_register
(
new
ErrorTelemetry
(
telemetryService
));
// Configuration Telemetry
this
.
_register
(
configurationTelemetry
(
telemetryService
,
configurationService
));
// Lifecycle
this
.
_register
(
lifecycleService
.
onShutdown
(()
=>
this
.
dispose
()));
}
}
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
).
registerWorkbenchContribution
(
TelemetryContribution
,
LifecyclePhase
.
Restored
);
\ No newline at end of file
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
f9bda104
...
...
@@ -16,7 +16,7 @@ import { mark } from 'vs/base/common/performance';
import
{
onUnexpectedError
,
setUnexpectedErrorHandler
}
from
'
vs/base/common/errors
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
isWindows
,
isLinux
,
isMacintosh
,
language
}
from
'
vs/base/common/platform
'
;
import
{
isWindows
,
isLinux
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
IEditorInputFactoryRegistry
,
Extensions
as
EditorExtensions
,
IUntitledResourceInput
,
IResourceDiffInput
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -82,8 +82,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
LabelService
}
from
'
vs/workbench/services/label/common/labelService
'
;
import
{
ITelemetryServiceConfig
,
TelemetryService
}
from
'
vs/platform/telemetry/common/telemetryService
'
;
import
{
combinedAppender
,
LogAppender
,
NullTelemetryService
,
configurationTelemetry
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
ErrorTelemetry
from
'
vs/platform/telemetry/browser/errorTelemetry
'
;
import
{
combinedAppender
,
LogAppender
,
NullTelemetryService
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
IExtensionGalleryService
,
IExtensionManagementServerService
,
IExtensionManagementService
,
IExtensionEnablementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IRemoteAuthorityResolverService
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
ExtensionEnablementService
}
from
'
vs/platform/extensionManagement/common/extensionEnablementService
'
;
...
...
@@ -356,7 +355,10 @@ export class Workbench extends Disposable implements IPartService {
this
.
lifecycleService
.
when
(
LifecyclePhase
.
Restored
).
then
(()
=>
clearTimeout
(
timeoutHandle
));
// Restore Parts
return
this
.
restoreParts
().
then
(()
=>
this
.
instantiationService
.
invokeFunction
(
accessor
=>
this
.
whenStarted
(
accessor
)),
error
=>
this
.
instantiationService
.
invokeFunction
(
accessor
=>
this
.
whenStarted
(
accessor
,
error
)));
let
error
:
Error
;
return
this
.
restoreParts
()
.
catch
(
err
=>
error
=
err
)
.
finally
(()
=>
this
.
instantiationService
.
invokeFunction
(
accessor
=>
this
.
whenStarted
(
accessor
,
error
)));
}
private
createWorkbenchContainer
():
void
{
...
...
@@ -408,13 +410,11 @@ export class Workbench extends Disposable implements IPartService {
};
telemetryService
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
TelemetryService
,
config
));
this
.
_register
(
new
ErrorTelemetry
(
telemetryService
));
}
else
{
telemetryService
=
NullTelemetryService
;
}
serviceCollection
.
set
(
ITelemetryService
,
telemetryService
);
this
.
_register
(
configurationTelemetry
(
telemetryService
,
this
.
configurationService
));
// Lifecycle
this
.
lifecycleService
=
this
.
instantiationService
.
createInstance
(
LifecycleService
);
...
...
@@ -791,13 +791,7 @@ export class Workbench extends Disposable implements IPartService {
}
private
whenStarted
(
accessor
:
ServicesAccessor
,
error
?:
Error
):
void
{
const
themeService
=
accessor
.
get
(
IWorkbenchThemeService
);
const
keybindingsService
=
accessor
.
get
(
IKeybindingService
);
const
lifecycleService
=
accessor
.
get
(
ILifecycleService
)
as
LifecycleService
;
const
editorService
=
accessor
.
get
(
IEditorService
);
const
activityService
=
accessor
.
get
(
IActivityService
);
const
contextService
=
accessor
.
get
(
IWorkspaceContextService
);
const
telemetryService
=
accessor
.
get
(
ITelemetryService
);
this
.
restored
=
true
;
...
...
@@ -816,45 +810,6 @@ export class Workbench extends Disposable implements IPartService {
onUnexpectedError
(
error
);
}
const
{
filesToOpen
,
filesToCreate
,
filesToDiff
}
=
this
.
configuration
;
/* __GDPR__
"workspaceLoad" : {
"userAgent" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"windowSize.innerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"windowSize.innerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"windowSize.outerHeight": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"windowSize.outerWidth": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"emptyWorkbench": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"workbench.filesToOpen": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"workbench.filesToCreate": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"workbench.filesToDiff": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"customKeybindingsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"theme": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"language": { "classification": "SystemMetaData", "purpose": "BusinessInsight" },
"pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"restoredViewlet": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"restoredEditors": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
"pinnedViewlets": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"startupKind": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
}
*/
telemetryService
.
publicLog
(
'
workspaceLoad
'
,
{
userAgent
:
navigator
.
userAgent
,
windowSize
:
{
innerHeight
:
window
.
innerHeight
,
innerWidth
:
window
.
innerWidth
,
outerHeight
:
window
.
outerHeight
,
outerWidth
:
window
.
outerWidth
},
emptyWorkbench
:
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
,
'
workbench.filesToOpen
'
:
filesToOpen
&&
filesToOpen
.
length
||
0
,
'
workbench.filesToCreate
'
:
filesToCreate
&&
filesToCreate
.
length
||
0
,
'
workbench.filesToDiff
'
:
filesToDiff
&&
filesToDiff
.
length
||
0
,
customKeybindingsCount
:
keybindingsService
.
customKeybindingsCount
(),
theme
:
themeService
.
getColorTheme
().
id
,
language
,
pinnedViewlets
:
activityService
.
getPinnedViewletIds
(),
restoredViewlet
:
this
.
state
.
sideBar
.
viewletToRestore
,
restoredEditors
:
editorService
.
visibleEditors
.
length
,
startupKind
:
lifecycleService
.
startupKind
});
// Telemetry: startup metrics
mark
(
'
didStartWorkbench
'
);
}
...
...
src/vs/workbench/workbench.main.ts
浏览文件 @
f9bda104
...
...
@@ -88,6 +88,9 @@ registerSingleton(IClipboardService, ClipboardService, true);
//#region --- workbench contributions
// Telemetry
import
'
vs/workbench/contrib/telemetry/browser/telemetry.contribution
'
;
// Localizations
import
'
vs/workbench/contrib/localizations/browser/localizations.contribution
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录