Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
9e1420c5
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e1420c5
编写于
5月 06, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
ai appender
上级
8a0da20f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
25 deletion
+19
-25
src/vs/platform/telemetry/node/appInsightsAppender.ts
src/vs/platform/telemetry/node/appInsightsAppender.ts
+18
-24
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+1
-1
未找到文件。
src/vs/platform/telemetry/node/appInsightsAppender.ts
浏览文件 @
9e1420c5
...
...
@@ -7,16 +7,16 @@
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryAppender
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
I
WorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
I
Environment
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
AIAdapter
,
IAIAdapter
}
from
'
vs/base/node/aiAdapter
'
;
import
winreg
=
require
(
'
winreg
'
);
import
os
=
require
(
'
os
'
);
class
StorageKeys
{
public
static
sqmUserId
:
string
=
'
telemetry.sqm.userId
'
;
public
static
sqmMachineId
:
string
=
'
telemetry.sqm.machineId
'
;
public
static
lastSessionDate
:
string
=
'
telemetry.lastSessionDate
'
;
public
static
firstSessionDate
:
string
=
'
telemetry.firstSessionDate
'
;
namespace
StorageKeys
{
export
const
sqmUserId
:
string
=
'
telemetry.sqm.userId
'
;
export
const
sqmMachineId
:
string
=
'
telemetry.sqm.machineId
'
;
export
const
lastSessionDate
:
string
=
'
telemetry.lastSessionDate
'
;
export
const
firstSessionDate
:
string
=
'
telemetry.firstSessionDate
'
;
}
export
class
AppInsightsAppender
implements
ITelemetryAppender
{
...
...
@@ -25,29 +25,23 @@ export class AppInsightsAppender implements ITelemetryAppender {
private
static
SQM_KEY
:
string
=
'
\\
Software
\\
Microsoft
\\
SQMClient
'
;
private
storageService
:
IStorageService
;
private
contextService
:
IWorkspaceContextService
;
private
storageService
:
IStorageService
;
private
appInsights
:
IAIAdapter
;
private
appInsightsVortex
:
IAIAdapter
;
protected
commonProperties
:
{[
key
:
string
]
:
string
};
protected
commonMetrics
:
{[
key
:
string
]:
number
};
private
commonProperties
:
{
[
key
:
string
]:
string
};
private
commonMetrics
:
{
[
key
:
string
]:
number
};
constructor
(
@
IStorageService
storageService
:
IStorageService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
env
:
IEnvironment
,
_testing_client
?:
any
)
{
this
.
commonProperties
=
{};
this
.
commonMetrics
=
{};
this
.
contextService
=
contextService
;
this
.
storageService
=
storageService
;
let
config
=
this
.
contextService
.
getConfiguration
().
env
.
aiConfig
;
let
key
=
config
?
config
.
key
:
null
;
let
asimovKey
=
config
?
config
.
asimovKey
:
null
;
let
key
=
env
.
aiConfig
&&
env
.
aiConfig
.
key
;
let
asimovKey
=
env
.
aiConfig
&&
env
.
aiConfig
.
asimovKey
;
// for test
if
(
_testing_client
)
{
...
...
@@ -63,7 +57,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
this
.
appInsights
=
new
AIAdapter
(
key
,
AppInsightsAppender
.
EVENT_NAME_PREFIX
);
}
if
(
asimovKey
)
{
if
(
asimovKey
)
{
this
.
appInsightsVortex
=
new
AIAdapter
(
asimovKey
,
AppInsightsAppender
.
EVENT_NAME_PREFIX
);
}
...
...
@@ -83,7 +77,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
if
(
sqmUserId
)
{
this
.
commonProperties
[
'
sqm.userid
'
]
=
sqmUserId
;
}
else
{
this
.
getWinRegKeyData
(
AppInsightsAppender
.
SQM_KEY
,
'
UserId
'
,
winreg
.
HKCU
,
(
error
,
result
:
string
)
=>
{
AppInsightsAppender
.
_
getWinRegKeyData
(
AppInsightsAppender
.
SQM_KEY
,
'
UserId
'
,
winreg
.
HKCU
,
(
error
,
result
:
string
)
=>
{
if
(
!
error
&&
result
)
{
this
.
commonProperties
[
'
sqm.userid
'
]
=
result
;
this
.
storageService
.
store
(
StorageKeys
.
sqmUserId
,
result
);
...
...
@@ -96,7 +90,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
this
.
commonProperties
[
'
sqm.machineid
'
]
=
sqmMachineId
;
}
else
{
this
.
getWinRegKeyData
(
AppInsightsAppender
.
SQM_KEY
,
'
MachineId
'
,
winreg
.
HKLM
,
(
error
,
result
)
=>
{
AppInsightsAppender
.
_getWinRegKeyData
(
AppInsightsAppender
.
SQM_KEY
,
'
MachineId
'
,
winreg
.
HKLM
,
(
error
,
result
)
=>
{
if
(
!
error
&&
result
)
{
this
.
commonProperties
[
'
sqm.machineid
'
]
=
result
;
this
.
storageService
.
store
(
StorageKeys
.
sqmMachineId
,
result
);
...
...
@@ -106,7 +100,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
}
var
firstSessionDate
=
this
.
storageService
.
get
(
StorageKeys
.
firstSessionDate
);
if
(
!
firstSessionDate
)
{
if
(
!
firstSessionDate
)
{
firstSessionDate
=
(
new
Date
()).
toUTCString
();
this
.
storageService
.
store
(
StorageKeys
.
firstSessionDate
,
firstSessionDate
);
}
...
...
@@ -114,7 +108,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
//report last session date and isNewSession flag
var
lastSessionDate
=
this
.
storageService
.
get
(
StorageKeys
.
lastSessionDate
);
if
(
!
lastSessionDate
)
{
if
(
!
lastSessionDate
)
{
this
.
commonMetrics
[
'
isNewSession
'
]
=
1
;
}
else
{
this
.
commonMetrics
[
'
isNewSession
'
]
=
0
;
...
...
@@ -128,7 +122,7 @@ export class AppInsightsAppender implements ITelemetryAppender {
}
}
private
getWinRegKeyData
(
key
:
string
,
name
:
string
,
hive
:
string
,
callback
:
(
error
:
Error
,
userId
:
string
)
=>
void
):
void
{
private
static
_
getWinRegKeyData
(
key
:
string
,
name
:
string
,
hive
:
string
,
callback
:
(
error
:
Error
,
userId
:
string
)
=>
void
):
void
{
if
(
process
.
platform
===
'
win32
'
)
{
try
{
var
reg
=
new
winreg
({
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
9e1420c5
...
...
@@ -209,7 +209,7 @@ export class WorkbenchShell {
extensionsRoot
:
this
.
configuration
.
env
.
userExtensionsHome
,
version
:
this
.
configuration
.
env
.
version
,
commitHash
:
this
.
configuration
.
env
.
commitHash
,
appender
:
[
new
AppInsightsAppender
(
this
.
storageService
,
this
.
con
textService
)]
appender
:
[
new
AppInsightsAppender
(
this
.
storageService
,
this
.
con
figuration
.
env
)]
});
}
else
{
this
.
telemetryService
=
NullTelemetryService
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录