Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3a9b0ec3
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,发现更多精彩内容 >>
提交
3a9b0ec3
编写于
7月 26, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
send extension installation duration
fixes #9739
上级
d29c7424
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
55 addition
and
9 deletion
+55
-9
src/vs/workbench/parts/extensions/electron-browser/extensionsWorkbenchService.ts
...extensions/electron-browser/extensionsWorkbenchService.ts
+55
-9
未找到文件。
src/vs/workbench/parts/extensions/electron-browser/extensionsWorkbenchService.ts
浏览文件 @
3a9b0ec3
...
...
@@ -123,13 +123,37 @@ function stripVersion(id: string): string {
return
id
.
replace
(
/-
\d
+
\.\d
+
\.\d
+$/
,
''
);
}
enum
Operation
{
Installing
,
Updating
,
Uninstalling
}
interface
IActiveExtension
{
id
:
string
;
operation
:
Operation
;
extension
:
Extension
;
start
:
Date
;
}
function
toTelemetryEventName
(
operation
:
Operation
)
{
switch
(
operation
)
{
case
Operation
.
Installing
:
return
'
extensionGallery:install
'
;
case
Operation
.
Updating
:
return
'
extensionGallery:update
'
;
case
Operation
.
Uninstalling
:
return
'
extensionGallery:uninstall
'
;
}
return
''
;
}
export
class
ExtensionsWorkbenchService
implements
IExtensionsWorkbenchService
{
private
static
SyncPeriod
=
1000
*
60
*
60
*
12
;
// 12 hours
_serviceBrand
:
any
;
private
stateProvider
:
IExtensionStateProvider
;
private
installing
:
{
id
:
string
;
extension
:
Extension
;
}[]
=
[];
private
installing
:
IActiveExtension
[]
=
[];
private
uninstalling
:
IActiveExtension
[]
=
[];
private
installed
:
Extension
[]
=
[];
private
syncDelayer
:
ThrottledDelayer
<
void
>
;
private
disposables
:
IDisposable
[]
=
[];
...
...
@@ -148,6 +172,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
this
.
disposables
.
push
(
extensionService
.
onInstallExtension
(({
id
,
gallery
})
=>
this
.
onInstallExtension
(
id
,
gallery
)));
this
.
disposables
.
push
(
extensionService
.
onDidInstallExtension
(({
id
,
local
,
error
})
=>
this
.
onDidInstallExtension
(
id
,
local
,
error
)));
this
.
disposables
.
push
(
extensionService
.
onUninstallExtension
(
id
=>
this
.
onUninstallExtension
(
id
)));
this
.
disposables
.
push
(
extensionService
.
onDidUninstallExtension
(
id
=>
this
.
onDidUninstallExtension
(
id
)));
this
.
syncDelayer
=
new
ThrottledDelayer
<
void
>
(
ExtensionsWorkbenchService
.
SyncPeriod
);
...
...
@@ -280,7 +305,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
extension
.
gallery
=
gallery
;
this
.
installing
.
push
({
id
:
stripVersion
(
id
),
extension
});
const
start
=
new
Date
();
const
operation
=
Operation
.
Uninstalling
;
this
.
installing
.
push
({
id
:
stripVersion
(
id
),
operation
,
extension
,
start
});
this
.
_onChange
.
fire
();
}
...
...
@@ -313,7 +341,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
}
this
.
reportTelemetry
(
extension
,
eventName
,
!
error
);
this
.
reportTelemetry
(
installing
,
!
error
);
this
.
_onChange
.
fire
();
}
...
...
@@ -326,10 +354,25 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
return
;
}
this
.
reportTelemetry
(
extension
,
'
extensionGallery:uninstall
'
,
true
);
const
start
=
new
Date
();
const
operation
=
Operation
.
Uninstalling
;
const
uninstalling
=
this
.
uninstalling
.
filter
(
e
=>
e
.
id
===
id
)[
0
]
||
{
id
,
operation
,
extension
,
start
};
this
.
uninstalling
=
[
uninstalling
,
...
this
.
uninstalling
.
filter
(
e
=>
e
.
id
!==
id
)];
this
.
_onChange
.
fire
();
}
private
onDidUninstallExtension
(
id
:
string
):
void
{
const
uninstalling
=
this
.
uninstalling
.
filter
(
e
=>
e
.
id
===
id
)[
0
];
this
.
uninstalling
=
this
.
uninstalling
.
filter
(
e
=>
e
.
id
!==
id
);
if
(
!
uninstalling
)
{
return
;
}
this
.
reportTelemetry
(
uninstalling
,
true
);
}
private
getExtensionState
(
extension
:
Extension
):
ExtensionState
{
if
(
extension
.
gallery
&&
this
.
installing
.
some
(
e
=>
e
.
extension
.
gallery
.
id
===
extension
.
gallery
.
id
))
{
return
ExtensionState
.
Installing
;
...
...
@@ -344,13 +387,13 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
return
ExtensionState
.
Uninstalled
;
}
private
reportTelemetry
(
extension
:
Extension
,
eventName
:
string
,
success
:
boolean
):
void
{
if
(
!
extension
)
{
private
reportTelemetry
(
active
:
IActiveExtension
,
success
:
boolean
):
void
{
if
(
!
active
.
extension
)
{
return
;
}
const
local
=
extension
.
local
;
const
gallery
=
extension
.
gallery
;
const
local
=
active
.
extension
.
local
;
const
gallery
=
active
.
extension
.
gallery
;
let
data
=
null
;
if
(
gallery
)
{
...
...
@@ -373,7 +416,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
};
}
this
.
telemetryService
.
publicLog
(
eventName
,
assign
(
data
,
{
success
}));
const
duration
=
new
Date
().
getTime
()
-
active
.
start
.
getTime
();
const
eventName
=
toTelemetryEventName
(
active
.
operation
);
this
.
telemetryService
.
publicLog
(
eventName
,
assign
(
data
,
{
success
,
duration
}));
}
dispose
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录