Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ff225b9f
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,发现更多精彩内容 >>
未验证
提交
ff225b9f
编写于
3月 02, 2021
作者:
S
SteVen Batten
提交者:
GitHub
3月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add telemetry enablement api (#117944)
上级
4de8cb29
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
82 addition
and
6 deletion
+82
-6
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+4
-0
src/vs/workbench/api/browser/mainThreadTelemetry.ts
src/vs/workbench/api/browser/mainThreadTelemetry.ts
+28
-6
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+11
-0
src/vs/workbench/api/common/extHost.common.services.ts
src/vs/workbench/api/common/extHost.common.services.ts
+2
-0
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+6
-0
src/vs/workbench/api/common/extHostTelemetry.ts
src/vs/workbench/api/common/extHostTelemetry.ts
+31
-0
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
ff225b9f
...
...
@@ -2708,6 +2708,10 @@ declare module 'vscode' {
namespace
env
{
export
function
openExternal
(
target
:
Uri
,
options
?:
OpenExternalOptions
):
Thenable
<
boolean
>
;
export
const
isTelemetryEnabled
:
boolean
;
export
const
onDidChangeTelemetryEnabled
:
Event
<
boolean
>
;
}
//#endregion
...
...
src/vs/workbench/api/browser/mainThreadTelemetry.ts
浏览文件 @
ff225b9f
...
...
@@ -4,24 +4,46 @@
*--------------------------------------------------------------------------------------------*/
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
MainThreadTelemetryShape
,
MainContext
,
IExtHostContext
}
from
'
../common/extHost.protocol
'
;
import
{
MainThreadTelemetryShape
,
MainContext
,
IExtHostContext
,
ExtHostTelemetryShape
,
ExtHostContext
}
from
'
../common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
ClassifiedEvent
,
StrictPropertyCheck
,
GDPRClassification
}
from
'
vs/platform/telemetry/common/gdprTypings
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadTelemetry
)
export
class
MainThreadTelemetry
implements
MainThreadTelemetryShape
{
export
class
MainThreadTelemetry
extends
Disposable
implements
MainThreadTelemetryShape
{
private
readonly
_proxy
:
ExtHostTelemetryShape
;
private
static
readonly
_name
=
'
pluginHostTelemetry
'
;
constructor
(
extHostContext
:
IExtHostContext
,
@
ITelemetryService
private
readonly
_telemetryService
:
ITelemetryService
@
ITelemetryService
private
readonly
_telemetryService
:
ITelemetryService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
IEnvironmentService
private
readonly
_environmenService
:
IEnvironmentService
,
)
{
//
super
();
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostTelemetry
);
if
(
!
this
.
_environmenService
.
disableTelemetry
)
{
this
.
_register
(
this
.
_configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
affectedKeys
.
includes
(
'
telemetry.enableTelemetry
'
))
{
this
.
_proxy
.
$onDidChangeTelemetryEnabled
(
this
.
telemetryEnabled
);
}
}));
}
this
.
_proxy
.
$initializeTelemetryEnabled
(
this
.
telemetryEnabled
);
}
dispose
():
void
{
//
private
get
telemetryEnabled
():
boolean
{
if
(
this
.
_environmenService
.
disableTelemetry
)
{
return
false
;
}
return
!!
this
.
_configurationService
.
getValue
(
'
telemetry.enableTelemetry
'
);
}
$publicLog
(
eventName
:
string
,
data
:
any
=
Object
.
create
(
null
)):
void
{
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
ff225b9f
...
...
@@ -85,6 +85,7 @@ import { ExtHostTesting } from 'vs/workbench/api/common/extHostTesting';
import
{
ExtHostUriOpeners
}
from
'
vs/workbench/api/common/extHostUriOpener
'
;
import
{
IExtHostSecretState
}
from
'
vs/workbench/api/common/exHostSecretState
'
;
import
{
ExtHostEditorTabs
}
from
'
vs/workbench/api/common/extHostEditorTabs
'
;
import
{
IExtHostTelemetry
}
from
'
vs/workbench/api/common/extHostTelemetry
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
,
registry
:
ExtensionDescriptionRegistry
,
configProvider
:
ExtHostConfigProvider
):
typeof
vscode
;
...
...
@@ -101,6 +102,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const
extHostConsumerFileSystem
=
accessor
.
get
(
IExtHostConsumerFileSystem
);
const
extensionService
=
accessor
.
get
(
IExtHostExtensionService
);
const
extHostWorkspace
=
accessor
.
get
(
IExtHostWorkspace
);
const
extHostTelemetry
=
accessor
.
get
(
IExtHostTelemetry
);
const
extHostConfiguration
=
accessor
.
get
(
IExtHostConfiguration
);
const
uriTransformer
=
accessor
.
get
(
IURITransformerService
);
const
rpcProtocol
=
accessor
.
get
(
IExtHostRpcService
);
...
...
@@ -122,6 +124,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostTunnelService
,
extHostTunnelService
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostWindow
,
extHostWindow
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostSecretState
,
extHostSecretState
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostTelemetry
,
extHostTelemetry
);
// automatically create and register addressable instances
const
extHostDecorations
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDecorations
,
accessor
.
get
(
IExtHostDecorations
));
...
...
@@ -292,6 +295,14 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
get
shell
()
{
return
extHostTerminalService
.
getDefaultShell
(
false
,
configProvider
);
},
get
isTelemetryEnabled
()
{
checkProposedApiEnabled
(
extension
);
return
extHostTelemetry
.
getTelemetryEnabled
();
},
get
onDidChangeTelemetryEnabled
():
Event
<
boolean
>
{
checkProposedApiEnabled
(
extension
);
return
extHostTelemetry
.
onDidChangeTelemetryEnabled
;
},
openExternal
(
uri
:
URI
,
options
?:
{
allowContributedOpeners
?:
boolean
|
string
;
})
{
return
extHostWindow
.
openUri
(
uri
,
{
allowTunneling
:
!!
initData
.
remote
.
authority
,
...
...
src/vs/workbench/api/common/extHost.common.services.ts
浏览文件 @
ff225b9f
...
...
@@ -22,6 +22,7 @@ import { IExtHostWindow, ExtHostWindow } from 'vs/workbench/api/common/extHostWi
import
{
IExtHostConsumerFileSystem
,
ExtHostConsumerFileSystem
}
from
'
vs/workbench/api/common/extHostFileSystemConsumer
'
;
import
{
IExtHostFileSystemInfo
,
ExtHostFileSystemInfo
}
from
'
vs/workbench/api/common/extHostFileSystemInfo
'
;
import
{
IExtHostSecretState
,
ExtHostSecretState
}
from
'
vs/workbench/api/common/exHostSecretState
'
;
import
{
ExtHostTelemetry
,
IExtHostTelemetry
}
from
'
vs/workbench/api/common/extHostTelemetry
'
;
registerSingleton
(
IExtensionStoragePaths
,
ExtensionStoragePaths
);
registerSingleton
(
IExtHostApiDeprecationService
,
ExtHostApiDeprecationService
);
...
...
@@ -41,3 +42,4 @@ registerSingleton(IExtHostTunnelService, ExtHostTunnelService);
registerSingleton
(
IExtHostWindow
,
ExtHostWindow
);
registerSingleton
(
IExtHostWorkspace
,
ExtHostWorkspace
);
registerSingleton
(
IExtHostSecretState
,
ExtHostSecretState
);
registerSingleton
(
IExtHostTelemetry
,
ExtHostTelemetry
);
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
ff225b9f
...
...
@@ -1536,6 +1536,11 @@ export interface ExtHostQuickOpenShape {
$onDidHide
(
sessionId
:
number
):
void
;
}
export
interface
ExtHostTelemetryShape
{
$initializeTelemetryEnabled
(
enabled
:
boolean
):
void
;
$onDidChangeTelemetryEnabled
(
enabled
:
boolean
):
void
;
}
export
interface
IShellLaunchConfigDto
{
name
?:
string
;
executable
?:
string
;
...
...
@@ -1962,4 +1967,5 @@ export const ExtHostContext = {
ExtHostAuthentication
:
createMainId
<
ExtHostAuthenticationShape
>
(
'
ExtHostAuthentication
'
),
ExtHostTimeline
:
createMainId
<
ExtHostTimelineShape
>
(
'
ExtHostTimeline
'
),
ExtHostTesting
:
createMainId
<
ExtHostTestingShape
>
(
'
ExtHostTesting
'
),
ExtHostTelemetry
:
createMainId
<
ExtHostTelemetryShape
>
(
'
ExtHostTelemetry
'
),
};
src/vs/workbench/api/common/extHostTelemetry.ts
0 → 100644
浏览文件 @
ff225b9f
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ExtHostTelemetryShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
export
class
ExtHostTelemetry
implements
ExtHostTelemetryShape
{
private
readonly
_onDidChangeTelemetryEnabled
=
new
Emitter
<
boolean
>
();
readonly
onDidChangeTelemetryEnabled
:
Event
<
boolean
>
=
this
.
_onDidChangeTelemetryEnabled
.
event
;
private
_enabled
:
boolean
=
false
;
getTelemetryEnabled
():
boolean
{
return
this
.
_enabled
;
}
$initializeTelemetryEnabled
(
enabled
:
boolean
):
void
{
this
.
_enabled
=
enabled
;
}
$onDidChangeTelemetryEnabled
(
enabled
:
boolean
):
void
{
this
.
_enabled
=
enabled
;
this
.
_onDidChangeTelemetryEnabled
.
fire
(
enabled
);
}
}
export
const
IExtHostTelemetry
=
createDecorator
<
IExtHostTelemetry
>
(
'
IExtHostTelemetry
'
);
export
interface
IExtHostTelemetry
extends
ExtHostTelemetry
,
ExtHostTelemetryShape
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录