Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
13efa582
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,体验更适合开发者的 AI 搜索 >>
提交
13efa582
编写于
1月 17, 2021
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
telemetry - fix layer breakers
上级
10ca2732
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
30 addition
and
18 deletion
+30
-18
src/vs/base/parts/sandbox/electron-browser/preload.js
src/vs/base/parts/sandbox/electron-browser/preload.js
+1
-0
src/vs/base/parts/sandbox/electron-sandbox/globals.ts
src/vs/base/parts/sandbox/electron-sandbox/globals.ts
+6
-0
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+1
-1
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+1
-1
src/vs/code/node/cliProcessMain.ts
src/vs/code/node/cliProcessMain.ts
+1
-1
src/vs/platform/telemetry/common/commonProperties.ts
src/vs/platform/telemetry/common/commonProperties.ts
+12
-9
src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts
...h/services/telemetry/electron-browser/telemetryService.ts
+2
-1
src/vs/workbench/services/telemetry/electron-sandbox/workbenchCommonProperties.ts
...s/telemetry/electron-sandbox/workbenchCommonProperties.ts
+2
-1
src/vs/workbench/services/telemetry/test/electron-browser/commonProperties.test.ts
.../telemetry/test/electron-browser/commonProperties.test.ts
+4
-4
未找到文件。
src/vs/base/parts/sandbox/electron-browser/preload.js
浏览文件 @
13efa582
...
...
@@ -125,6 +125,7 @@
*/
process
:
{
get
platform
()
{
return
process
.
platform
;
},
get
arch
()
{
return
process
.
arch
;
},
get
env
()
{
return
process
.
env
;
},
get
versions
()
{
return
process
.
versions
;
},
get
type
()
{
return
'
renderer
'
;
},
...
...
src/vs/base/parts/sandbox/electron-sandbox/globals.ts
浏览文件 @
13efa582
...
...
@@ -14,6 +14,12 @@ export interface ISandboxNodeProcess extends INodeProcess {
*/
readonly
platform
:
'
win32
'
|
'
linux
'
|
'
darwin
'
;
/**
* The process.arch property returns a string identifying the CPU architecture
* on which the Node.js process is running.
*/
readonly
arch
:
string
;
/**
* The type will always be Electron renderer.
*/
...
...
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
13efa582
...
...
@@ -214,7 +214,7 @@ class SharedProcessMain extends Disposable {
telemetryService
=
new
TelemetryService
({
appender
:
telemetryAppender
,
commonProperties
:
resolveCommonProperties
(
fileService
,
release
(),
product
.
commit
,
product
.
version
,
this
.
configuration
.
machineId
,
product
.
msftInternalDomains
,
installSourcePath
),
commonProperties
:
resolveCommonProperties
(
fileService
,
release
(),
pro
cess
.
arch
,
pro
duct
.
commit
,
product
.
version
,
this
.
configuration
.
machineId
,
product
.
msftInternalDomains
,
installSourcePath
),
sendErrorTelemetry
:
true
,
piiPaths
:
[
appRoot
,
extensionsPath
]
},
configurationService
);
...
...
src/vs/code/electron-main/app.ts
浏览文件 @
13efa582
...
...
@@ -537,7 +537,7 @@ export class CodeApplication extends Disposable {
if
(
!
this
.
environmentService
.
isExtensionDevelopment
&&
!
this
.
environmentService
.
args
[
'
disable-telemetry
'
]
&&
!!
product
.
enableTelemetry
)
{
const
channel
=
getDelayedChannel
(
sharedProcessReady
.
then
(
client
=>
client
.
getChannel
(
'
telemetryAppender
'
)));
const
appender
=
new
TelemetryAppenderClient
(
channel
);
const
commonProperties
=
resolveCommonProperties
(
this
.
fileService
,
release
(),
product
.
commit
,
product
.
version
,
machineId
,
product
.
msftInternalDomains
,
this
.
environmentService
.
installSourcePath
);
const
commonProperties
=
resolveCommonProperties
(
this
.
fileService
,
release
(),
pro
cess
.
arch
,
pro
duct
.
commit
,
product
.
version
,
machineId
,
product
.
msftInternalDomains
,
this
.
environmentService
.
installSourcePath
);
const
piiPaths
=
[
this
.
environmentService
.
appRoot
,
this
.
environmentService
.
extensionsPath
];
const
config
:
ITelemetryServiceConfig
=
{
appender
,
commonProperties
,
piiPaths
,
sendErrorTelemetry
:
true
};
...
...
src/vs/code/node/cliProcessMain.ts
浏览文件 @
13efa582
...
...
@@ -425,7 +425,7 @@ export async function main(argv: NativeParsedArgs): Promise<void> {
const
config
:
ITelemetryServiceConfig
=
{
appender
:
combinedAppender
(...
appenders
),
sendErrorTelemetry
:
false
,
commonProperties
:
resolveCommonProperties
(
fileService
,
release
(),
product
.
commit
,
product
.
version
,
stateService
.
getItem
(
'
telemetry.machineId
'
),
product
.
msftInternalDomains
,
installSourcePath
),
commonProperties
:
resolveCommonProperties
(
fileService
,
release
(),
pro
cess
.
arch
,
pro
duct
.
commit
,
product
.
version
,
stateService
.
getItem
(
'
telemetry.machineId
'
),
product
.
msftInternalDomains
,
installSourcePath
),
piiPaths
:
[
appRoot
,
extensionsPath
]
};
...
...
src/vs/platform/telemetry/common/commonProperties.ts
浏览文件 @
13efa582
...
...
@@ -4,13 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
*
as
Platform
from
'
vs/base/common/platform
'
;
import
*
as
uuid
from
'
vs/base/common/uuid
'
;
import
{
isLinuxSnap
,
PlatformToString
,
platform
}
from
'
vs/base/common/platform
'
;
import
{
platform
as
nodePlatform
,
env
}
from
'
vs/base/common/process
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
async
function
resolveCommonProperties
(
fileService
:
IFileService
,
release
:
string
,
arch
:
string
,
commit
:
string
|
undefined
,
version
:
string
|
undefined
,
machineId
:
string
|
undefined
,
...
...
@@ -23,7 +25,7 @@ export async function resolveCommonProperties(
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
result
[
'
common.machineId
'
]
=
machineId
;
// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
sessionID
'
]
=
uuid
.
generateUuid
()
+
Date
.
now
();
result
[
'
sessionID
'
]
=
generateUuid
()
+
Date
.
now
();
// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result
[
'
commitHash
'
]
=
commit
;
// __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
...
...
@@ -31,11 +33,11 @@ export async function resolveCommonProperties(
// __GDPR__COMMON__ "common.platformVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
common.platformVersion
'
]
=
(
release
||
''
).
replace
(
/^
(\d
+
)(\.\d
+
)?(\.\d
+
)?(
.*
)
/
,
'
$1$2$3
'
);
// __GDPR__COMMON__ "common.platform" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
common.platform
'
]
=
Platform
.
PlatformToString
(
Platform
.
platform
);
result
[
'
common.platform
'
]
=
Platform
ToString
(
platform
);
// __GDPR__COMMON__ "common.nodePlatform" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result
[
'
common.nodePlatform
'
]
=
process
.
p
latform
;
result
[
'
common.nodePlatform
'
]
=
nodeP
latform
;
// __GDPR__COMMON__ "common.nodeArch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result
[
'
common.nodeArch
'
]
=
process
.
arch
;
result
[
'
common.nodeArch
'
]
=
arch
;
// __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result
[
'
common.product
'
]
=
product
||
'
desktop
'
;
...
...
@@ -66,7 +68,7 @@ export async function resolveCommonProperties(
}
});
if
(
Platform
.
isLinuxSnap
)
{
if
(
isLinuxSnap
)
{
// __GDPR__COMMON__ "common.snap" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
common.snap
'
]
=
'
true
'
;
}
...
...
@@ -84,10 +86,11 @@ export async function resolveCommonProperties(
}
function
verifyMicrosoftInternalDomain
(
domainList
:
readonly
string
[]):
boolean
{
if
(
!
process
||
!
process
.
env
||
!
process
.
env
[
'
USERDNSDOMAIN
'
])
{
const
userDnsDomain
=
env
[
'
USERDNSDOMAIN
'
];
if
(
!
userDnsDomain
)
{
return
false
;
}
const
domain
=
process
.
env
[
'
USERDNSDOMAIN
'
]
!
.
toLowerCase
();
const
domain
=
userDnsDomain
.
toLowerCase
();
return
domainList
.
some
(
msftDomain
=>
domain
===
msftDomain
);
}
src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts
浏览文件 @
13efa582
...
...
@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
process
}
from
'
vs/base/parts/sandbox/electron-sandbox/globals
'
;
import
{
ITelemetryService
,
ITelemetryInfo
,
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
NullTelemetryService
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -39,7 +40,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
const
channel
=
sharedProcessService
.
getChannel
(
'
telemetryAppender
'
);
const
config
:
ITelemetryServiceConfig
=
{
appender
:
new
TelemetryAppenderClient
(
channel
),
commonProperties
:
resolveWorkbenchCommonProperties
(
storageService
,
fileService
,
environmentService
.
os
.
release
,
productService
.
commit
,
productService
.
version
,
environmentService
.
machineId
,
productService
.
msftInternalDomains
,
environmentService
.
installSourcePath
,
environmentService
.
remoteAuthority
),
commonProperties
:
resolveWorkbenchCommonProperties
(
storageService
,
fileService
,
environmentService
.
os
.
release
,
pro
cess
.
arch
,
pro
ductService
.
commit
,
productService
.
version
,
environmentService
.
machineId
,
productService
.
msftInternalDomains
,
environmentService
.
installSourcePath
,
environmentService
.
remoteAuthority
),
piiPaths
:
[
environmentService
.
appRoot
,
environmentService
.
extensionsPath
],
sendErrorTelemetry
:
true
};
...
...
src/vs/workbench/services/telemetry/electron-sandbox/workbenchCommonProperties.ts
浏览文件 @
13efa582
...
...
@@ -14,6 +14,7 @@ export async function resolveWorkbenchCommonProperties(
storageService
:
IStorageService
,
fileService
:
IFileService
,
release
:
string
,
arch
:
string
,
commit
:
string
|
undefined
,
version
:
string
|
undefined
,
machineId
:
string
,
...
...
@@ -21,7 +22,7 @@ export async function resolveWorkbenchCommonProperties(
installSourcePath
:
string
,
remoteAuthority
?:
string
):
Promise
<
{
[
name
:
string
]:
string
|
boolean
|
undefined
}
>
{
const
result
=
await
resolveCommonProperties
(
fileService
,
release
,
commit
,
version
,
machineId
,
msftInternalDomains
,
installSourcePath
,
undefined
);
const
result
=
await
resolveCommonProperties
(
fileService
,
release
,
arch
,
commit
,
version
,
machineId
,
msftInternalDomains
,
installSourcePath
,
undefined
);
const
instanceId
=
storageService
.
get
(
instanceStorageKey
,
StorageScope
.
GLOBAL
)
!
;
const
firstSessionDate
=
storageService
.
get
(
firstSessionDateStorageKey
,
StorageScope
.
GLOBAL
)
!
;
const
lastSessionDate
=
storageService
.
get
(
lastSessionDateStorageKey
,
StorageScope
.
GLOBAL
)
!
;
...
...
src/vs/workbench/services/telemetry/test/electron-browser/commonProperties.test.ts
浏览文件 @
13efa582
...
...
@@ -45,7 +45,7 @@ suite('Telemetry - common properties', function () {
test
(
'
default
'
,
async
function
()
{
await
mkdirp
(
parentDir
);
fs
.
writeFileSync
(
installSource
,
'
my.install.source
'
);
const
props
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
const
props
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
process
.
arch
,
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
assert
.
ok
(
'
commitHash
'
in
props
);
assert
.
ok
(
'
sessionID
'
in
props
);
assert
.
ok
(
'
timestamp
'
in
props
);
...
...
@@ -66,7 +66,7 @@ suite('Telemetry - common properties', function () {
assert
.
ok
(
'
common.instanceId
'
in
props
,
'
instanceId
'
);
assert
.
ok
(
'
common.machineId
'
in
props
,
'
machineId
'
);
fs
.
unlinkSync
(
installSource
);
const
props_1
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
const
props_1
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
process
.
arch
,
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
assert
.
ok
(
!
(
'
common.source
'
in
props_1
));
});
...
...
@@ -74,14 +74,14 @@ suite('Telemetry - common properties', function () {
testStorageService
.
store
(
'
telemetry.lastSessionDate
'
,
new
Date
().
toUTCString
(),
StorageScope
.
GLOBAL
,
StorageTarget
.
MACHINE
);
const
props
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
const
props
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
process
.
arch
,
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
assert
.
ok
(
'
common.lastSessionDate
'
in
props
);
// conditional, see below
assert
.
ok
(
'
common.isNewSession
'
in
props
);
assert
.
equal
(
props
[
'
common.isNewSession
'
],
0
);
});
test
(
'
values chance on ask
'
,
async
function
()
{
const
props
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
const
props
=
await
resolveWorkbenchCommonProperties
(
testStorageService
,
testFileService
,
os
.
release
(),
process
.
arch
,
commit
,
version
,
'
someMachineId
'
,
undefined
,
installSource
);
let
value1
=
props
[
'
common.sequence
'
];
let
value2
=
props
[
'
common.sequence
'
];
assert
.
ok
(
value1
!==
value2
,
'
seq
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录