1
0
Форкнуть 0
This commit is contained in:
Mark Wolff 2020-04-07 14:30:44 -04:00
Родитель 208e623533
Коммит dece24fb0b
8 изменённых файлов: 179 добавлений и 44 удалений

2
.vscode/settings.json поставляемый
Просмотреть файл

@ -4,4 +4,4 @@
"eslint.enable": true,
"eslint.alwaysShowStatus": true,
"files.eol": "\n"
}
}

143
package-lock.json сгенерированный
Просмотреть файл

@ -1845,6 +1845,51 @@
"@opentelemetry/resources": "^0.5.2"
}
},
"@sinonjs/commons": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz",
"integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==",
"dev": true,
"requires": {
"type-detect": "4.0.8"
}
},
"@sinonjs/fake-timers": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz",
"integrity": "sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.7.0"
}
},
"@sinonjs/formatio": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-5.0.1.tgz",
"integrity": "sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1",
"@sinonjs/samsam": "^5.0.2"
}
},
"@sinonjs/samsam": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.0.3.tgz",
"integrity": "sha512-QucHkc2uMJ0pFGjJUDP3F9dq5dx8QIaqISl9QgwLOh6P9yv877uONPGXh/OH/0zmM3tW1JjuJltAZV2l7zU+uQ==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.6.0",
"lodash.get": "^4.4.2",
"type-detect": "^4.0.8"
}
},
"@sinonjs/text-encoding": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
"integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
"dev": true
},
"@types/color-name": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
@ -6596,6 +6641,12 @@
"verror": "1.10.0"
}
},
"just-extend": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz",
"integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==",
"dev": true
},
"kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@ -7781,6 +7832,31 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
"nise": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/nise/-/nise-4.0.3.tgz",
"integrity": "sha512-EGlhjm7/4KvmmE6B/UFsKh7eHykRl9VH+au8dduHLCyWUO/hr7+N+WtTvDUwc9zHuM1IaIJs/0lQ6Ag1jDkQSg==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.7.0",
"@sinonjs/fake-timers": "^6.0.0",
"@sinonjs/text-encoding": "^0.7.1",
"just-extend": "^4.0.2",
"path-to-regexp": "^1.7.0"
}
},
"nock": {
"version": "12.0.3",
"resolved": "https://registry.npmjs.org/nock/-/nock-12.0.3.tgz",
"integrity": "sha512-QNb/j8kbFnKCiyqi9C5DD0jH/FubFGj5rt9NQFONXwQm3IPB0CULECg/eS3AU1KgZb/6SwUa4/DTRKhVxkGABw==",
"dev": true,
"requires": {
"debug": "^4.1.0",
"json-stringify-safe": "^5.0.1",
"lodash": "^4.17.13",
"propagate": "^2.0.0"
}
},
"node-environment-flags": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz",
@ -8609,6 +8685,23 @@
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
"dev": true
},
"path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"dev": true,
"requires": {
"isarray": "0.0.1"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"dev": true
}
}
},
"path-type": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
@ -8742,6 +8835,12 @@
"read": "1"
}
},
"propagate": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz",
"integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==",
"dev": true
},
"proto-list": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
@ -9228,6 +9327,44 @@
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true
},
"sinon": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.1.tgz",
"integrity": "sha512-iTTyiQo5T94jrOx7X7QLBZyucUJ2WvL9J13+96HMfm2CGoJYbIPqRfl6wgNcqmzk0DI28jeGx5bUTXizkrqBmg==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.7.0",
"@sinonjs/fake-timers": "^6.0.0",
"@sinonjs/formatio": "^5.0.1",
"@sinonjs/samsam": "^5.0.3",
"diff": "^4.0.2",
"nise": "^4.0.1",
"supports-color": "^7.1.0"
},
"dependencies": {
"diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
"supports-color": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@ -10148,6 +10285,12 @@
"prelude-ls": "~1.1.2"
}
},
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
},
"type-fest": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",

Просмотреть файл

@ -7,7 +7,7 @@
"scripts": {
"build": "tsc -p ./tsconfig.json",
"lint": "eslint . --ext .ts,.js",
"test": "ts-mocha -p ./tsconfig.json test/**/*.test.ts"
"test": "ts-mocha -p ./tsconfig.json 'test/**/*.test.ts'"
},
"engines": {
"node": ">=8.3.0"
@ -28,8 +28,10 @@
"lerna": "^3.20.2",
"lerna-changelog": "^1.0.1",
"mocha": "^7.1.1",
"nock": "^12.0.3",
"nyc": "^15.0.0",
"prettier": "^2.0.2",
"sinon": "^9.0.1",
"ts-mocha": "^7.0.0",
"tslint": "^6.1.0",
"typescript": "^3.8.3"

Просмотреть файл

@ -1,9 +1,27 @@
// THIS FILE WAS AUTOGENERATED
type PropertyType = string | number | boolean | Array<PropertyType>;
type Properties = { [key: string]: Properties | PropertyType };
type Measurements = { [key: string]: number };
/**
* The abstract common base of all domains.
*/
class Domain {
constructor() {}
/**
* Collection of custom properties.
*/
properties: Properties;
/**
* Collection of custom measurements.
*/
measurements: Measurements;
constructor() {
this.properties = {};
this.measurements = {};
}
}
export = Domain;

Просмотреть файл

@ -53,23 +53,11 @@ class RemoteDependencyData extends Domain {
*/
public type: string | undefined;
/**
* Collection of custom properties.
*/
public properties: any;
/**
* Collection of custom measurements.
*/
public measurements: any;
constructor() {
super();
this.ver = 2;
this.success = true;
this.properties = {};
this.measurements = {};
}
}
export = RemoteDependencyData;

Просмотреть файл

@ -47,23 +47,10 @@ class RequestData extends Domain {
*/
public url: string | undefined;
/**
* Collection of custom properties.
*/
public properties: any;
/**
* Collection of custom measurements.
*/
public measurements: any;
constructor() {
super();
this.ver = 2;
this.properties = {};
this.measurements = {};
}
}
export = RequestData;

Просмотреть файл

@ -1,35 +1,19 @@
import { Logger } from '@opentelemetry/api';
import * as http from 'http';
import * as https from 'https';
export interface ExporterConfig {
// Buffer
maxStorageSize: number; // number of envelopes
// Exporter
instrumentationKey?: string;
connectionString?: string;
// Channel
maxBatchSizeBeforeSend: number; // number of envelopes
batchSendIntervalMs: number;
batchSendRetryIntervalMs: number;
logger?: Logger;
// Sender
maxConsecutiveFailuresBeforeWarning: number;
endpointUrl: string;
proxyHttpsUrl?: string;
proxyHttpUrl?: string;
httpAgent?: http.Agent;
httpsAgent?: https.Agent;
}
export const DEFAULT_EXPORTER_CONFIG: ExporterConfig = {
maxStorageSize: 2_000,
endpointUrl: 'https://dc.services.visualstudio.com/v2/track',
maxBatchSizeBeforeSend: 500,
batchSendIntervalMs: 15_000,
batchSendRetryIntervalMs: 60_000,
maxConsecutiveFailuresBeforeWarning: 10,
};

Просмотреть файл

@ -1,5 +1,18 @@
export interface BreezeError {
index: number;
statusCode: number;
message: string;
}
export interface BreezeResponse {
itemsReceived: number;
itemsAccepted: number;
errors: BreezeError[];
}
export function isRetriable(statusCode: number): boolean {
return (
statusCode === 206 || // Retriable
statusCode === 408 || // Timeout
statusCode === 429 || // Throttle
statusCode === 439 || // Quota