浏览代码

Fixes zone.js monkey patching by application-insights

main
Eric Amodio 7 年前
父节点
当前提交
f16c3857e5
共有 4 个文件被更改,包括 33 次插入27 次删除
  1. +7
    -13
      package-lock.json
  2. +2
    -3
      package.json
  3. +10
    -4
      src/@types/applicationinsights/index.d.ts
  4. +14
    -7
      src/telemetry.ts

+ 7
- 13
package-lock.json 查看文件

@ -1,14 +1,8 @@
{
"name": "gitlens",
"version": "3.6.0",
"version": "3.6.1",
"lockfileVersion": 1,
"dependencies": {
"@types/applicationinsights": {
"version": "0.15.33",
"resolved": "https://registry.npmjs.org/@types/applicationinsights/-/applicationinsights-0.15.33.tgz",
"integrity": "sha1-yohXeRuaxSzlKplCXksJrRfrlwg=",
"dev": true
},
"@types/copy-paste": {
"version": "1.1.30",
"resolved": "https://registry.npmjs.org/@types/copy-paste/-/copy-paste-1.1.30.tgz",
@ -28,9 +22,9 @@
"dev": true
},
"@types/node": {
"version": "7.0.27",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.27.tgz",
"integrity": "sha512-2QMiuVOEye2yKmMwE1V96C9HSShmT0WSm6dv2WjacvePEjQNNJGAerTO5hdYhj5lpdK5MW+FVxmyzDhr4omIdw==",
"version": "7.0.28",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.28.tgz",
"integrity": "sha512-9rLhvgupMpC7Yh24yB8zj+4L6SZ9BYUwqknEC8+R7gqCg3KL65UHg7yu9X6J8mSmmtVr1Hbey564yZ3C9nXqtQ==",
"dev": true
},
"@types/tmp": {
@ -1784,9 +1778,9 @@
"dev": true
},
"tslint": {
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.4.2.tgz",
"integrity": "sha1-YJtmQMwEJPSjlamt9ow3VWPFScc=",
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.4.3.tgz",
"integrity": "sha1-dhyEArgONHt3M6BDkKdXslNYBGc=",
"dev": true
},
"tsutils": {

+ 2
- 3
package.json 查看文件

@ -916,14 +916,13 @@
"tmp": "0.0.31"
},
"devDependencies": {
"@types/applicationinsights": "0.15.33",
"@types/copy-paste": "1.1.30",
"@types/iconv-lite": "0.0.1",
"@types/mocha": "2.2.41",
"@types/node": "7.0.27",
"@types/node": "7.0.28",
"@types/tmp": "0.0.33",
"mocha": "3.4.2",
"tslint": "5.4.2",
"tslint": "5.4.3",
"typescript": "2.3.4",
"vscode": "1.1.0"
}

+ 10
- 4
src/@types/applicationinsights/index.d.ts 查看文件

@ -16,9 +16,9 @@ interface AutoCollectConsole {
}
interface AutoCollectExceptions {
constructor(client:Client): AutoCollectExceptions;
constructor(client: Client): AutoCollectExceptions;
isInitialized(): boolean;
enable(isEnabled:boolean): void;
enable(isEnabled: boolean): void;
}
interface AutoCollectPerformance {
@ -348,7 +348,7 @@ interface Client {
* @param max the max sample for this set
* @param stdDev the standard deviation of the set
*/
trackMetric(name: string, value: number, count?:number, min?: number, max?: number, stdDev?: number, properties?: {
trackMetric(name: string, value: number, count?: number, min?: number, max?: number, stdDev?: number, properties?: {
[key: string]: string;
}): void;
@ -374,7 +374,8 @@ interface Client {
* @param error An error that was returned for this request if it was unsuccessful. Defaults to null.
*/
trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
[key: string]: string;}, error?: any) : void;
[key: string]: string;
}, error?: any): void;
/**
* Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
@ -503,6 +504,11 @@ interface ApplicationInsights {
*
*/
setOfflineMode(value: boolean, resentIntervall?: number): ApplicationInsights;
/**
*
*/
setAutoDependencyCorrelation(value: boolean): ApplicationInsights;
}
declare module "applicationinsights" {

+ 14
- 7
src/telemetry.ts 查看文件

@ -13,15 +13,21 @@ export class Telemetry extends Disposable {
}
static setContext(context?: { [key: string]: string }) {
_reporter && _reporter.setContext(context);
if (_reporter === undefined) return;
_reporter.setContext(context);
}
static trackEvent(name: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number; }) {
_reporter && _reporter.trackEvent(name, properties, measurements);
if (_reporter === undefined) return;
_reporter.trackEvent(name, properties, measurements);
}
static trackException(ex: Error) {
_reporter && _reporter.trackException(ex);
if (_reporter === undefined) return;
_reporter.trackException(ex);
}
}
@ -44,11 +50,12 @@ export class TelemetryReporter {
}
else {
this._client = this.appInsights.setup(key)
.setAutoCollectConsole(false)
.setAutoCollectDependencies(false)
.setAutoCollectExceptions(false)
.setAutoCollectPerformance(false)
.setAutoCollectRequests(false)
.setAutoCollectPerformance(false)
.setAutoCollectExceptions(false)
.setAutoCollectDependencies(false)
.setAutoCollectConsole(false)
.setAutoDependencyCorrelation(false)
.setOfflineMode(true)
.start()
.client;

正在加载...
取消
保存