@fedify/fedify 2.3.0-dev.1212 → 2.3.0-dev.1213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builder-DdbtvTFp.mjs → builder-Bj-7Sl7u.mjs} +9 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/outgoing-jsonld.test.mjs +1 -1
- package/dist/compat/public-audience.test.mjs +1 -1
- package/dist/compat/transformers.test.mjs +2 -2
- package/dist/{context-DMHK7jqX.d.cts → context-BBVLF7lx.d.cts} +41 -2
- package/dist/{context-K9cg8oGx.d.ts → context-BU6jSQdo.d.ts} +42 -2
- package/dist/{deno-DTaoLXHr.mjs → deno-BUzynMVz.mjs} +1 -1
- package/dist/{docloader-CdNiXmNg.mjs → docloader-jQPthO4U.mjs} +2 -2
- package/dist/{esm-BQRw925N.mjs → esm-vrlUxr60.mjs} +23 -1
- package/dist/federation/builder.test.mjs +21 -2
- package/dist/federation/circuit-breaker.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/idempotency.test.mjs +4 -4
- package/dist/federation/keycache.test.mjs +1 -1
- package/dist/federation/kv.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +147 -1
- package/dist/federation/middleware.test.mjs +446 -18
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +8 -4426
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{http-Czeyq7if.cjs → http-B1zlPuh3.cjs} +79 -2
- package/dist/{http-BEG9kx13.js → http-B_WbYMnB.js} +74 -3
- package/dist/{http-ByCfCX5K.mjs → http-CDaMGwCP.mjs} +4 -4
- package/dist/{key-Bhsx9PrC.mjs → key-DdP4HxTK.mjs} +2 -2
- package/dist/{kv-cache-qRBN2G2Z.cjs → kv-cache-CPIfTWt5.cjs} +1 -1
- package/dist/{kv-cache-D9U1AnXH.js → kv-cache-CXo8QM4m.js} +1 -1
- package/dist/{kv-cache-D4jzgeYW.mjs → kv-cache-DSjv5Aeh.mjs} +1 -1
- package/dist/{ld-CHtLb_Uh.mjs → ld-CuOEh5aB.mjs} +3 -3
- package/dist/{metrics-uwSF8DLC.mjs → metrics-B5vvJYMV.mjs} +74 -3
- package/dist/{middleware-BmSzD5U9.mjs → middleware-Cq9S8A5O.mjs} +328 -24
- package/dist/{middleware-CyiBzIwY.mjs → middleware-DPE-IRlD.mjs} +1 -1
- package/dist/{middleware-DrKDd2JT.js → middleware-Dft_sYeS.js} +352 -41
- package/dist/{middleware-CRORNnSU.cjs → middleware-DlqW4IRW.cjs} +351 -40
- package/dist/{mod-YLnSsEHY.d.cts → mod-C0F6kvgS.d.cts} +1 -1
- package/dist/{mod-CfOFqS0w.d.ts → mod-vPYVoa5n.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +4 -4
- package/dist/mod.d.ts +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +2 -2
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/nodeinfo/types.test.mjs +1 -1
- package/dist/otel/exporter.test.mjs +1 -1
- package/dist/{outgoing-jsonld-BgFLCJQ_.mjs → outgoing-jsonld-L_DbOaFe.mjs} +1 -1
- package/dist/{owner-B0Zrhs0w.mjs → owner--n8rmG51.mjs} +2 -2
- package/dist/{proof-frzCtYji.cjs → proof-BKpJ_p_d.cjs} +1 -1
- package/dist/{proof-CZhAX94C.js → proof-BsvB1vGI.js} +1 -1
- package/dist/{proof-DbJFxpzD.mjs → proof-dhtwaP4z.mjs} +5 -5
- package/dist/{send-kst2L0Df.mjs → send-CTQ30Wbe.mjs} +3 -3
- package/dist/sig/accept.test.mjs +1 -1
- package/dist/sig/http.test.mjs +4 -4
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +2 -2
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{temporal-CcGypkzd.mjs → temporal-gfUaZjGU.mjs} +1 -1
- package/dist/testing/mod.d.mts +1 -0
- package/dist/utils/docloader.test.mjs +4 -4
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- package/dist/chunk-DNRtMIoB.mjs +0 -29
- package/dist/execAsync-Dmet7-28.mjs +0 -13
- package/dist/getMachineId-bsd-Bn0le7-J.mjs +0 -29
- package/dist/getMachineId-darwin-CVjKuDgj.mjs +0 -26
- package/dist/getMachineId-linux-DbG4BXa-.mjs +0 -22
- package/dist/getMachineId-unsupported-lC8T9hPE.mjs +0 -17
- package/dist/getMachineId-win-c5zxTSS1.mjs +0 -28
- /package/dist/{accept-CceiKpCy.mjs → accept-CPkZzmGN.mjs} +0 -0
- /package/dist/{client-B_A6mfn3.mjs → client-ByXmQhYD.mjs} +0 -0
- /package/dist/{keys-C3kae-6B.mjs → keys-DGu1NFwu.mjs} +0 -0
- /package/dist/{kv-x2IvBUyq.mjs → kv-rV3vodCc.mjs} +0 -0
- /package/dist/{public-audience-N3pyOx2p.mjs → public-audience-Cvbr2Gzt.mjs} +0 -0
- /package/dist/{types-BFowWFTT.mjs → types-J53Kw7so.mjs} +0 -0
|
@@ -1,4440 +1,22 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as esm_default } from "../esm-vrlUxr60.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
6
6
|
import "../std__assert-BBjXFNOb.mjs";
|
|
7
7
|
import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
8
8
|
import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
|
|
9
9
|
import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
|
|
10
10
|
import { t as assert } from "../assert-OguE97r2.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { t as
|
|
15
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-kst2L0Df.mjs";
|
|
11
|
+
import { l as verifyRequest } from "../http-CDaMGwCP.mjs";
|
|
12
|
+
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
|
|
13
|
+
import { t as doesActorOwnKey } from "../owner--n8rmG51.mjs";
|
|
14
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-CTQ30Wbe.mjs";
|
|
16
15
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
17
16
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
17
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
19
|
-
|
|
20
|
-
var require_AggregationTemporality = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.AggregationTemporality = void 0;
|
|
23
|
-
(function(AggregationTemporality) {
|
|
24
|
-
AggregationTemporality[AggregationTemporality["DELTA"] = 0] = "DELTA";
|
|
25
|
-
AggregationTemporality[AggregationTemporality["CUMULATIVE"] = 1] = "CUMULATIVE";
|
|
26
|
-
})(exports.AggregationTemporality || (exports.AggregationTemporality = {}));
|
|
27
|
-
}));
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricData.js
|
|
30
|
-
var require_MetricData = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.DataPointType = exports.InstrumentType = void 0;
|
|
33
|
-
(function(InstrumentType) {
|
|
34
|
-
InstrumentType["COUNTER"] = "COUNTER";
|
|
35
|
-
InstrumentType["GAUGE"] = "GAUGE";
|
|
36
|
-
InstrumentType["HISTOGRAM"] = "HISTOGRAM";
|
|
37
|
-
InstrumentType["UP_DOWN_COUNTER"] = "UP_DOWN_COUNTER";
|
|
38
|
-
InstrumentType["OBSERVABLE_COUNTER"] = "OBSERVABLE_COUNTER";
|
|
39
|
-
InstrumentType["OBSERVABLE_GAUGE"] = "OBSERVABLE_GAUGE";
|
|
40
|
-
InstrumentType["OBSERVABLE_UP_DOWN_COUNTER"] = "OBSERVABLE_UP_DOWN_COUNTER";
|
|
41
|
-
})(exports.InstrumentType || (exports.InstrumentType = {}));
|
|
42
|
-
(function(DataPointType) {
|
|
43
|
-
/**
|
|
44
|
-
* A histogram data point contains a histogram statistics of collected
|
|
45
|
-
* values with a list of explicit bucket boundaries and statistics such
|
|
46
|
-
* as min, max, count, and sum of all collected values.
|
|
47
|
-
*/
|
|
48
|
-
DataPointType[DataPointType["HISTOGRAM"] = 0] = "HISTOGRAM";
|
|
49
|
-
/**
|
|
50
|
-
* An exponential histogram data point contains a histogram statistics of
|
|
51
|
-
* collected values where bucket boundaries are automatically calculated
|
|
52
|
-
* using an exponential function, and statistics such as min, max, count,
|
|
53
|
-
* and sum of all collected values.
|
|
54
|
-
*/
|
|
55
|
-
DataPointType[DataPointType["EXPONENTIAL_HISTOGRAM"] = 1] = "EXPONENTIAL_HISTOGRAM";
|
|
56
|
-
/**
|
|
57
|
-
* A gauge metric data point has only a single numeric value.
|
|
58
|
-
*/
|
|
59
|
-
DataPointType[DataPointType["GAUGE"] = 2] = "GAUGE";
|
|
60
|
-
/**
|
|
61
|
-
* A sum metric data point has a single numeric value and a
|
|
62
|
-
* monotonicity-indicator.
|
|
63
|
-
*/
|
|
64
|
-
DataPointType[DataPointType["SUM"] = 3] = "SUM";
|
|
65
|
-
})(exports.DataPointType || (exports.DataPointType = {}));
|
|
66
|
-
}));
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/utils.js
|
|
69
|
-
var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
70
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
-
exports.equalsCaseInsensitive = exports.binarySearchUB = exports.setEquals = exports.callWithTimeout = exports.TimeoutError = exports.instrumentationScopeId = exports.hashAttributes = void 0;
|
|
72
|
-
/**
|
|
73
|
-
* Converting the unordered attributes into unique identifier string.
|
|
74
|
-
* @param attributes user provided unordered Attributes.
|
|
75
|
-
*/
|
|
76
|
-
function hashAttributes(attributes) {
|
|
77
|
-
let keys = Object.keys(attributes);
|
|
78
|
-
if (keys.length === 0) return "";
|
|
79
|
-
keys = keys.sort();
|
|
80
|
-
return JSON.stringify(keys.map((key) => [key, attributes[key]]));
|
|
81
|
-
}
|
|
82
|
-
exports.hashAttributes = hashAttributes;
|
|
83
|
-
/**
|
|
84
|
-
* Converting the instrumentation scope object to a unique identifier string.
|
|
85
|
-
* @param instrumentationScope
|
|
86
|
-
*/
|
|
87
|
-
function instrumentationScopeId(instrumentationScope) {
|
|
88
|
-
return `${instrumentationScope.name}:${instrumentationScope.version ?? ""}:${instrumentationScope.schemaUrl ?? ""}`;
|
|
89
|
-
}
|
|
90
|
-
exports.instrumentationScopeId = instrumentationScopeId;
|
|
91
|
-
/**
|
|
92
|
-
* Error that is thrown on timeouts.
|
|
93
|
-
*/
|
|
94
|
-
var TimeoutError = class TimeoutError extends Error {
|
|
95
|
-
constructor(message) {
|
|
96
|
-
super(message);
|
|
97
|
-
Object.setPrototypeOf(this, TimeoutError.prototype);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
exports.TimeoutError = TimeoutError;
|
|
101
|
-
/**
|
|
102
|
-
* Adds a timeout to a promise and rejects if the specified timeout has elapsed. Also rejects if the specified promise
|
|
103
|
-
* rejects, and resolves if the specified promise resolves.
|
|
104
|
-
*
|
|
105
|
-
* <p> NOTE: this operation will continue even after it throws a {@link TimeoutError}.
|
|
106
|
-
*
|
|
107
|
-
* @param promise promise to use with timeout.
|
|
108
|
-
* @param timeout the timeout in milliseconds until the returned promise is rejected.
|
|
109
|
-
*/
|
|
110
|
-
function callWithTimeout(promise, timeout) {
|
|
111
|
-
let timeoutHandle;
|
|
112
|
-
const timeoutPromise = new Promise(function timeoutFunction(_resolve, reject) {
|
|
113
|
-
timeoutHandle = setTimeout(function timeoutHandler() {
|
|
114
|
-
reject(new TimeoutError("Operation timed out."));
|
|
115
|
-
}, timeout);
|
|
116
|
-
});
|
|
117
|
-
return Promise.race([promise, timeoutPromise]).then((result) => {
|
|
118
|
-
clearTimeout(timeoutHandle);
|
|
119
|
-
return result;
|
|
120
|
-
}, (reason) => {
|
|
121
|
-
clearTimeout(timeoutHandle);
|
|
122
|
-
throw reason;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
exports.callWithTimeout = callWithTimeout;
|
|
126
|
-
function setEquals(lhs, rhs) {
|
|
127
|
-
if (lhs.size !== rhs.size) return false;
|
|
128
|
-
for (const item of lhs) if (!rhs.has(item)) return false;
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
exports.setEquals = setEquals;
|
|
132
|
-
/**
|
|
133
|
-
* Binary search the sorted array to the find upper bound for the value.
|
|
134
|
-
* @param arr
|
|
135
|
-
* @param value
|
|
136
|
-
* @returns
|
|
137
|
-
*/
|
|
138
|
-
function binarySearchUB(arr, value) {
|
|
139
|
-
let lo = 0;
|
|
140
|
-
let hi = arr.length - 1;
|
|
141
|
-
let ret = arr.length;
|
|
142
|
-
while (hi >= lo) {
|
|
143
|
-
const mid = lo + Math.trunc((hi - lo) / 2);
|
|
144
|
-
if (arr[mid] < value) lo = mid + 1;
|
|
145
|
-
else {
|
|
146
|
-
ret = mid;
|
|
147
|
-
hi = mid - 1;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return ret;
|
|
151
|
-
}
|
|
152
|
-
exports.binarySearchUB = binarySearchUB;
|
|
153
|
-
function equalsCaseInsensitive(lhs, rhs) {
|
|
154
|
-
return lhs.toLowerCase() === rhs.toLowerCase();
|
|
155
|
-
}
|
|
156
|
-
exports.equalsCaseInsensitive = equalsCaseInsensitive;
|
|
157
|
-
}));
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/types.js
|
|
160
|
-
var require_types$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
161
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
162
|
-
exports.AggregatorKind = void 0;
|
|
163
|
-
(function(AggregatorKind) {
|
|
164
|
-
AggregatorKind[AggregatorKind["DROP"] = 0] = "DROP";
|
|
165
|
-
AggregatorKind[AggregatorKind["SUM"] = 1] = "SUM";
|
|
166
|
-
AggregatorKind[AggregatorKind["LAST_VALUE"] = 2] = "LAST_VALUE";
|
|
167
|
-
AggregatorKind[AggregatorKind["HISTOGRAM"] = 3] = "HISTOGRAM";
|
|
168
|
-
AggregatorKind[AggregatorKind["EXPONENTIAL_HISTOGRAM"] = 4] = "EXPONENTIAL_HISTOGRAM";
|
|
169
|
-
})(exports.AggregatorKind || (exports.AggregatorKind = {}));
|
|
170
|
-
}));
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Drop.js
|
|
173
|
-
var require_Drop = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
174
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
175
|
-
exports.DropAggregator = void 0;
|
|
176
|
-
const types_1 = require_types$1();
|
|
177
|
-
/** Basic aggregator for None which keeps no recorded value. */
|
|
178
|
-
var DropAggregator = class {
|
|
179
|
-
kind = types_1.AggregatorKind.DROP;
|
|
180
|
-
createAccumulation() {}
|
|
181
|
-
merge(_previous, _delta) {}
|
|
182
|
-
diff(_previous, _current) {}
|
|
183
|
-
toMetricData(_descriptor, _aggregationTemporality, _accumulationByAttributes, _endTime) {}
|
|
184
|
-
};
|
|
185
|
-
exports.DropAggregator = DropAggregator;
|
|
186
|
-
}));
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.js
|
|
189
|
-
var require_Histogram = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
190
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
191
|
-
exports.HistogramAggregator = exports.HistogramAccumulation = void 0;
|
|
192
|
-
const types_1 = require_types$1();
|
|
193
|
-
const MetricData_1 = require_MetricData();
|
|
194
|
-
const utils_1 = require_utils$2();
|
|
195
|
-
function createNewEmptyCheckpoint(boundaries) {
|
|
196
|
-
const counts = boundaries.map(() => 0);
|
|
197
|
-
counts.push(0);
|
|
198
|
-
return {
|
|
199
|
-
buckets: {
|
|
200
|
-
boundaries,
|
|
201
|
-
counts
|
|
202
|
-
},
|
|
203
|
-
sum: 0,
|
|
204
|
-
count: 0,
|
|
205
|
-
hasMinMax: false,
|
|
206
|
-
min: Infinity,
|
|
207
|
-
max: -Infinity
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
var HistogramAccumulation = class {
|
|
211
|
-
startTime;
|
|
212
|
-
_boundaries;
|
|
213
|
-
_recordMinMax;
|
|
214
|
-
_current;
|
|
215
|
-
constructor(startTime, boundaries, recordMinMax = true, current = createNewEmptyCheckpoint(boundaries)) {
|
|
216
|
-
this.startTime = startTime;
|
|
217
|
-
this._boundaries = boundaries;
|
|
218
|
-
this._recordMinMax = recordMinMax;
|
|
219
|
-
this._current = current;
|
|
220
|
-
}
|
|
221
|
-
record(value) {
|
|
222
|
-
if (Number.isNaN(value)) return;
|
|
223
|
-
this._current.count += 1;
|
|
224
|
-
this._current.sum += value;
|
|
225
|
-
if (this._recordMinMax) {
|
|
226
|
-
this._current.min = Math.min(value, this._current.min);
|
|
227
|
-
this._current.max = Math.max(value, this._current.max);
|
|
228
|
-
this._current.hasMinMax = true;
|
|
229
|
-
}
|
|
230
|
-
const idx = (0, utils_1.binarySearchUB)(this._boundaries, value);
|
|
231
|
-
this._current.buckets.counts[idx] += 1;
|
|
232
|
-
}
|
|
233
|
-
setStartTime(startTime) {
|
|
234
|
-
this.startTime = startTime;
|
|
235
|
-
}
|
|
236
|
-
toPointValue() {
|
|
237
|
-
return this._current;
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
exports.HistogramAccumulation = HistogramAccumulation;
|
|
241
|
-
/**
|
|
242
|
-
* Basic aggregator which observes events and counts them in pre-defined buckets
|
|
243
|
-
* and provides the total sum and count of all observations.
|
|
244
|
-
*/
|
|
245
|
-
var HistogramAggregator = class {
|
|
246
|
-
kind = types_1.AggregatorKind.HISTOGRAM;
|
|
247
|
-
_boundaries;
|
|
248
|
-
_recordMinMax;
|
|
249
|
-
/**
|
|
250
|
-
* @param _boundaries sorted upper bounds of recorded values.
|
|
251
|
-
* @param _recordMinMax If set to true, min and max will be recorded. Otherwise, min and max will not be recorded.
|
|
252
|
-
*/
|
|
253
|
-
constructor(boundaries, recordMinMax) {
|
|
254
|
-
this._boundaries = boundaries;
|
|
255
|
-
this._recordMinMax = recordMinMax;
|
|
256
|
-
}
|
|
257
|
-
createAccumulation(startTime) {
|
|
258
|
-
return new HistogramAccumulation(startTime, this._boundaries, this._recordMinMax);
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Return the result of the merge of two histogram accumulations. As long as one Aggregator
|
|
262
|
-
* instance produces all Accumulations with constant boundaries we don't need to worry about
|
|
263
|
-
* merging accumulations with different boundaries.
|
|
264
|
-
*/
|
|
265
|
-
merge(previous, delta) {
|
|
266
|
-
const previousValue = previous.toPointValue();
|
|
267
|
-
const deltaValue = delta.toPointValue();
|
|
268
|
-
const previousCounts = previousValue.buckets.counts;
|
|
269
|
-
const deltaCounts = deltaValue.buckets.counts;
|
|
270
|
-
const mergedCounts = new Array(previousCounts.length);
|
|
271
|
-
for (let idx = 0; idx < previousCounts.length; idx++) mergedCounts[idx] = previousCounts[idx] + deltaCounts[idx];
|
|
272
|
-
let min = Infinity;
|
|
273
|
-
let max = -Infinity;
|
|
274
|
-
if (this._recordMinMax) {
|
|
275
|
-
if (previousValue.hasMinMax && deltaValue.hasMinMax) {
|
|
276
|
-
min = Math.min(previousValue.min, deltaValue.min);
|
|
277
|
-
max = Math.max(previousValue.max, deltaValue.max);
|
|
278
|
-
} else if (previousValue.hasMinMax) {
|
|
279
|
-
min = previousValue.min;
|
|
280
|
-
max = previousValue.max;
|
|
281
|
-
} else if (deltaValue.hasMinMax) {
|
|
282
|
-
min = deltaValue.min;
|
|
283
|
-
max = deltaValue.max;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return new HistogramAccumulation(previous.startTime, previousValue.buckets.boundaries, this._recordMinMax, {
|
|
287
|
-
buckets: {
|
|
288
|
-
boundaries: previousValue.buckets.boundaries,
|
|
289
|
-
counts: mergedCounts
|
|
290
|
-
},
|
|
291
|
-
count: previousValue.count + deltaValue.count,
|
|
292
|
-
sum: previousValue.sum + deltaValue.sum,
|
|
293
|
-
hasMinMax: this._recordMinMax && (previousValue.hasMinMax || deltaValue.hasMinMax),
|
|
294
|
-
min,
|
|
295
|
-
max
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Returns a new DELTA aggregation by comparing two cumulative measurements.
|
|
300
|
-
*/
|
|
301
|
-
diff(previous, current) {
|
|
302
|
-
const previousValue = previous.toPointValue();
|
|
303
|
-
const currentValue = current.toPointValue();
|
|
304
|
-
const previousCounts = previousValue.buckets.counts;
|
|
305
|
-
const currentCounts = currentValue.buckets.counts;
|
|
306
|
-
const diffedCounts = new Array(previousCounts.length);
|
|
307
|
-
for (let idx = 0; idx < previousCounts.length; idx++) diffedCounts[idx] = currentCounts[idx] - previousCounts[idx];
|
|
308
|
-
return new HistogramAccumulation(current.startTime, previousValue.buckets.boundaries, this._recordMinMax, {
|
|
309
|
-
buckets: {
|
|
310
|
-
boundaries: previousValue.buckets.boundaries,
|
|
311
|
-
counts: diffedCounts
|
|
312
|
-
},
|
|
313
|
-
count: currentValue.count - previousValue.count,
|
|
314
|
-
sum: currentValue.sum - previousValue.sum,
|
|
315
|
-
hasMinMax: false,
|
|
316
|
-
min: Infinity,
|
|
317
|
-
max: -Infinity
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
|
|
321
|
-
return {
|
|
322
|
-
descriptor,
|
|
323
|
-
aggregationTemporality,
|
|
324
|
-
dataPointType: MetricData_1.DataPointType.HISTOGRAM,
|
|
325
|
-
dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
|
|
326
|
-
const pointValue = accumulation.toPointValue();
|
|
327
|
-
const allowsNegativeValues = descriptor.type === MetricData_1.InstrumentType.GAUGE || descriptor.type === MetricData_1.InstrumentType.UP_DOWN_COUNTER || descriptor.type === MetricData_1.InstrumentType.OBSERVABLE_GAUGE || descriptor.type === MetricData_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;
|
|
328
|
-
return {
|
|
329
|
-
attributes,
|
|
330
|
-
startTime: accumulation.startTime,
|
|
331
|
-
endTime,
|
|
332
|
-
value: {
|
|
333
|
-
min: pointValue.hasMinMax ? pointValue.min : void 0,
|
|
334
|
-
max: pointValue.hasMinMax ? pointValue.max : void 0,
|
|
335
|
-
sum: !allowsNegativeValues ? pointValue.sum : void 0,
|
|
336
|
-
buckets: pointValue.buckets,
|
|
337
|
-
count: pointValue.count
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
})
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
exports.HistogramAggregator = HistogramAggregator;
|
|
345
|
-
}));
|
|
346
|
-
//#endregion
|
|
347
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/Buckets.js
|
|
348
|
-
var require_Buckets = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
349
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
350
|
-
exports.Buckets = void 0;
|
|
351
|
-
exports.Buckets = class Buckets {
|
|
352
|
-
backing;
|
|
353
|
-
indexBase;
|
|
354
|
-
indexStart;
|
|
355
|
-
indexEnd;
|
|
356
|
-
/**
|
|
357
|
-
* The term index refers to the number of the exponential histogram bucket
|
|
358
|
-
* used to determine its boundaries. The lower boundary of a bucket is
|
|
359
|
-
* determined by base ** index and the upper boundary of a bucket is
|
|
360
|
-
* determined by base ** (index + 1). index values are signed to account
|
|
361
|
-
* for values less than or equal to 1.
|
|
362
|
-
*
|
|
363
|
-
* indexBase is the index of the 0th position in the
|
|
364
|
-
* backing array, i.e., backing[0] is the count
|
|
365
|
-
* in the bucket with index `indexBase`.
|
|
366
|
-
*
|
|
367
|
-
* indexStart is the smallest index value represented
|
|
368
|
-
* in the backing array.
|
|
369
|
-
*
|
|
370
|
-
* indexEnd is the largest index value represented in
|
|
371
|
-
* the backing array.
|
|
372
|
-
*/
|
|
373
|
-
constructor(backing = new BucketsBacking(), indexBase = 0, indexStart = 0, indexEnd = 0) {
|
|
374
|
-
this.backing = backing;
|
|
375
|
-
this.indexBase = indexBase;
|
|
376
|
-
this.indexStart = indexStart;
|
|
377
|
-
this.indexEnd = indexEnd;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Offset is the bucket index of the smallest entry in the counts array
|
|
381
|
-
* @returns {number}
|
|
382
|
-
*/
|
|
383
|
-
get offset() {
|
|
384
|
-
return this.indexStart;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Buckets is a view into the backing array.
|
|
388
|
-
* @returns {number}
|
|
389
|
-
*/
|
|
390
|
-
get length() {
|
|
391
|
-
if (this.backing.length === 0) return 0;
|
|
392
|
-
if (this.indexEnd === this.indexStart && this.at(0) === 0) return 0;
|
|
393
|
-
return this.indexEnd - this.indexStart + 1;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* An array of counts, where count[i] carries the count
|
|
397
|
-
* of the bucket at index (offset+i). count[i] is the count of
|
|
398
|
-
* values greater than base^(offset+i) and less than or equal to
|
|
399
|
-
* base^(offset+i+1).
|
|
400
|
-
* @returns {number} The logical counts based on the backing array
|
|
401
|
-
*/
|
|
402
|
-
counts() {
|
|
403
|
-
return Array.from({ length: this.length }, (_, i) => this.at(i));
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* At returns the count of the bucket at a position in the logical
|
|
407
|
-
* array of counts.
|
|
408
|
-
* @param position
|
|
409
|
-
* @returns {number}
|
|
410
|
-
*/
|
|
411
|
-
at(position) {
|
|
412
|
-
const bias = this.indexBase - this.indexStart;
|
|
413
|
-
if (position < bias) position += this.backing.length;
|
|
414
|
-
position -= bias;
|
|
415
|
-
return this.backing.countAt(position);
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* incrementBucket increments the backing array index by `increment`
|
|
419
|
-
* @param bucketIndex
|
|
420
|
-
* @param increment
|
|
421
|
-
*/
|
|
422
|
-
incrementBucket(bucketIndex, increment) {
|
|
423
|
-
this.backing.increment(bucketIndex, increment);
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* decrementBucket decrements the backing array index by `decrement`
|
|
427
|
-
* if decrement is greater than the current value, it's set to 0.
|
|
428
|
-
* @param bucketIndex
|
|
429
|
-
* @param decrement
|
|
430
|
-
*/
|
|
431
|
-
decrementBucket(bucketIndex, decrement) {
|
|
432
|
-
this.backing.decrement(bucketIndex, decrement);
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* trim removes leading and / or trailing zero buckets (which can occur
|
|
436
|
-
* after diffing two histos) and rotates the backing array so that the
|
|
437
|
-
* smallest non-zero index is in the 0th position of the backing array
|
|
438
|
-
*/
|
|
439
|
-
trim() {
|
|
440
|
-
for (let i = 0; i < this.length; i++) if (this.at(i) !== 0) {
|
|
441
|
-
this.indexStart += i;
|
|
442
|
-
break;
|
|
443
|
-
} else if (i === this.length - 1) {
|
|
444
|
-
this.indexStart = this.indexEnd = this.indexBase = 0;
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
for (let i = this.length - 1; i >= 0; i--) if (this.at(i) !== 0) {
|
|
448
|
-
this.indexEnd -= this.length - i - 1;
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
this._rotate();
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* downscale first rotates, then collapses 2**`by`-to-1 buckets.
|
|
455
|
-
* @param by
|
|
456
|
-
*/
|
|
457
|
-
downscale(by) {
|
|
458
|
-
this._rotate();
|
|
459
|
-
const size = 1 + this.indexEnd - this.indexStart;
|
|
460
|
-
const each = 1 << by;
|
|
461
|
-
let inpos = 0;
|
|
462
|
-
let outpos = 0;
|
|
463
|
-
for (let pos = this.indexStart; pos <= this.indexEnd;) {
|
|
464
|
-
let mod = pos % each;
|
|
465
|
-
if (mod < 0) mod += each;
|
|
466
|
-
for (let i = mod; i < each && inpos < size; i++) {
|
|
467
|
-
this._relocateBucket(outpos, inpos);
|
|
468
|
-
inpos++;
|
|
469
|
-
pos++;
|
|
470
|
-
}
|
|
471
|
-
outpos++;
|
|
472
|
-
}
|
|
473
|
-
this.indexStart >>= by;
|
|
474
|
-
this.indexEnd >>= by;
|
|
475
|
-
this.indexBase = this.indexStart;
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Clone returns a deep copy of Buckets
|
|
479
|
-
* @returns {Buckets}
|
|
480
|
-
*/
|
|
481
|
-
clone() {
|
|
482
|
-
return new Buckets(this.backing.clone(), this.indexBase, this.indexStart, this.indexEnd);
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* _rotate shifts the backing array contents so that indexStart ==
|
|
486
|
-
* indexBase to simplify the downscale logic.
|
|
487
|
-
*/
|
|
488
|
-
_rotate() {
|
|
489
|
-
const bias = this.indexBase - this.indexStart;
|
|
490
|
-
if (bias === 0) return;
|
|
491
|
-
else if (bias > 0) {
|
|
492
|
-
this.backing.reverse(0, this.backing.length);
|
|
493
|
-
this.backing.reverse(0, bias);
|
|
494
|
-
this.backing.reverse(bias, this.backing.length);
|
|
495
|
-
} else {
|
|
496
|
-
this.backing.reverse(0, this.backing.length);
|
|
497
|
-
this.backing.reverse(0, this.backing.length + bias);
|
|
498
|
-
}
|
|
499
|
-
this.indexBase = this.indexStart;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* _relocateBucket adds the count in counts[src] to counts[dest] and
|
|
503
|
-
* resets count[src] to zero.
|
|
504
|
-
*/
|
|
505
|
-
_relocateBucket(dest, src) {
|
|
506
|
-
if (dest === src) return;
|
|
507
|
-
this.incrementBucket(dest, this.backing.emptyBucket(src));
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
/**
|
|
511
|
-
* BucketsBacking holds the raw buckets and some utility methods to
|
|
512
|
-
* manage them.
|
|
513
|
-
*/
|
|
514
|
-
var BucketsBacking = class BucketsBacking {
|
|
515
|
-
_counts;
|
|
516
|
-
constructor(counts = [0]) {
|
|
517
|
-
this._counts = counts;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* length returns the physical size of the backing array, which
|
|
521
|
-
* is >= buckets.length()
|
|
522
|
-
*/
|
|
523
|
-
get length() {
|
|
524
|
-
return this._counts.length;
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* countAt returns the count in a specific bucket
|
|
528
|
-
*/
|
|
529
|
-
countAt(pos) {
|
|
530
|
-
return this._counts[pos];
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* growTo grows a backing array and copies old entries
|
|
534
|
-
* into their correct new positions.
|
|
535
|
-
*/
|
|
536
|
-
growTo(newSize, oldPositiveLimit, newPositiveLimit) {
|
|
537
|
-
const tmp = new Array(newSize).fill(0);
|
|
538
|
-
tmp.splice(newPositiveLimit, this._counts.length - oldPositiveLimit, ...this._counts.slice(oldPositiveLimit));
|
|
539
|
-
tmp.splice(0, oldPositiveLimit, ...this._counts.slice(0, oldPositiveLimit));
|
|
540
|
-
this._counts = tmp;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* reverse the items in the backing array in the range [from, limit).
|
|
544
|
-
*/
|
|
545
|
-
reverse(from, limit) {
|
|
546
|
-
const num = Math.floor((from + limit) / 2) - from;
|
|
547
|
-
for (let i = 0; i < num; i++) {
|
|
548
|
-
const tmp = this._counts[from + i];
|
|
549
|
-
this._counts[from + i] = this._counts[limit - i - 1];
|
|
550
|
-
this._counts[limit - i - 1] = tmp;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* emptyBucket empties the count from a bucket, for
|
|
555
|
-
* moving into another.
|
|
556
|
-
*/
|
|
557
|
-
emptyBucket(src) {
|
|
558
|
-
const tmp = this._counts[src];
|
|
559
|
-
this._counts[src] = 0;
|
|
560
|
-
return tmp;
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* increments a bucket by `increment`
|
|
564
|
-
*/
|
|
565
|
-
increment(bucketIndex, increment) {
|
|
566
|
-
this._counts[bucketIndex] += increment;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* decrements a bucket by `decrement`
|
|
570
|
-
*/
|
|
571
|
-
decrement(bucketIndex, decrement) {
|
|
572
|
-
if (this._counts[bucketIndex] >= decrement) this._counts[bucketIndex] -= decrement;
|
|
573
|
-
else this._counts[bucketIndex] = 0;
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* clone returns a deep copy of BucketsBacking
|
|
577
|
-
*/
|
|
578
|
-
clone() {
|
|
579
|
-
return new BucketsBacking([...this._counts]);
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
|
-
}));
|
|
583
|
-
//#endregion
|
|
584
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/mapping/ieee754.js
|
|
585
|
-
var require_ieee754 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
586
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
587
|
-
exports.getSignificand = exports.getNormalBase2 = exports.MIN_VALUE = exports.MAX_NORMAL_EXPONENT = exports.MIN_NORMAL_EXPONENT = exports.SIGNIFICAND_WIDTH = void 0;
|
|
588
|
-
/**
|
|
589
|
-
* The functions and constants in this file allow us to interact
|
|
590
|
-
* with the internal representation of an IEEE 64-bit floating point
|
|
591
|
-
* number. We need to work with all 64-bits, thus, care needs to be
|
|
592
|
-
* taken when working with Javascript's bitwise operators (<<, >>, &,
|
|
593
|
-
* |, etc) as they truncate operands to 32-bits. In order to work around
|
|
594
|
-
* this we work with the 64-bits as two 32-bit halves, perform bitwise
|
|
595
|
-
* operations on them independently, and combine the results (if needed).
|
|
596
|
-
*/
|
|
597
|
-
exports.SIGNIFICAND_WIDTH = 52;
|
|
598
|
-
/**
|
|
599
|
-
* EXPONENT_MASK is set to 1 for the hi 32-bits of an IEEE 754
|
|
600
|
-
* floating point exponent: 0x7ff00000.
|
|
601
|
-
*/
|
|
602
|
-
const EXPONENT_MASK = 2146435072;
|
|
603
|
-
/**
|
|
604
|
-
* SIGNIFICAND_MASK is the mask for the significand portion of the hi 32-bits
|
|
605
|
-
* of an IEEE 754 double-precision floating-point value: 0xfffff
|
|
606
|
-
*/
|
|
607
|
-
const SIGNIFICAND_MASK = 1048575;
|
|
608
|
-
/**
|
|
609
|
-
* EXPONENT_BIAS is the exponent bias specified for encoding
|
|
610
|
-
* the IEEE 754 double-precision floating point exponent: 1023
|
|
611
|
-
*/
|
|
612
|
-
const EXPONENT_BIAS = 1023;
|
|
613
|
-
/**
|
|
614
|
-
* MIN_NORMAL_EXPONENT is the minimum exponent of a normalized
|
|
615
|
-
* floating point: -1022.
|
|
616
|
-
*/
|
|
617
|
-
exports.MIN_NORMAL_EXPONENT = -EXPONENT_BIAS + 1;
|
|
618
|
-
/**
|
|
619
|
-
* MAX_NORMAL_EXPONENT is the maximum exponent of a normalized
|
|
620
|
-
* floating point: 1023.
|
|
621
|
-
*/
|
|
622
|
-
exports.MAX_NORMAL_EXPONENT = EXPONENT_BIAS;
|
|
623
|
-
/**
|
|
624
|
-
* MIN_VALUE is the smallest normal number
|
|
625
|
-
*/
|
|
626
|
-
exports.MIN_VALUE = Math.pow(2, -1022);
|
|
627
|
-
/**
|
|
628
|
-
* getNormalBase2 extracts the normalized base-2 fractional exponent.
|
|
629
|
-
* This returns k for the equation f x 2**k where f is
|
|
630
|
-
* in the range [1, 2). Note that this function is not called for
|
|
631
|
-
* subnormal numbers.
|
|
632
|
-
* @param {number} value - the value to determine normalized base-2 fractional
|
|
633
|
-
* exponent for
|
|
634
|
-
* @returns {number} the normalized base-2 exponent
|
|
635
|
-
*/
|
|
636
|
-
function getNormalBase2(value) {
|
|
637
|
-
const dv = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
638
|
-
dv.setFloat64(0, value);
|
|
639
|
-
return ((dv.getUint32(0) & EXPONENT_MASK) >> 20) - EXPONENT_BIAS;
|
|
640
|
-
}
|
|
641
|
-
exports.getNormalBase2 = getNormalBase2;
|
|
642
|
-
/**
|
|
643
|
-
* GetSignificand returns the 52 bit (unsigned) significand as a signed value.
|
|
644
|
-
* @param {number} value - the floating point number to extract the significand from
|
|
645
|
-
* @returns {number} The 52-bit significand
|
|
646
|
-
*/
|
|
647
|
-
function getSignificand(value) {
|
|
648
|
-
const dv = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
649
|
-
dv.setFloat64(0, value);
|
|
650
|
-
const hiBits = dv.getUint32(0);
|
|
651
|
-
const loBits = dv.getUint32(4);
|
|
652
|
-
return (hiBits & SIGNIFICAND_MASK) * Math.pow(2, 32) + loBits;
|
|
653
|
-
}
|
|
654
|
-
exports.getSignificand = getSignificand;
|
|
655
|
-
}));
|
|
656
|
-
//#endregion
|
|
657
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/util.js
|
|
658
|
-
var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
659
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
660
|
-
exports.nextGreaterSquare = exports.ldexp = void 0;
|
|
661
|
-
/**
|
|
662
|
-
* Note: other languages provide this as a built in function. This is
|
|
663
|
-
* a naive, but functionally correct implementation. This is used sparingly,
|
|
664
|
-
* when creating a new mapping in a running application.
|
|
665
|
-
*
|
|
666
|
-
* ldexp returns frac × 2**exp. With the following special cases:
|
|
667
|
-
* ldexp(±0, exp) = ±0
|
|
668
|
-
* ldexp(±Inf, exp) = ±Inf
|
|
669
|
-
* ldexp(NaN, exp) = NaN
|
|
670
|
-
* @param frac
|
|
671
|
-
* @param exp
|
|
672
|
-
* @returns {number}
|
|
673
|
-
*/
|
|
674
|
-
function ldexp(frac, exp) {
|
|
675
|
-
if (frac === 0 || frac === Number.POSITIVE_INFINITY || frac === Number.NEGATIVE_INFINITY || Number.isNaN(frac)) return frac;
|
|
676
|
-
return frac * Math.pow(2, exp);
|
|
677
|
-
}
|
|
678
|
-
exports.ldexp = ldexp;
|
|
679
|
-
/**
|
|
680
|
-
* Computes the next power of two that is greater than or equal to v.
|
|
681
|
-
* This implementation more efficient than, but functionally equivalent
|
|
682
|
-
* to Math.pow(2, Math.ceil(Math.log(x)/Math.log(2))).
|
|
683
|
-
* @param v
|
|
684
|
-
* @returns {number}
|
|
685
|
-
*/
|
|
686
|
-
function nextGreaterSquare(v) {
|
|
687
|
-
v--;
|
|
688
|
-
v |= v >> 1;
|
|
689
|
-
v |= v >> 2;
|
|
690
|
-
v |= v >> 4;
|
|
691
|
-
v |= v >> 8;
|
|
692
|
-
v |= v >> 16;
|
|
693
|
-
v++;
|
|
694
|
-
return v;
|
|
695
|
-
}
|
|
696
|
-
exports.nextGreaterSquare = nextGreaterSquare;
|
|
697
|
-
}));
|
|
698
|
-
//#endregion
|
|
699
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/mapping/types.js
|
|
700
|
-
var require_types = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
701
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
702
|
-
exports.MappingError = void 0;
|
|
703
|
-
var MappingError = class extends Error {};
|
|
704
|
-
exports.MappingError = MappingError;
|
|
705
|
-
}));
|
|
706
|
-
//#endregion
|
|
707
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/mapping/ExponentMapping.js
|
|
708
|
-
var require_ExponentMapping = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
709
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
710
|
-
exports.ExponentMapping = void 0;
|
|
711
|
-
const ieee754 = require_ieee754();
|
|
712
|
-
const util = require_util();
|
|
713
|
-
const types_1 = require_types();
|
|
714
|
-
/**
|
|
715
|
-
* ExponentMapping implements exponential mapping functions for
|
|
716
|
-
* scales <=0. For scales > 0 LogarithmMapping should be used.
|
|
717
|
-
*/
|
|
718
|
-
var ExponentMapping = class {
|
|
719
|
-
_shift;
|
|
720
|
-
constructor(scale) {
|
|
721
|
-
this._shift = -scale;
|
|
722
|
-
}
|
|
723
|
-
/**
|
|
724
|
-
* Maps positive floating point values to indexes corresponding to scale
|
|
725
|
-
* @param value
|
|
726
|
-
* @returns {number} index for provided value at the current scale
|
|
727
|
-
*/
|
|
728
|
-
mapToIndex(value) {
|
|
729
|
-
if (value < ieee754.MIN_VALUE) return this._minNormalLowerBoundaryIndex();
|
|
730
|
-
return ieee754.getNormalBase2(value) + this._rightShift(ieee754.getSignificand(value) - 1, ieee754.SIGNIFICAND_WIDTH) >> this._shift;
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Returns the lower bucket boundary for the given index for scale
|
|
734
|
-
*
|
|
735
|
-
* @param index
|
|
736
|
-
* @returns {number}
|
|
737
|
-
*/
|
|
738
|
-
lowerBoundary(index) {
|
|
739
|
-
const minIndex = this._minNormalLowerBoundaryIndex();
|
|
740
|
-
if (index < minIndex) throw new types_1.MappingError(`underflow: ${index} is < minimum lower boundary: ${minIndex}`);
|
|
741
|
-
const maxIndex = this._maxNormalLowerBoundaryIndex();
|
|
742
|
-
if (index > maxIndex) throw new types_1.MappingError(`overflow: ${index} is > maximum lower boundary: ${maxIndex}`);
|
|
743
|
-
return util.ldexp(1, index << this._shift);
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* The scale used by this mapping
|
|
747
|
-
* @returns {number}
|
|
748
|
-
*/
|
|
749
|
-
get scale() {
|
|
750
|
-
if (this._shift === 0) return 0;
|
|
751
|
-
return -this._shift;
|
|
752
|
-
}
|
|
753
|
-
_minNormalLowerBoundaryIndex() {
|
|
754
|
-
let index = ieee754.MIN_NORMAL_EXPONENT >> this._shift;
|
|
755
|
-
if (this._shift < 2) index--;
|
|
756
|
-
return index;
|
|
757
|
-
}
|
|
758
|
-
_maxNormalLowerBoundaryIndex() {
|
|
759
|
-
return ieee754.MAX_NORMAL_EXPONENT >> this._shift;
|
|
760
|
-
}
|
|
761
|
-
_rightShift(value, shift) {
|
|
762
|
-
return Math.floor(value * Math.pow(2, -shift));
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
exports.ExponentMapping = ExponentMapping;
|
|
766
|
-
}));
|
|
767
|
-
//#endregion
|
|
768
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/mapping/LogarithmMapping.js
|
|
769
|
-
var require_LogarithmMapping = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
770
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
771
|
-
exports.LogarithmMapping = void 0;
|
|
772
|
-
const ieee754 = require_ieee754();
|
|
773
|
-
const util = require_util();
|
|
774
|
-
const types_1 = require_types();
|
|
775
|
-
/**
|
|
776
|
-
* LogarithmMapping implements exponential mapping functions for scale > 0.
|
|
777
|
-
* For scales <= 0 the exponent mapping should be used.
|
|
778
|
-
*/
|
|
779
|
-
var LogarithmMapping = class {
|
|
780
|
-
_scale;
|
|
781
|
-
_scaleFactor;
|
|
782
|
-
_inverseFactor;
|
|
783
|
-
constructor(scale) {
|
|
784
|
-
this._scale = scale;
|
|
785
|
-
this._scaleFactor = util.ldexp(Math.LOG2E, scale);
|
|
786
|
-
this._inverseFactor = util.ldexp(Math.LN2, -scale);
|
|
787
|
-
}
|
|
788
|
-
/**
|
|
789
|
-
* Maps positive floating point values to indexes corresponding to scale
|
|
790
|
-
* @param value
|
|
791
|
-
* @returns {number} index for provided value at the current scale
|
|
792
|
-
*/
|
|
793
|
-
mapToIndex(value) {
|
|
794
|
-
if (value <= ieee754.MIN_VALUE) return this._minNormalLowerBoundaryIndex() - 1;
|
|
795
|
-
if (ieee754.getSignificand(value) === 0) return (ieee754.getNormalBase2(value) << this._scale) - 1;
|
|
796
|
-
const index = Math.floor(Math.log(value) * this._scaleFactor);
|
|
797
|
-
const maxIndex = this._maxNormalLowerBoundaryIndex();
|
|
798
|
-
if (index >= maxIndex) return maxIndex;
|
|
799
|
-
return index;
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* Returns the lower bucket boundary for the given index for scale
|
|
803
|
-
*
|
|
804
|
-
* @param index
|
|
805
|
-
* @returns {number}
|
|
806
|
-
*/
|
|
807
|
-
lowerBoundary(index) {
|
|
808
|
-
const maxIndex = this._maxNormalLowerBoundaryIndex();
|
|
809
|
-
if (index >= maxIndex) {
|
|
810
|
-
if (index === maxIndex) return 2 * Math.exp((index - (1 << this._scale)) / this._scaleFactor);
|
|
811
|
-
throw new types_1.MappingError(`overflow: ${index} is > maximum lower boundary: ${maxIndex}`);
|
|
812
|
-
}
|
|
813
|
-
const minIndex = this._minNormalLowerBoundaryIndex();
|
|
814
|
-
if (index <= minIndex) {
|
|
815
|
-
if (index === minIndex) return ieee754.MIN_VALUE;
|
|
816
|
-
else if (index === minIndex - 1) return Math.exp((index + (1 << this._scale)) / this._scaleFactor) / 2;
|
|
817
|
-
throw new types_1.MappingError(`overflow: ${index} is < minimum lower boundary: ${minIndex}`);
|
|
818
|
-
}
|
|
819
|
-
return Math.exp(index * this._inverseFactor);
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* The scale used by this mapping
|
|
823
|
-
* @returns {number}
|
|
824
|
-
*/
|
|
825
|
-
get scale() {
|
|
826
|
-
return this._scale;
|
|
827
|
-
}
|
|
828
|
-
_minNormalLowerBoundaryIndex() {
|
|
829
|
-
return ieee754.MIN_NORMAL_EXPONENT << this._scale;
|
|
830
|
-
}
|
|
831
|
-
_maxNormalLowerBoundaryIndex() {
|
|
832
|
-
return (ieee754.MAX_NORMAL_EXPONENT + 1 << this._scale) - 1;
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
exports.LogarithmMapping = LogarithmMapping;
|
|
836
|
-
}));
|
|
837
|
-
//#endregion
|
|
838
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/mapping/getMapping.js
|
|
839
|
-
var require_getMapping = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
840
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
841
|
-
exports.getMapping = void 0;
|
|
842
|
-
const ExponentMapping_1 = require_ExponentMapping();
|
|
843
|
-
const LogarithmMapping_1 = require_LogarithmMapping();
|
|
844
|
-
const types_1 = require_types();
|
|
845
|
-
const MIN_SCALE = -10;
|
|
846
|
-
const MAX_SCALE = 20;
|
|
847
|
-
const PREBUILT_MAPPINGS = Array.from({ length: 31 }, (_, i) => {
|
|
848
|
-
if (i > 10) return new LogarithmMapping_1.LogarithmMapping(i - 10);
|
|
849
|
-
return new ExponentMapping_1.ExponentMapping(i - 10);
|
|
850
|
-
});
|
|
851
|
-
/**
|
|
852
|
-
* getMapping returns an appropriate mapping for the given scale. For scales -10
|
|
853
|
-
* to 0 the underlying type will be ExponentMapping. For scales 1 to 20 the
|
|
854
|
-
* underlying type will be LogarithmMapping.
|
|
855
|
-
* @param scale a number in the range [-10, 20]
|
|
856
|
-
* @returns {Mapping}
|
|
857
|
-
*/
|
|
858
|
-
function getMapping(scale) {
|
|
859
|
-
if (scale > MAX_SCALE || scale < MIN_SCALE) throw new types_1.MappingError(`expected scale >= ${MIN_SCALE} && <= ${MAX_SCALE}, got: ${scale}`);
|
|
860
|
-
return PREBUILT_MAPPINGS[scale + 10];
|
|
861
|
-
}
|
|
862
|
-
exports.getMapping = getMapping;
|
|
863
|
-
}));
|
|
864
|
-
//#endregion
|
|
865
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.js
|
|
866
|
-
var require_ExponentialHistogram = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
867
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
868
|
-
exports.ExponentialHistogramAggregator = exports.ExponentialHistogramAccumulation = void 0;
|
|
869
|
-
const types_1 = require_types$1();
|
|
870
|
-
const MetricData_1 = require_MetricData();
|
|
871
|
-
const api_1$9 = __require("@opentelemetry/api");
|
|
872
|
-
const Buckets_1 = require_Buckets();
|
|
873
|
-
const getMapping_1 = require_getMapping();
|
|
874
|
-
const util_1 = require_util();
|
|
875
|
-
var HighLow = class HighLow {
|
|
876
|
-
static combine(h1, h2) {
|
|
877
|
-
return new HighLow(Math.min(h1.low, h2.low), Math.max(h1.high, h2.high));
|
|
878
|
-
}
|
|
879
|
-
low;
|
|
880
|
-
high;
|
|
881
|
-
constructor(low, high) {
|
|
882
|
-
this.low = low;
|
|
883
|
-
this.high = high;
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
const MAX_SCALE = 20;
|
|
887
|
-
const DEFAULT_MAX_SIZE = 160;
|
|
888
|
-
const MIN_MAX_SIZE = 2;
|
|
889
|
-
var ExponentialHistogramAccumulation = class ExponentialHistogramAccumulation {
|
|
890
|
-
startTime;
|
|
891
|
-
_maxSize;
|
|
892
|
-
_recordMinMax;
|
|
893
|
-
_sum;
|
|
894
|
-
_count;
|
|
895
|
-
_zeroCount;
|
|
896
|
-
_min;
|
|
897
|
-
_max;
|
|
898
|
-
_positive;
|
|
899
|
-
_negative;
|
|
900
|
-
_mapping;
|
|
901
|
-
constructor(startTime, maxSize = DEFAULT_MAX_SIZE, recordMinMax = true, sum = 0, count = 0, zeroCount = 0, min = Number.POSITIVE_INFINITY, max = Number.NEGATIVE_INFINITY, positive = new Buckets_1.Buckets(), negative = new Buckets_1.Buckets(), mapping = (0, getMapping_1.getMapping)(MAX_SCALE)) {
|
|
902
|
-
this.startTime = startTime;
|
|
903
|
-
this._maxSize = maxSize;
|
|
904
|
-
this._recordMinMax = recordMinMax;
|
|
905
|
-
this._sum = sum;
|
|
906
|
-
this._count = count;
|
|
907
|
-
this._zeroCount = zeroCount;
|
|
908
|
-
this._min = min;
|
|
909
|
-
this._max = max;
|
|
910
|
-
this._positive = positive;
|
|
911
|
-
this._negative = negative;
|
|
912
|
-
this._mapping = mapping;
|
|
913
|
-
if (this._maxSize < MIN_MAX_SIZE) {
|
|
914
|
-
api_1$9.diag.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
915
|
-
changing to the minimum size of: ${MIN_MAX_SIZE}`);
|
|
916
|
-
this._maxSize = MIN_MAX_SIZE;
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* record updates a histogram with a single count
|
|
921
|
-
* @param {Number} value
|
|
922
|
-
*/
|
|
923
|
-
record(value) {
|
|
924
|
-
this.updateByIncrement(value, 1);
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* Sets the start time for this accumulation
|
|
928
|
-
* @param {HrTime} startTime
|
|
929
|
-
*/
|
|
930
|
-
setStartTime(startTime) {
|
|
931
|
-
this.startTime = startTime;
|
|
932
|
-
}
|
|
933
|
-
/**
|
|
934
|
-
* Returns the datapoint representation of this accumulation
|
|
935
|
-
* @param {HrTime} startTime
|
|
936
|
-
*/
|
|
937
|
-
toPointValue() {
|
|
938
|
-
return {
|
|
939
|
-
hasMinMax: this._recordMinMax,
|
|
940
|
-
min: this.min,
|
|
941
|
-
max: this.max,
|
|
942
|
-
sum: this.sum,
|
|
943
|
-
positive: {
|
|
944
|
-
offset: this.positive.offset,
|
|
945
|
-
bucketCounts: this.positive.counts()
|
|
946
|
-
},
|
|
947
|
-
negative: {
|
|
948
|
-
offset: this.negative.offset,
|
|
949
|
-
bucketCounts: this.negative.counts()
|
|
950
|
-
},
|
|
951
|
-
count: this.count,
|
|
952
|
-
scale: this.scale,
|
|
953
|
-
zeroCount: this.zeroCount
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* @returns {Number} The sum of values recorded by this accumulation
|
|
958
|
-
*/
|
|
959
|
-
get sum() {
|
|
960
|
-
return this._sum;
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* @returns {Number} The minimum value recorded by this accumulation
|
|
964
|
-
*/
|
|
965
|
-
get min() {
|
|
966
|
-
return this._min;
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* @returns {Number} The maximum value recorded by this accumulation
|
|
970
|
-
*/
|
|
971
|
-
get max() {
|
|
972
|
-
return this._max;
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* @returns {Number} The count of values recorded by this accumulation
|
|
976
|
-
*/
|
|
977
|
-
get count() {
|
|
978
|
-
return this._count;
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* @returns {Number} The number of 0 values recorded by this accumulation
|
|
982
|
-
*/
|
|
983
|
-
get zeroCount() {
|
|
984
|
-
return this._zeroCount;
|
|
985
|
-
}
|
|
986
|
-
/**
|
|
987
|
-
* @returns {Number} The scale used by this accumulation
|
|
988
|
-
*/
|
|
989
|
-
get scale() {
|
|
990
|
-
if (this._count === this._zeroCount) return 0;
|
|
991
|
-
return this._mapping.scale;
|
|
992
|
-
}
|
|
993
|
-
/**
|
|
994
|
-
* positive holds the positive values
|
|
995
|
-
* @returns {Buckets}
|
|
996
|
-
*/
|
|
997
|
-
get positive() {
|
|
998
|
-
return this._positive;
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* negative holds the negative values by their absolute value
|
|
1002
|
-
* @returns {Buckets}
|
|
1003
|
-
*/
|
|
1004
|
-
get negative() {
|
|
1005
|
-
return this._negative;
|
|
1006
|
-
}
|
|
1007
|
-
/**
|
|
1008
|
-
* updateByIncr supports updating a histogram with a non-negative
|
|
1009
|
-
* increment.
|
|
1010
|
-
* @param value
|
|
1011
|
-
* @param increment
|
|
1012
|
-
*/
|
|
1013
|
-
updateByIncrement(value, increment) {
|
|
1014
|
-
if (Number.isNaN(value)) return;
|
|
1015
|
-
if (value > this._max) this._max = value;
|
|
1016
|
-
if (value < this._min) this._min = value;
|
|
1017
|
-
this._count += increment;
|
|
1018
|
-
if (value === 0) {
|
|
1019
|
-
this._zeroCount += increment;
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
this._sum += value * increment;
|
|
1023
|
-
if (value > 0) this._updateBuckets(this._positive, value, increment);
|
|
1024
|
-
else this._updateBuckets(this._negative, -value, increment);
|
|
1025
|
-
}
|
|
1026
|
-
/**
|
|
1027
|
-
* merge combines data from previous value into self
|
|
1028
|
-
* @param {ExponentialHistogramAccumulation} previous
|
|
1029
|
-
*/
|
|
1030
|
-
merge(previous) {
|
|
1031
|
-
if (this._count === 0) {
|
|
1032
|
-
this._min = previous.min;
|
|
1033
|
-
this._max = previous.max;
|
|
1034
|
-
} else if (previous.count !== 0) {
|
|
1035
|
-
if (previous.min < this.min) this._min = previous.min;
|
|
1036
|
-
if (previous.max > this.max) this._max = previous.max;
|
|
1037
|
-
}
|
|
1038
|
-
this.startTime = previous.startTime;
|
|
1039
|
-
this._sum += previous.sum;
|
|
1040
|
-
this._count += previous.count;
|
|
1041
|
-
this._zeroCount += previous.zeroCount;
|
|
1042
|
-
const minScale = this._minScale(previous);
|
|
1043
|
-
this._downscale(this.scale - minScale);
|
|
1044
|
-
this._mergeBuckets(this.positive, previous, previous.positive, minScale);
|
|
1045
|
-
this._mergeBuckets(this.negative, previous, previous.negative, minScale);
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* diff subtracts other from self
|
|
1049
|
-
* @param {ExponentialHistogramAccumulation} other
|
|
1050
|
-
*/
|
|
1051
|
-
diff(other) {
|
|
1052
|
-
this._min = Infinity;
|
|
1053
|
-
this._max = -Infinity;
|
|
1054
|
-
this._sum -= other.sum;
|
|
1055
|
-
this._count -= other.count;
|
|
1056
|
-
this._zeroCount -= other.zeroCount;
|
|
1057
|
-
const minScale = this._minScale(other);
|
|
1058
|
-
this._downscale(this.scale - minScale);
|
|
1059
|
-
this._diffBuckets(this.positive, other, other.positive, minScale);
|
|
1060
|
-
this._diffBuckets(this.negative, other, other.negative, minScale);
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* clone returns a deep copy of self
|
|
1064
|
-
* @returns {ExponentialHistogramAccumulation}
|
|
1065
|
-
*/
|
|
1066
|
-
clone() {
|
|
1067
|
-
return new ExponentialHistogramAccumulation(this.startTime, this._maxSize, this._recordMinMax, this._sum, this._count, this._zeroCount, this._min, this._max, this.positive.clone(), this.negative.clone(), this._mapping);
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* _updateBuckets maps the incoming value to a bucket index for the current
|
|
1071
|
-
* scale. If the bucket index is outside of the range of the backing array,
|
|
1072
|
-
* it will rescale the backing array and update the mapping for the new scale.
|
|
1073
|
-
*/
|
|
1074
|
-
_updateBuckets(buckets, value, increment) {
|
|
1075
|
-
let index = this._mapping.mapToIndex(value);
|
|
1076
|
-
let rescalingNeeded = false;
|
|
1077
|
-
let high = 0;
|
|
1078
|
-
let low = 0;
|
|
1079
|
-
if (buckets.length === 0) {
|
|
1080
|
-
buckets.indexStart = index;
|
|
1081
|
-
buckets.indexEnd = buckets.indexStart;
|
|
1082
|
-
buckets.indexBase = buckets.indexStart;
|
|
1083
|
-
} else if (index < buckets.indexStart && buckets.indexEnd - index >= this._maxSize) {
|
|
1084
|
-
rescalingNeeded = true;
|
|
1085
|
-
low = index;
|
|
1086
|
-
high = buckets.indexEnd;
|
|
1087
|
-
} else if (index > buckets.indexEnd && index - buckets.indexStart >= this._maxSize) {
|
|
1088
|
-
rescalingNeeded = true;
|
|
1089
|
-
low = buckets.indexStart;
|
|
1090
|
-
high = index;
|
|
1091
|
-
}
|
|
1092
|
-
if (rescalingNeeded) {
|
|
1093
|
-
const change = this._changeScale(high, low);
|
|
1094
|
-
this._downscale(change);
|
|
1095
|
-
index = this._mapping.mapToIndex(value);
|
|
1096
|
-
}
|
|
1097
|
-
this._incrementIndexBy(buckets, index, increment);
|
|
1098
|
-
}
|
|
1099
|
-
/**
|
|
1100
|
-
* _incrementIndexBy increments the count of the bucket specified by `index`.
|
|
1101
|
-
* If the index is outside of the range [buckets.indexStart, buckets.indexEnd]
|
|
1102
|
-
* the boundaries of the backing array will be adjusted and more buckets will
|
|
1103
|
-
* be added if needed.
|
|
1104
|
-
*/
|
|
1105
|
-
_incrementIndexBy(buckets, index, increment) {
|
|
1106
|
-
if (increment === 0) return;
|
|
1107
|
-
if (buckets.length === 0) buckets.indexStart = buckets.indexEnd = buckets.indexBase = index;
|
|
1108
|
-
if (index < buckets.indexStart) {
|
|
1109
|
-
const span = buckets.indexEnd - index;
|
|
1110
|
-
if (span >= buckets.backing.length) this._grow(buckets, span + 1);
|
|
1111
|
-
buckets.indexStart = index;
|
|
1112
|
-
} else if (index > buckets.indexEnd) {
|
|
1113
|
-
const span = index - buckets.indexStart;
|
|
1114
|
-
if (span >= buckets.backing.length) this._grow(buckets, span + 1);
|
|
1115
|
-
buckets.indexEnd = index;
|
|
1116
|
-
}
|
|
1117
|
-
let bucketIndex = index - buckets.indexBase;
|
|
1118
|
-
if (bucketIndex < 0) bucketIndex += buckets.backing.length;
|
|
1119
|
-
buckets.incrementBucket(bucketIndex, increment);
|
|
1120
|
-
}
|
|
1121
|
-
/**
|
|
1122
|
-
* grow resizes the backing array by doubling in size up to maxSize.
|
|
1123
|
-
* This extends the array with a bunch of zeros and copies the
|
|
1124
|
-
* existing counts to the same position.
|
|
1125
|
-
*/
|
|
1126
|
-
_grow(buckets, needed) {
|
|
1127
|
-
const size = buckets.backing.length;
|
|
1128
|
-
const bias = buckets.indexBase - buckets.indexStart;
|
|
1129
|
-
const oldPositiveLimit = size - bias;
|
|
1130
|
-
let newSize = (0, util_1.nextGreaterSquare)(needed);
|
|
1131
|
-
if (newSize > this._maxSize) newSize = this._maxSize;
|
|
1132
|
-
const newPositiveLimit = newSize - bias;
|
|
1133
|
-
buckets.backing.growTo(newSize, oldPositiveLimit, newPositiveLimit);
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* _changeScale computes how much downscaling is needed by shifting the
|
|
1137
|
-
* high and low values until they are separated by no more than size.
|
|
1138
|
-
*/
|
|
1139
|
-
_changeScale(high, low) {
|
|
1140
|
-
let change = 0;
|
|
1141
|
-
while (high - low >= this._maxSize) {
|
|
1142
|
-
high >>= 1;
|
|
1143
|
-
low >>= 1;
|
|
1144
|
-
change++;
|
|
1145
|
-
}
|
|
1146
|
-
return change;
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* _downscale subtracts `change` from the current mapping scale.
|
|
1150
|
-
*/
|
|
1151
|
-
_downscale(change) {
|
|
1152
|
-
if (change === 0) return;
|
|
1153
|
-
if (change < 0) throw new Error(`impossible change of scale: ${this.scale}`);
|
|
1154
|
-
const newScale = this._mapping.scale - change;
|
|
1155
|
-
this._positive.downscale(change);
|
|
1156
|
-
this._negative.downscale(change);
|
|
1157
|
-
this._mapping = (0, getMapping_1.getMapping)(newScale);
|
|
1158
|
-
}
|
|
1159
|
-
/**
|
|
1160
|
-
* _minScale is used by diff and merge to compute an ideal combined scale
|
|
1161
|
-
*/
|
|
1162
|
-
_minScale(other) {
|
|
1163
|
-
const minScale = Math.min(this.scale, other.scale);
|
|
1164
|
-
const highLowPos = HighLow.combine(this._highLowAtScale(this.positive, this.scale, minScale), this._highLowAtScale(other.positive, other.scale, minScale));
|
|
1165
|
-
const highLowNeg = HighLow.combine(this._highLowAtScale(this.negative, this.scale, minScale), this._highLowAtScale(other.negative, other.scale, minScale));
|
|
1166
|
-
return Math.min(minScale - this._changeScale(highLowPos.high, highLowPos.low), minScale - this._changeScale(highLowNeg.high, highLowNeg.low));
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* _highLowAtScale is used by diff and merge to compute an ideal combined scale.
|
|
1170
|
-
*/
|
|
1171
|
-
_highLowAtScale(buckets, currentScale, newScale) {
|
|
1172
|
-
if (buckets.length === 0) return new HighLow(0, -1);
|
|
1173
|
-
const shift = currentScale - newScale;
|
|
1174
|
-
return new HighLow(buckets.indexStart >> shift, buckets.indexEnd >> shift);
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* _mergeBuckets translates index values from another histogram and
|
|
1178
|
-
* adds the values into the corresponding buckets of this histogram.
|
|
1179
|
-
*/
|
|
1180
|
-
_mergeBuckets(ours, other, theirs, scale) {
|
|
1181
|
-
const theirOffset = theirs.offset;
|
|
1182
|
-
const theirChange = other.scale - scale;
|
|
1183
|
-
for (let i = 0; i < theirs.length; i++) this._incrementIndexBy(ours, theirOffset + i >> theirChange, theirs.at(i));
|
|
1184
|
-
}
|
|
1185
|
-
/**
|
|
1186
|
-
* _diffBuckets translates index values from another histogram and
|
|
1187
|
-
* subtracts the values in the corresponding buckets of this histogram.
|
|
1188
|
-
*/
|
|
1189
|
-
_diffBuckets(ours, other, theirs, scale) {
|
|
1190
|
-
const theirOffset = theirs.offset;
|
|
1191
|
-
const theirChange = other.scale - scale;
|
|
1192
|
-
for (let i = 0; i < theirs.length; i++) {
|
|
1193
|
-
let bucketIndex = (theirOffset + i >> theirChange) - ours.indexBase;
|
|
1194
|
-
if (bucketIndex < 0) bucketIndex += ours.backing.length;
|
|
1195
|
-
ours.decrementBucket(bucketIndex, theirs.at(i));
|
|
1196
|
-
}
|
|
1197
|
-
ours.trim();
|
|
1198
|
-
}
|
|
1199
|
-
};
|
|
1200
|
-
exports.ExponentialHistogramAccumulation = ExponentialHistogramAccumulation;
|
|
1201
|
-
/**
|
|
1202
|
-
* Aggregator for ExponentialHistogramAccumulations
|
|
1203
|
-
*/
|
|
1204
|
-
var ExponentialHistogramAggregator = class {
|
|
1205
|
-
kind = types_1.AggregatorKind.EXPONENTIAL_HISTOGRAM;
|
|
1206
|
-
_maxSize;
|
|
1207
|
-
_recordMinMax;
|
|
1208
|
-
/**
|
|
1209
|
-
* @param _maxSize Maximum number of buckets for each of the positive
|
|
1210
|
-
* and negative ranges, exclusive of the zero-bucket.
|
|
1211
|
-
* @param _recordMinMax If set to true, min and max will be recorded.
|
|
1212
|
-
* Otherwise, min and max will not be recorded.
|
|
1213
|
-
*/
|
|
1214
|
-
constructor(maxSize, recordMinMax) {
|
|
1215
|
-
this._maxSize = maxSize;
|
|
1216
|
-
this._recordMinMax = recordMinMax;
|
|
1217
|
-
}
|
|
1218
|
-
createAccumulation(startTime) {
|
|
1219
|
-
return new ExponentialHistogramAccumulation(startTime, this._maxSize, this._recordMinMax);
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* Return the result of the merge of two exponential histogram accumulations.
|
|
1223
|
-
*/
|
|
1224
|
-
merge(previous, delta) {
|
|
1225
|
-
const result = delta.clone();
|
|
1226
|
-
result.merge(previous);
|
|
1227
|
-
return result;
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Returns a new DELTA aggregation by comparing two cumulative measurements.
|
|
1231
|
-
*/
|
|
1232
|
-
diff(previous, current) {
|
|
1233
|
-
const result = current.clone();
|
|
1234
|
-
result.diff(previous);
|
|
1235
|
-
return result;
|
|
1236
|
-
}
|
|
1237
|
-
toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
|
|
1238
|
-
return {
|
|
1239
|
-
descriptor,
|
|
1240
|
-
aggregationTemporality,
|
|
1241
|
-
dataPointType: MetricData_1.DataPointType.EXPONENTIAL_HISTOGRAM,
|
|
1242
|
-
dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
|
|
1243
|
-
const pointValue = accumulation.toPointValue();
|
|
1244
|
-
const allowsNegativeValues = descriptor.type === MetricData_1.InstrumentType.GAUGE || descriptor.type === MetricData_1.InstrumentType.UP_DOWN_COUNTER || descriptor.type === MetricData_1.InstrumentType.OBSERVABLE_GAUGE || descriptor.type === MetricData_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;
|
|
1245
|
-
return {
|
|
1246
|
-
attributes,
|
|
1247
|
-
startTime: accumulation.startTime,
|
|
1248
|
-
endTime,
|
|
1249
|
-
value: {
|
|
1250
|
-
min: pointValue.hasMinMax ? pointValue.min : void 0,
|
|
1251
|
-
max: pointValue.hasMinMax ? pointValue.max : void 0,
|
|
1252
|
-
sum: !allowsNegativeValues ? pointValue.sum : void 0,
|
|
1253
|
-
positive: {
|
|
1254
|
-
offset: pointValue.positive.offset,
|
|
1255
|
-
bucketCounts: pointValue.positive.bucketCounts
|
|
1256
|
-
},
|
|
1257
|
-
negative: {
|
|
1258
|
-
offset: pointValue.negative.offset,
|
|
1259
|
-
bucketCounts: pointValue.negative.bucketCounts
|
|
1260
|
-
},
|
|
1261
|
-
count: pointValue.count,
|
|
1262
|
-
scale: pointValue.scale,
|
|
1263
|
-
zeroCount: pointValue.zeroCount
|
|
1264
|
-
}
|
|
1265
|
-
};
|
|
1266
|
-
})
|
|
1267
|
-
};
|
|
1268
|
-
}
|
|
1269
|
-
};
|
|
1270
|
-
exports.ExponentialHistogramAggregator = ExponentialHistogramAggregator;
|
|
1271
|
-
}));
|
|
1272
|
-
//#endregion
|
|
1273
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.js
|
|
1274
|
-
var require_LastValue = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1275
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1276
|
-
exports.LastValueAggregator = exports.LastValueAccumulation = void 0;
|
|
1277
|
-
const types_1 = require_types$1();
|
|
1278
|
-
const core_1$7 = __require("@opentelemetry/core");
|
|
1279
|
-
const MetricData_1 = require_MetricData();
|
|
1280
|
-
var LastValueAccumulation = class {
|
|
1281
|
-
startTime;
|
|
1282
|
-
_current;
|
|
1283
|
-
sampleTime;
|
|
1284
|
-
constructor(startTime, current = 0, sampleTime = [0, 0]) {
|
|
1285
|
-
this.startTime = startTime;
|
|
1286
|
-
this._current = current;
|
|
1287
|
-
this.sampleTime = sampleTime;
|
|
1288
|
-
}
|
|
1289
|
-
record(value) {
|
|
1290
|
-
this._current = value;
|
|
1291
|
-
this.sampleTime = (0, core_1$7.millisToHrTime)(Date.now());
|
|
1292
|
-
}
|
|
1293
|
-
setStartTime(startTime) {
|
|
1294
|
-
this.startTime = startTime;
|
|
1295
|
-
}
|
|
1296
|
-
toPointValue() {
|
|
1297
|
-
return this._current;
|
|
1298
|
-
}
|
|
1299
|
-
};
|
|
1300
|
-
exports.LastValueAccumulation = LastValueAccumulation;
|
|
1301
|
-
/** Basic aggregator which calculates a LastValue from individual measurements. */
|
|
1302
|
-
var LastValueAggregator = class {
|
|
1303
|
-
kind = types_1.AggregatorKind.LAST_VALUE;
|
|
1304
|
-
createAccumulation(startTime) {
|
|
1305
|
-
return new LastValueAccumulation(startTime);
|
|
1306
|
-
}
|
|
1307
|
-
/**
|
|
1308
|
-
* Returns the result of the merge of the given accumulations.
|
|
1309
|
-
*
|
|
1310
|
-
* Return the newly captured (delta) accumulation for LastValueAggregator.
|
|
1311
|
-
*/
|
|
1312
|
-
merge(previous, delta) {
|
|
1313
|
-
const latestAccumulation = (0, core_1$7.hrTimeToMicroseconds)(delta.sampleTime) >= (0, core_1$7.hrTimeToMicroseconds)(previous.sampleTime) ? delta : previous;
|
|
1314
|
-
return new LastValueAccumulation(previous.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime);
|
|
1315
|
-
}
|
|
1316
|
-
/**
|
|
1317
|
-
* Returns a new DELTA aggregation by comparing two cumulative measurements.
|
|
1318
|
-
*
|
|
1319
|
-
* A delta aggregation is not meaningful to LastValueAggregator, just return
|
|
1320
|
-
* the newly captured (delta) accumulation for LastValueAggregator.
|
|
1321
|
-
*/
|
|
1322
|
-
diff(previous, current) {
|
|
1323
|
-
const latestAccumulation = (0, core_1$7.hrTimeToMicroseconds)(current.sampleTime) >= (0, core_1$7.hrTimeToMicroseconds)(previous.sampleTime) ? current : previous;
|
|
1324
|
-
return new LastValueAccumulation(current.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime);
|
|
1325
|
-
}
|
|
1326
|
-
toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
|
|
1327
|
-
return {
|
|
1328
|
-
descriptor,
|
|
1329
|
-
aggregationTemporality,
|
|
1330
|
-
dataPointType: MetricData_1.DataPointType.GAUGE,
|
|
1331
|
-
dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
|
|
1332
|
-
return {
|
|
1333
|
-
attributes,
|
|
1334
|
-
startTime: accumulation.startTime,
|
|
1335
|
-
endTime,
|
|
1336
|
-
value: accumulation.toPointValue()
|
|
1337
|
-
};
|
|
1338
|
-
})
|
|
1339
|
-
};
|
|
1340
|
-
}
|
|
1341
|
-
};
|
|
1342
|
-
exports.LastValueAggregator = LastValueAggregator;
|
|
1343
|
-
}));
|
|
1344
|
-
//#endregion
|
|
1345
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.js
|
|
1346
|
-
var require_Sum = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1347
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1348
|
-
exports.SumAggregator = exports.SumAccumulation = void 0;
|
|
1349
|
-
const types_1 = require_types$1();
|
|
1350
|
-
const MetricData_1 = require_MetricData();
|
|
1351
|
-
var SumAccumulation = class {
|
|
1352
|
-
startTime;
|
|
1353
|
-
monotonic;
|
|
1354
|
-
_current;
|
|
1355
|
-
reset;
|
|
1356
|
-
constructor(startTime, monotonic, current = 0, reset = false) {
|
|
1357
|
-
this.startTime = startTime;
|
|
1358
|
-
this.monotonic = monotonic;
|
|
1359
|
-
this._current = current;
|
|
1360
|
-
this.reset = reset;
|
|
1361
|
-
}
|
|
1362
|
-
record(value) {
|
|
1363
|
-
if (this.monotonic && value < 0) return;
|
|
1364
|
-
this._current += value;
|
|
1365
|
-
}
|
|
1366
|
-
setStartTime(startTime) {
|
|
1367
|
-
this.startTime = startTime;
|
|
1368
|
-
}
|
|
1369
|
-
toPointValue() {
|
|
1370
|
-
return this._current;
|
|
1371
|
-
}
|
|
1372
|
-
};
|
|
1373
|
-
exports.SumAccumulation = SumAccumulation;
|
|
1374
|
-
/** Basic aggregator which calculates a Sum from individual measurements. */
|
|
1375
|
-
var SumAggregator = class {
|
|
1376
|
-
kind = types_1.AggregatorKind.SUM;
|
|
1377
|
-
monotonic;
|
|
1378
|
-
constructor(monotonic) {
|
|
1379
|
-
this.monotonic = monotonic;
|
|
1380
|
-
}
|
|
1381
|
-
createAccumulation(startTime) {
|
|
1382
|
-
return new SumAccumulation(startTime, this.monotonic);
|
|
1383
|
-
}
|
|
1384
|
-
/**
|
|
1385
|
-
* Returns the result of the merge of the given accumulations.
|
|
1386
|
-
*/
|
|
1387
|
-
merge(previous, delta) {
|
|
1388
|
-
const prevPv = previous.toPointValue();
|
|
1389
|
-
const deltaPv = delta.toPointValue();
|
|
1390
|
-
if (delta.reset) return new SumAccumulation(delta.startTime, this.monotonic, deltaPv, delta.reset);
|
|
1391
|
-
return new SumAccumulation(previous.startTime, this.monotonic, prevPv + deltaPv);
|
|
1392
|
-
}
|
|
1393
|
-
/**
|
|
1394
|
-
* Returns a new DELTA aggregation by comparing two cumulative measurements.
|
|
1395
|
-
*/
|
|
1396
|
-
diff(previous, current) {
|
|
1397
|
-
const prevPv = previous.toPointValue();
|
|
1398
|
-
const currPv = current.toPointValue();
|
|
1399
|
-
/**
|
|
1400
|
-
* If the SumAggregator is a monotonic one and the previous point value is
|
|
1401
|
-
* greater than the current one, a reset is deemed to be happened.
|
|
1402
|
-
* Return the current point value to prevent the value from been reset.
|
|
1403
|
-
*/
|
|
1404
|
-
if (this.monotonic && prevPv > currPv) return new SumAccumulation(current.startTime, this.monotonic, currPv, true);
|
|
1405
|
-
return new SumAccumulation(current.startTime, this.monotonic, currPv - prevPv);
|
|
1406
|
-
}
|
|
1407
|
-
toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
|
|
1408
|
-
return {
|
|
1409
|
-
descriptor,
|
|
1410
|
-
aggregationTemporality,
|
|
1411
|
-
dataPointType: MetricData_1.DataPointType.SUM,
|
|
1412
|
-
dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
|
|
1413
|
-
return {
|
|
1414
|
-
attributes,
|
|
1415
|
-
startTime: accumulation.startTime,
|
|
1416
|
-
endTime,
|
|
1417
|
-
value: accumulation.toPointValue()
|
|
1418
|
-
};
|
|
1419
|
-
}),
|
|
1420
|
-
isMonotonic: this.monotonic
|
|
1421
|
-
};
|
|
1422
|
-
}
|
|
1423
|
-
};
|
|
1424
|
-
exports.SumAggregator = SumAggregator;
|
|
1425
|
-
}));
|
|
1426
|
-
//#endregion
|
|
1427
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/index.js
|
|
1428
|
-
var require_aggregator = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1429
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1430
|
-
exports.SumAggregator = exports.SumAccumulation = exports.LastValueAggregator = exports.LastValueAccumulation = exports.ExponentialHistogramAggregator = exports.ExponentialHistogramAccumulation = exports.HistogramAggregator = exports.HistogramAccumulation = exports.DropAggregator = void 0;
|
|
1431
|
-
var Drop_1 = require_Drop();
|
|
1432
|
-
Object.defineProperty(exports, "DropAggregator", {
|
|
1433
|
-
enumerable: true,
|
|
1434
|
-
get: function() {
|
|
1435
|
-
return Drop_1.DropAggregator;
|
|
1436
|
-
}
|
|
1437
|
-
});
|
|
1438
|
-
var Histogram_1 = require_Histogram();
|
|
1439
|
-
Object.defineProperty(exports, "HistogramAccumulation", {
|
|
1440
|
-
enumerable: true,
|
|
1441
|
-
get: function() {
|
|
1442
|
-
return Histogram_1.HistogramAccumulation;
|
|
1443
|
-
}
|
|
1444
|
-
});
|
|
1445
|
-
Object.defineProperty(exports, "HistogramAggregator", {
|
|
1446
|
-
enumerable: true,
|
|
1447
|
-
get: function() {
|
|
1448
|
-
return Histogram_1.HistogramAggregator;
|
|
1449
|
-
}
|
|
1450
|
-
});
|
|
1451
|
-
var ExponentialHistogram_1 = require_ExponentialHistogram();
|
|
1452
|
-
Object.defineProperty(exports, "ExponentialHistogramAccumulation", {
|
|
1453
|
-
enumerable: true,
|
|
1454
|
-
get: function() {
|
|
1455
|
-
return ExponentialHistogram_1.ExponentialHistogramAccumulation;
|
|
1456
|
-
}
|
|
1457
|
-
});
|
|
1458
|
-
Object.defineProperty(exports, "ExponentialHistogramAggregator", {
|
|
1459
|
-
enumerable: true,
|
|
1460
|
-
get: function() {
|
|
1461
|
-
return ExponentialHistogram_1.ExponentialHistogramAggregator;
|
|
1462
|
-
}
|
|
1463
|
-
});
|
|
1464
|
-
var LastValue_1 = require_LastValue();
|
|
1465
|
-
Object.defineProperty(exports, "LastValueAccumulation", {
|
|
1466
|
-
enumerable: true,
|
|
1467
|
-
get: function() {
|
|
1468
|
-
return LastValue_1.LastValueAccumulation;
|
|
1469
|
-
}
|
|
1470
|
-
});
|
|
1471
|
-
Object.defineProperty(exports, "LastValueAggregator", {
|
|
1472
|
-
enumerable: true,
|
|
1473
|
-
get: function() {
|
|
1474
|
-
return LastValue_1.LastValueAggregator;
|
|
1475
|
-
}
|
|
1476
|
-
});
|
|
1477
|
-
var Sum_1 = require_Sum();
|
|
1478
|
-
Object.defineProperty(exports, "SumAccumulation", {
|
|
1479
|
-
enumerable: true,
|
|
1480
|
-
get: function() {
|
|
1481
|
-
return Sum_1.SumAccumulation;
|
|
1482
|
-
}
|
|
1483
|
-
});
|
|
1484
|
-
Object.defineProperty(exports, "SumAggregator", {
|
|
1485
|
-
enumerable: true,
|
|
1486
|
-
get: function() {
|
|
1487
|
-
return Sum_1.SumAggregator;
|
|
1488
|
-
}
|
|
1489
|
-
});
|
|
1490
|
-
}));
|
|
1491
|
-
//#endregion
|
|
1492
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.js
|
|
1493
|
-
var require_Aggregation = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1494
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1495
|
-
exports.DEFAULT_AGGREGATION = exports.EXPONENTIAL_HISTOGRAM_AGGREGATION = exports.HISTOGRAM_AGGREGATION = exports.LAST_VALUE_AGGREGATION = exports.SUM_AGGREGATION = exports.DROP_AGGREGATION = exports.DefaultAggregation = exports.ExponentialHistogramAggregation = exports.ExplicitBucketHistogramAggregation = exports.HistogramAggregation = exports.LastValueAggregation = exports.SumAggregation = exports.DropAggregation = void 0;
|
|
1496
|
-
const api$3 = __require("@opentelemetry/api");
|
|
1497
|
-
const aggregator_1 = require_aggregator();
|
|
1498
|
-
const MetricData_1 = require_MetricData();
|
|
1499
|
-
/**
|
|
1500
|
-
* The default drop aggregation.
|
|
1501
|
-
*/
|
|
1502
|
-
var DropAggregation = class DropAggregation {
|
|
1503
|
-
static DEFAULT_INSTANCE = new aggregator_1.DropAggregator();
|
|
1504
|
-
createAggregator(_instrument) {
|
|
1505
|
-
return DropAggregation.DEFAULT_INSTANCE;
|
|
1506
|
-
}
|
|
1507
|
-
};
|
|
1508
|
-
exports.DropAggregation = DropAggregation;
|
|
1509
|
-
/**
|
|
1510
|
-
* The default sum aggregation.
|
|
1511
|
-
*/
|
|
1512
|
-
var SumAggregation = class SumAggregation {
|
|
1513
|
-
static MONOTONIC_INSTANCE = new aggregator_1.SumAggregator(true);
|
|
1514
|
-
static NON_MONOTONIC_INSTANCE = new aggregator_1.SumAggregator(false);
|
|
1515
|
-
createAggregator(instrument) {
|
|
1516
|
-
switch (instrument.type) {
|
|
1517
|
-
case MetricData_1.InstrumentType.COUNTER:
|
|
1518
|
-
case MetricData_1.InstrumentType.OBSERVABLE_COUNTER:
|
|
1519
|
-
case MetricData_1.InstrumentType.HISTOGRAM: return SumAggregation.MONOTONIC_INSTANCE;
|
|
1520
|
-
default: return SumAggregation.NON_MONOTONIC_INSTANCE;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
};
|
|
1524
|
-
exports.SumAggregation = SumAggregation;
|
|
1525
|
-
/**
|
|
1526
|
-
* The default last value aggregation.
|
|
1527
|
-
*/
|
|
1528
|
-
var LastValueAggregation = class LastValueAggregation {
|
|
1529
|
-
static DEFAULT_INSTANCE = new aggregator_1.LastValueAggregator();
|
|
1530
|
-
createAggregator(_instrument) {
|
|
1531
|
-
return LastValueAggregation.DEFAULT_INSTANCE;
|
|
1532
|
-
}
|
|
1533
|
-
};
|
|
1534
|
-
exports.LastValueAggregation = LastValueAggregation;
|
|
1535
|
-
/**
|
|
1536
|
-
* The default histogram aggregation.
|
|
1537
|
-
|
|
1538
|
-
*/
|
|
1539
|
-
var HistogramAggregation = class HistogramAggregation {
|
|
1540
|
-
static DEFAULT_INSTANCE = new aggregator_1.HistogramAggregator([
|
|
1541
|
-
0,
|
|
1542
|
-
5,
|
|
1543
|
-
10,
|
|
1544
|
-
25,
|
|
1545
|
-
50,
|
|
1546
|
-
75,
|
|
1547
|
-
100,
|
|
1548
|
-
250,
|
|
1549
|
-
500,
|
|
1550
|
-
750,
|
|
1551
|
-
1e3,
|
|
1552
|
-
2500,
|
|
1553
|
-
5e3,
|
|
1554
|
-
7500,
|
|
1555
|
-
1e4
|
|
1556
|
-
], true);
|
|
1557
|
-
createAggregator(_instrument) {
|
|
1558
|
-
return HistogramAggregation.DEFAULT_INSTANCE;
|
|
1559
|
-
}
|
|
1560
|
-
};
|
|
1561
|
-
exports.HistogramAggregation = HistogramAggregation;
|
|
1562
|
-
/**
|
|
1563
|
-
* The explicit bucket histogram aggregation.
|
|
1564
|
-
*/
|
|
1565
|
-
var ExplicitBucketHistogramAggregation = class {
|
|
1566
|
-
_boundaries;
|
|
1567
|
-
_recordMinMax;
|
|
1568
|
-
/**
|
|
1569
|
-
* @param boundaries the bucket boundaries of the histogram aggregation
|
|
1570
|
-
* @param _recordMinMax If set to true, min and max will be recorded. Otherwise, min and max will not be recorded.
|
|
1571
|
-
*/
|
|
1572
|
-
constructor(boundaries, recordMinMax = true) {
|
|
1573
|
-
if (boundaries == null) throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");
|
|
1574
|
-
boundaries = boundaries.concat();
|
|
1575
|
-
boundaries = boundaries.sort((a, b) => a - b);
|
|
1576
|
-
const minusInfinityIndex = boundaries.lastIndexOf(-Infinity);
|
|
1577
|
-
let infinityIndex = boundaries.indexOf(Infinity);
|
|
1578
|
-
if (infinityIndex === -1) infinityIndex = void 0;
|
|
1579
|
-
this._boundaries = boundaries.slice(minusInfinityIndex + 1, infinityIndex);
|
|
1580
|
-
this._recordMinMax = recordMinMax;
|
|
1581
|
-
}
|
|
1582
|
-
createAggregator(_instrument) {
|
|
1583
|
-
return new aggregator_1.HistogramAggregator(this._boundaries, this._recordMinMax);
|
|
1584
|
-
}
|
|
1585
|
-
};
|
|
1586
|
-
exports.ExplicitBucketHistogramAggregation = ExplicitBucketHistogramAggregation;
|
|
1587
|
-
var ExponentialHistogramAggregation = class {
|
|
1588
|
-
_maxSize;
|
|
1589
|
-
_recordMinMax;
|
|
1590
|
-
constructor(maxSize = 160, recordMinMax = true) {
|
|
1591
|
-
this._maxSize = maxSize;
|
|
1592
|
-
this._recordMinMax = recordMinMax;
|
|
1593
|
-
}
|
|
1594
|
-
createAggregator(_instrument) {
|
|
1595
|
-
return new aggregator_1.ExponentialHistogramAggregator(this._maxSize, this._recordMinMax);
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
exports.ExponentialHistogramAggregation = ExponentialHistogramAggregation;
|
|
1599
|
-
/**
|
|
1600
|
-
* The default aggregation.
|
|
1601
|
-
*/
|
|
1602
|
-
var DefaultAggregation = class {
|
|
1603
|
-
_resolve(instrument) {
|
|
1604
|
-
switch (instrument.type) {
|
|
1605
|
-
case MetricData_1.InstrumentType.COUNTER:
|
|
1606
|
-
case MetricData_1.InstrumentType.UP_DOWN_COUNTER:
|
|
1607
|
-
case MetricData_1.InstrumentType.OBSERVABLE_COUNTER:
|
|
1608
|
-
case MetricData_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: return exports.SUM_AGGREGATION;
|
|
1609
|
-
case MetricData_1.InstrumentType.GAUGE:
|
|
1610
|
-
case MetricData_1.InstrumentType.OBSERVABLE_GAUGE: return exports.LAST_VALUE_AGGREGATION;
|
|
1611
|
-
case MetricData_1.InstrumentType.HISTOGRAM:
|
|
1612
|
-
if (instrument.advice.explicitBucketBoundaries) return new ExplicitBucketHistogramAggregation(instrument.advice.explicitBucketBoundaries);
|
|
1613
|
-
return exports.HISTOGRAM_AGGREGATION;
|
|
1614
|
-
}
|
|
1615
|
-
api$3.diag.warn(`Unable to recognize instrument type: ${instrument.type}`);
|
|
1616
|
-
return exports.DROP_AGGREGATION;
|
|
1617
|
-
}
|
|
1618
|
-
createAggregator(instrument) {
|
|
1619
|
-
return this._resolve(instrument).createAggregator(instrument);
|
|
1620
|
-
}
|
|
1621
|
-
};
|
|
1622
|
-
exports.DefaultAggregation = DefaultAggregation;
|
|
1623
|
-
exports.DROP_AGGREGATION = new DropAggregation();
|
|
1624
|
-
exports.SUM_AGGREGATION = new SumAggregation();
|
|
1625
|
-
exports.LAST_VALUE_AGGREGATION = new LastValueAggregation();
|
|
1626
|
-
exports.HISTOGRAM_AGGREGATION = new HistogramAggregation();
|
|
1627
|
-
exports.EXPONENTIAL_HISTOGRAM_AGGREGATION = new ExponentialHistogramAggregation();
|
|
1628
|
-
exports.DEFAULT_AGGREGATION = new DefaultAggregation();
|
|
1629
|
-
}));
|
|
1630
|
-
//#endregion
|
|
1631
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AggregationOption.js
|
|
1632
|
-
var require_AggregationOption = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1633
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1634
|
-
exports.toAggregation = exports.AggregationType = void 0;
|
|
1635
|
-
const Aggregation_1 = require_Aggregation();
|
|
1636
|
-
var AggregationType;
|
|
1637
|
-
(function(AggregationType) {
|
|
1638
|
-
AggregationType[AggregationType["DEFAULT"] = 0] = "DEFAULT";
|
|
1639
|
-
AggregationType[AggregationType["DROP"] = 1] = "DROP";
|
|
1640
|
-
AggregationType[AggregationType["SUM"] = 2] = "SUM";
|
|
1641
|
-
AggregationType[AggregationType["LAST_VALUE"] = 3] = "LAST_VALUE";
|
|
1642
|
-
AggregationType[AggregationType["EXPLICIT_BUCKET_HISTOGRAM"] = 4] = "EXPLICIT_BUCKET_HISTOGRAM";
|
|
1643
|
-
AggregationType[AggregationType["EXPONENTIAL_HISTOGRAM"] = 5] = "EXPONENTIAL_HISTOGRAM";
|
|
1644
|
-
})(AggregationType = exports.AggregationType || (exports.AggregationType = {}));
|
|
1645
|
-
function toAggregation(option) {
|
|
1646
|
-
switch (option.type) {
|
|
1647
|
-
case AggregationType.DEFAULT: return Aggregation_1.DEFAULT_AGGREGATION;
|
|
1648
|
-
case AggregationType.DROP: return Aggregation_1.DROP_AGGREGATION;
|
|
1649
|
-
case AggregationType.SUM: return Aggregation_1.SUM_AGGREGATION;
|
|
1650
|
-
case AggregationType.LAST_VALUE: return Aggregation_1.LAST_VALUE_AGGREGATION;
|
|
1651
|
-
case AggregationType.EXPONENTIAL_HISTOGRAM: {
|
|
1652
|
-
const expOption = option;
|
|
1653
|
-
return new Aggregation_1.ExponentialHistogramAggregation(expOption.options?.maxSize, expOption.options?.recordMinMax);
|
|
1654
|
-
}
|
|
1655
|
-
case AggregationType.EXPLICIT_BUCKET_HISTOGRAM: {
|
|
1656
|
-
const expOption = option;
|
|
1657
|
-
if (expOption.options == null) return Aggregation_1.HISTOGRAM_AGGREGATION;
|
|
1658
|
-
else return new Aggregation_1.ExplicitBucketHistogramAggregation(expOption.options?.boundaries, expOption.options?.recordMinMax);
|
|
1659
|
-
}
|
|
1660
|
-
default: throw new Error("Unsupported Aggregation");
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
exports.toAggregation = toAggregation;
|
|
1664
|
-
}));
|
|
1665
|
-
//#endregion
|
|
1666
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationSelector.js
|
|
1667
|
-
var require_AggregationSelector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1668
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1669
|
-
exports.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR = exports.DEFAULT_AGGREGATION_SELECTOR = void 0;
|
|
1670
|
-
const AggregationTemporality_1 = require_AggregationTemporality();
|
|
1671
|
-
const AggregationOption_1 = require_AggregationOption();
|
|
1672
|
-
const DEFAULT_AGGREGATION_SELECTOR = (_instrumentType) => {
|
|
1673
|
-
return { type: AggregationOption_1.AggregationType.DEFAULT };
|
|
1674
|
-
};
|
|
1675
|
-
exports.DEFAULT_AGGREGATION_SELECTOR = DEFAULT_AGGREGATION_SELECTOR;
|
|
1676
|
-
const DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR = (_instrumentType) => AggregationTemporality_1.AggregationTemporality.CUMULATIVE;
|
|
1677
|
-
exports.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR = DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR;
|
|
1678
|
-
}));
|
|
1679
|
-
//#endregion
|
|
1680
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.js
|
|
1681
|
-
var require_MetricReader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1682
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1683
|
-
exports.MetricReader = void 0;
|
|
1684
|
-
const api$2 = __require("@opentelemetry/api");
|
|
1685
|
-
const utils_1 = require_utils$2();
|
|
1686
|
-
const AggregationSelector_1 = require_AggregationSelector();
|
|
1687
|
-
/**
|
|
1688
|
-
* A registered reader of metrics that, when linked to a {@link MetricProducer}, offers global
|
|
1689
|
-
* control over metrics.
|
|
1690
|
-
*/
|
|
1691
|
-
var MetricReader = class {
|
|
1692
|
-
_shutdown = false;
|
|
1693
|
-
_metricProducers;
|
|
1694
|
-
_sdkMetricProducer;
|
|
1695
|
-
_aggregationTemporalitySelector;
|
|
1696
|
-
_aggregationSelector;
|
|
1697
|
-
_cardinalitySelector;
|
|
1698
|
-
constructor(options) {
|
|
1699
|
-
this._aggregationSelector = options?.aggregationSelector ?? AggregationSelector_1.DEFAULT_AGGREGATION_SELECTOR;
|
|
1700
|
-
this._aggregationTemporalitySelector = options?.aggregationTemporalitySelector ?? AggregationSelector_1.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR;
|
|
1701
|
-
this._metricProducers = options?.metricProducers ?? [];
|
|
1702
|
-
this._cardinalitySelector = options?.cardinalitySelector;
|
|
1703
|
-
}
|
|
1704
|
-
setMetricProducer(metricProducer) {
|
|
1705
|
-
if (this._sdkMetricProducer) throw new Error("MetricReader can not be bound to a MeterProvider again.");
|
|
1706
|
-
this._sdkMetricProducer = metricProducer;
|
|
1707
|
-
this.onInitialized();
|
|
1708
|
-
}
|
|
1709
|
-
selectAggregation(instrumentType) {
|
|
1710
|
-
return this._aggregationSelector(instrumentType);
|
|
1711
|
-
}
|
|
1712
|
-
selectAggregationTemporality(instrumentType) {
|
|
1713
|
-
return this._aggregationTemporalitySelector(instrumentType);
|
|
1714
|
-
}
|
|
1715
|
-
selectCardinalityLimit(instrumentType) {
|
|
1716
|
-
return this._cardinalitySelector ? this._cardinalitySelector(instrumentType) : 2e3;
|
|
1717
|
-
}
|
|
1718
|
-
/**
|
|
1719
|
-
* Handle once the SDK has initialized this {@link MetricReader}
|
|
1720
|
-
* Overriding this method is optional.
|
|
1721
|
-
*/
|
|
1722
|
-
onInitialized() {}
|
|
1723
|
-
async collect(options) {
|
|
1724
|
-
if (this._sdkMetricProducer === void 0) throw new Error("MetricReader is not bound to a MetricProducer");
|
|
1725
|
-
if (this._shutdown) throw new Error("MetricReader is shutdown");
|
|
1726
|
-
const [sdkCollectionResults, ...additionalCollectionResults] = await Promise.all([this._sdkMetricProducer.collect({ timeoutMillis: options?.timeoutMillis }), ...this._metricProducers.map((producer) => producer.collect({ timeoutMillis: options?.timeoutMillis }))]);
|
|
1727
|
-
const errors = sdkCollectionResults.errors.concat(additionalCollectionResults.flatMap((result) => result.errors));
|
|
1728
|
-
return {
|
|
1729
|
-
resourceMetrics: {
|
|
1730
|
-
resource: sdkCollectionResults.resourceMetrics.resource,
|
|
1731
|
-
scopeMetrics: sdkCollectionResults.resourceMetrics.scopeMetrics.concat(additionalCollectionResults.flatMap((result) => result.resourceMetrics.scopeMetrics))
|
|
1732
|
-
},
|
|
1733
|
-
errors
|
|
1734
|
-
};
|
|
1735
|
-
}
|
|
1736
|
-
async shutdown(options) {
|
|
1737
|
-
if (this._shutdown) {
|
|
1738
|
-
api$2.diag.error("Cannot call shutdown twice.");
|
|
1739
|
-
return;
|
|
1740
|
-
}
|
|
1741
|
-
if (options?.timeoutMillis == null) await this.onShutdown();
|
|
1742
|
-
else await (0, utils_1.callWithTimeout)(this.onShutdown(), options.timeoutMillis);
|
|
1743
|
-
this._shutdown = true;
|
|
1744
|
-
}
|
|
1745
|
-
async forceFlush(options) {
|
|
1746
|
-
if (this._shutdown) {
|
|
1747
|
-
api$2.diag.warn("Cannot forceFlush on already shutdown MetricReader.");
|
|
1748
|
-
return;
|
|
1749
|
-
}
|
|
1750
|
-
if (options?.timeoutMillis == null) {
|
|
1751
|
-
await this.onForceFlush();
|
|
1752
|
-
return;
|
|
1753
|
-
}
|
|
1754
|
-
await (0, utils_1.callWithTimeout)(this.onForceFlush(), options.timeoutMillis);
|
|
1755
|
-
}
|
|
1756
|
-
};
|
|
1757
|
-
exports.MetricReader = MetricReader;
|
|
1758
|
-
}));
|
|
1759
|
-
//#endregion
|
|
1760
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.js
|
|
1761
|
-
var require_PeriodicExportingMetricReader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1762
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1763
|
-
exports.PeriodicExportingMetricReader = void 0;
|
|
1764
|
-
const api$1 = __require("@opentelemetry/api");
|
|
1765
|
-
const core_1$6 = __require("@opentelemetry/core");
|
|
1766
|
-
const MetricReader_1 = require_MetricReader();
|
|
1767
|
-
const utils_1 = require_utils$2();
|
|
1768
|
-
const MetricData_1 = require_MetricData();
|
|
1769
|
-
/**
|
|
1770
|
-
* {@link MetricReader} which collects metrics based on a user-configurable time interval, and passes the metrics to
|
|
1771
|
-
* the configured {@link PushMetricExporter}
|
|
1772
|
-
*/
|
|
1773
|
-
var PeriodicExportingMetricReader = class extends MetricReader_1.MetricReader {
|
|
1774
|
-
_interval;
|
|
1775
|
-
_exporter;
|
|
1776
|
-
_exportInterval;
|
|
1777
|
-
_exportTimeout;
|
|
1778
|
-
constructor(options) {
|
|
1779
|
-
const { exporter, exportIntervalMillis = 6e4, metricProducers, cardinalityLimits } = options;
|
|
1780
|
-
let { exportTimeoutMillis = 3e4 } = options;
|
|
1781
|
-
super({
|
|
1782
|
-
aggregationSelector: exporter.selectAggregation?.bind(exporter),
|
|
1783
|
-
aggregationTemporalitySelector: exporter.selectAggregationTemporality?.bind(exporter),
|
|
1784
|
-
metricProducers,
|
|
1785
|
-
cardinalitySelector: (instrumentType) => {
|
|
1786
|
-
const limits = {
|
|
1787
|
-
default: 2e3,
|
|
1788
|
-
...cardinalityLimits
|
|
1789
|
-
};
|
|
1790
|
-
switch (instrumentType) {
|
|
1791
|
-
case MetricData_1.InstrumentType.COUNTER: return limits.counter ?? limits.default;
|
|
1792
|
-
case MetricData_1.InstrumentType.GAUGE: return limits.gauge ?? limits.default;
|
|
1793
|
-
case MetricData_1.InstrumentType.HISTOGRAM: return limits.histogram ?? limits.default;
|
|
1794
|
-
case MetricData_1.InstrumentType.OBSERVABLE_COUNTER: return limits.observableCounter ?? limits.default;
|
|
1795
|
-
case MetricData_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: return limits.observableUpDownCounter ?? limits.default;
|
|
1796
|
-
case MetricData_1.InstrumentType.OBSERVABLE_GAUGE: return limits.observableGauge ?? limits.default;
|
|
1797
|
-
case MetricData_1.InstrumentType.UP_DOWN_COUNTER: return limits.upDownCounter ?? limits.default;
|
|
1798
|
-
default: return limits.default;
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
});
|
|
1802
|
-
if (exportIntervalMillis <= 0) throw Error("exportIntervalMillis must be greater than 0");
|
|
1803
|
-
if (exportTimeoutMillis <= 0) throw Error("exportTimeoutMillis must be greater than 0");
|
|
1804
|
-
if (exportIntervalMillis < exportTimeoutMillis) if ("exportIntervalMillis" in options && "exportTimeoutMillis" in options) throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");
|
|
1805
|
-
else {
|
|
1806
|
-
api$1.diag.info(`Timeout of ${exportTimeoutMillis} exceeds the interval of ${exportIntervalMillis}. Clamping timeout to interval duration.`);
|
|
1807
|
-
exportTimeoutMillis = exportIntervalMillis;
|
|
1808
|
-
}
|
|
1809
|
-
this._exportInterval = exportIntervalMillis;
|
|
1810
|
-
this._exportTimeout = exportTimeoutMillis;
|
|
1811
|
-
this._exporter = exporter;
|
|
1812
|
-
}
|
|
1813
|
-
async _runOnce() {
|
|
1814
|
-
try {
|
|
1815
|
-
await (0, utils_1.callWithTimeout)(this._doRun(), this._exportTimeout);
|
|
1816
|
-
} catch (err) {
|
|
1817
|
-
if (err instanceof utils_1.TimeoutError) {
|
|
1818
|
-
api$1.diag.error("Export took longer than %s milliseconds and timed out.", this._exportTimeout);
|
|
1819
|
-
return;
|
|
1820
|
-
}
|
|
1821
|
-
(0, core_1$6.globalErrorHandler)(err);
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
async _doRun() {
|
|
1825
|
-
const { resourceMetrics, errors } = await this.collect({ timeoutMillis: this._exportTimeout });
|
|
1826
|
-
if (errors.length > 0) api$1.diag.error("PeriodicExportingMetricReader: metrics collection errors", ...errors);
|
|
1827
|
-
if (resourceMetrics.resource.asyncAttributesPending) try {
|
|
1828
|
-
await resourceMetrics.resource.waitForAsyncAttributes?.();
|
|
1829
|
-
} catch (e) {
|
|
1830
|
-
api$1.diag.debug("Error while resolving async portion of resource: ", e);
|
|
1831
|
-
(0, core_1$6.globalErrorHandler)(e);
|
|
1832
|
-
}
|
|
1833
|
-
if (resourceMetrics.scopeMetrics.length === 0) return;
|
|
1834
|
-
const result = await core_1$6.internal._export(this._exporter, resourceMetrics);
|
|
1835
|
-
if (result.code !== core_1$6.ExportResultCode.SUCCESS) throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${result.error})`);
|
|
1836
|
-
}
|
|
1837
|
-
onInitialized() {
|
|
1838
|
-
this._interval = setInterval(() => {
|
|
1839
|
-
this._runOnce();
|
|
1840
|
-
}, this._exportInterval);
|
|
1841
|
-
if (typeof this._interval !== "number") this._interval.unref();
|
|
1842
|
-
}
|
|
1843
|
-
async onForceFlush() {
|
|
1844
|
-
await this._runOnce();
|
|
1845
|
-
await this._exporter.forceFlush();
|
|
1846
|
-
}
|
|
1847
|
-
async onShutdown() {
|
|
1848
|
-
if (this._interval) clearInterval(this._interval);
|
|
1849
|
-
await this.onForceFlush();
|
|
1850
|
-
await this._exporter.shutdown();
|
|
1851
|
-
}
|
|
1852
|
-
};
|
|
1853
|
-
exports.PeriodicExportingMetricReader = PeriodicExportingMetricReader;
|
|
1854
|
-
}));
|
|
1855
|
-
//#endregion
|
|
1856
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/InMemoryMetricExporter.js
|
|
1857
|
-
var require_InMemoryMetricExporter = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1858
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1859
|
-
exports.InMemoryMetricExporter = void 0;
|
|
1860
|
-
const core_1$5 = __require("@opentelemetry/core");
|
|
1861
|
-
/**
|
|
1862
|
-
* In-memory Metrics Exporter is a Push Metric Exporter
|
|
1863
|
-
* which accumulates metrics data in the local memory and
|
|
1864
|
-
* allows to inspect it (useful for e.g. unit tests).
|
|
1865
|
-
*/
|
|
1866
|
-
var InMemoryMetricExporter = class {
|
|
1867
|
-
_shutdown = false;
|
|
1868
|
-
_aggregationTemporality;
|
|
1869
|
-
_metrics = [];
|
|
1870
|
-
constructor(aggregationTemporality) {
|
|
1871
|
-
this._aggregationTemporality = aggregationTemporality;
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* @inheritedDoc
|
|
1875
|
-
*/
|
|
1876
|
-
export(metrics, resultCallback) {
|
|
1877
|
-
if (this._shutdown) {
|
|
1878
|
-
setTimeout(() => resultCallback({ code: core_1$5.ExportResultCode.FAILED }), 0);
|
|
1879
|
-
return;
|
|
1880
|
-
}
|
|
1881
|
-
this._metrics.push(metrics);
|
|
1882
|
-
setTimeout(() => resultCallback({ code: core_1$5.ExportResultCode.SUCCESS }), 0);
|
|
1883
|
-
}
|
|
1884
|
-
/**
|
|
1885
|
-
* Returns all the collected resource metrics
|
|
1886
|
-
* @returns ResourceMetrics[]
|
|
1887
|
-
*/
|
|
1888
|
-
getMetrics() {
|
|
1889
|
-
return this._metrics;
|
|
1890
|
-
}
|
|
1891
|
-
forceFlush() {
|
|
1892
|
-
return Promise.resolve();
|
|
1893
|
-
}
|
|
1894
|
-
reset() {
|
|
1895
|
-
this._metrics = [];
|
|
1896
|
-
}
|
|
1897
|
-
selectAggregationTemporality(_instrumentType) {
|
|
1898
|
-
return this._aggregationTemporality;
|
|
1899
|
-
}
|
|
1900
|
-
shutdown() {
|
|
1901
|
-
this._shutdown = true;
|
|
1902
|
-
return Promise.resolve();
|
|
1903
|
-
}
|
|
1904
|
-
};
|
|
1905
|
-
exports.InMemoryMetricExporter = InMemoryMetricExporter;
|
|
1906
|
-
}));
|
|
1907
|
-
//#endregion
|
|
1908
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.js
|
|
1909
|
-
var require_ConsoleMetricExporter = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1910
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1911
|
-
exports.ConsoleMetricExporter = void 0;
|
|
1912
|
-
const core_1$4 = __require("@opentelemetry/core");
|
|
1913
|
-
const AggregationSelector_1 = require_AggregationSelector();
|
|
1914
|
-
exports.ConsoleMetricExporter = class ConsoleMetricExporter {
|
|
1915
|
-
_shutdown = false;
|
|
1916
|
-
_temporalitySelector;
|
|
1917
|
-
constructor(options) {
|
|
1918
|
-
this._temporalitySelector = options?.temporalitySelector ?? AggregationSelector_1.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR;
|
|
1919
|
-
}
|
|
1920
|
-
export(metrics, resultCallback) {
|
|
1921
|
-
if (this._shutdown) {
|
|
1922
|
-
resultCallback({ code: core_1$4.ExportResultCode.FAILED });
|
|
1923
|
-
return;
|
|
1924
|
-
}
|
|
1925
|
-
return ConsoleMetricExporter._sendMetrics(metrics, resultCallback);
|
|
1926
|
-
}
|
|
1927
|
-
forceFlush() {
|
|
1928
|
-
return Promise.resolve();
|
|
1929
|
-
}
|
|
1930
|
-
selectAggregationTemporality(_instrumentType) {
|
|
1931
|
-
return this._temporalitySelector(_instrumentType);
|
|
1932
|
-
}
|
|
1933
|
-
shutdown() {
|
|
1934
|
-
this._shutdown = true;
|
|
1935
|
-
return Promise.resolve();
|
|
1936
|
-
}
|
|
1937
|
-
static _sendMetrics(metrics, done) {
|
|
1938
|
-
for (const scopeMetrics of metrics.scopeMetrics) for (const metric of scopeMetrics.metrics) console.dir({
|
|
1939
|
-
descriptor: metric.descriptor,
|
|
1940
|
-
dataPointType: metric.dataPointType,
|
|
1941
|
-
dataPoints: metric.dataPoints
|
|
1942
|
-
}, { depth: null });
|
|
1943
|
-
done({ code: core_1$4.ExportResultCode.SUCCESS });
|
|
1944
|
-
}
|
|
1945
|
-
};
|
|
1946
|
-
}));
|
|
1947
|
-
//#endregion
|
|
1948
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/default-service-name.js
|
|
1949
|
-
var require_default_service_name = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1950
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1951
|
-
exports._clearDefaultServiceNameCache = exports.defaultServiceName = void 0;
|
|
1952
|
-
let serviceName;
|
|
1953
|
-
/**
|
|
1954
|
-
* Returns the default service name for OpenTelemetry resources.
|
|
1955
|
-
* In Node.js environments, returns "unknown_service:<process.argv0>".
|
|
1956
|
-
* In browser/edge environments, returns "unknown_service".
|
|
1957
|
-
*/
|
|
1958
|
-
function defaultServiceName() {
|
|
1959
|
-
if (serviceName === void 0) try {
|
|
1960
|
-
const argv0 = globalThis.process.argv0;
|
|
1961
|
-
serviceName = argv0 ? `unknown_service:${argv0}` : "unknown_service";
|
|
1962
|
-
} catch {
|
|
1963
|
-
serviceName = "unknown_service";
|
|
1964
|
-
}
|
|
1965
|
-
return serviceName;
|
|
1966
|
-
}
|
|
1967
|
-
exports.defaultServiceName = defaultServiceName;
|
|
1968
|
-
/** @internal For testing purposes only */
|
|
1969
|
-
function _clearDefaultServiceNameCache() {
|
|
1970
|
-
serviceName = void 0;
|
|
1971
|
-
}
|
|
1972
|
-
exports._clearDefaultServiceNameCache = _clearDefaultServiceNameCache;
|
|
1973
|
-
}));
|
|
1974
|
-
//#endregion
|
|
1975
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/utils.js
|
|
1976
|
-
var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1977
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1978
|
-
exports.isPromiseLike = void 0;
|
|
1979
|
-
const isPromiseLike = (val) => {
|
|
1980
|
-
return val !== null && typeof val === "object" && typeof val.then === "function";
|
|
1981
|
-
};
|
|
1982
|
-
exports.isPromiseLike = isPromiseLike;
|
|
1983
|
-
}));
|
|
1984
|
-
//#endregion
|
|
1985
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/ResourceImpl.js
|
|
1986
|
-
var require_ResourceImpl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1987
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1988
|
-
exports.defaultResource = exports.emptyResource = exports.resourceFromDetectedResource = exports.resourceFromAttributes = void 0;
|
|
1989
|
-
const api_1$8 = __require("@opentelemetry/api");
|
|
1990
|
-
const core_1$3 = __require("@opentelemetry/core");
|
|
1991
|
-
const semantic_conventions_1$1 = __require("@opentelemetry/semantic-conventions");
|
|
1992
|
-
const default_service_name_1 = require_default_service_name();
|
|
1993
|
-
const utils_1 = require_utils$1();
|
|
1994
|
-
var ResourceImpl = class ResourceImpl {
|
|
1995
|
-
_rawAttributes;
|
|
1996
|
-
_asyncAttributesPending = false;
|
|
1997
|
-
_schemaUrl;
|
|
1998
|
-
_memoizedAttributes;
|
|
1999
|
-
static FromAttributeList(attributes, options) {
|
|
2000
|
-
const res = new ResourceImpl({}, options);
|
|
2001
|
-
res._rawAttributes = guardedRawAttributes(attributes);
|
|
2002
|
-
res._asyncAttributesPending = attributes.filter(([_, val]) => (0, utils_1.isPromiseLike)(val)).length > 0;
|
|
2003
|
-
return res;
|
|
2004
|
-
}
|
|
2005
|
-
constructor(resource, options) {
|
|
2006
|
-
const attributes = resource.attributes ?? {};
|
|
2007
|
-
this._rawAttributes = Object.entries(attributes).map(([k, v]) => {
|
|
2008
|
-
if ((0, utils_1.isPromiseLike)(v)) this._asyncAttributesPending = true;
|
|
2009
|
-
return [k, v];
|
|
2010
|
-
});
|
|
2011
|
-
this._rawAttributes = guardedRawAttributes(this._rawAttributes);
|
|
2012
|
-
this._schemaUrl = validateSchemaUrl(options?.schemaUrl);
|
|
2013
|
-
}
|
|
2014
|
-
get asyncAttributesPending() {
|
|
2015
|
-
return this._asyncAttributesPending;
|
|
2016
|
-
}
|
|
2017
|
-
async waitForAsyncAttributes() {
|
|
2018
|
-
if (!this.asyncAttributesPending) return;
|
|
2019
|
-
for (let i = 0; i < this._rawAttributes.length; i++) {
|
|
2020
|
-
const [k, v] = this._rawAttributes[i];
|
|
2021
|
-
this._rawAttributes[i] = [k, (0, utils_1.isPromiseLike)(v) ? await v : v];
|
|
2022
|
-
}
|
|
2023
|
-
this._asyncAttributesPending = false;
|
|
2024
|
-
}
|
|
2025
|
-
get attributes() {
|
|
2026
|
-
if (this.asyncAttributesPending) api_1$8.diag.error("Accessing resource attributes before async attributes settled");
|
|
2027
|
-
if (this._memoizedAttributes) return this._memoizedAttributes;
|
|
2028
|
-
const attrs = {};
|
|
2029
|
-
for (const [k, v] of this._rawAttributes) {
|
|
2030
|
-
if ((0, utils_1.isPromiseLike)(v)) {
|
|
2031
|
-
api_1$8.diag.debug(`Unsettled resource attribute ${k} skipped`);
|
|
2032
|
-
continue;
|
|
2033
|
-
}
|
|
2034
|
-
if (v != null) attrs[k] ??= v;
|
|
2035
|
-
}
|
|
2036
|
-
if (!this._asyncAttributesPending) this._memoizedAttributes = attrs;
|
|
2037
|
-
return attrs;
|
|
2038
|
-
}
|
|
2039
|
-
getRawAttributes() {
|
|
2040
|
-
return this._rawAttributes;
|
|
2041
|
-
}
|
|
2042
|
-
get schemaUrl() {
|
|
2043
|
-
return this._schemaUrl;
|
|
2044
|
-
}
|
|
2045
|
-
merge(resource) {
|
|
2046
|
-
if (resource == null) return this;
|
|
2047
|
-
const mergedSchemaUrl = mergeSchemaUrl(this, resource);
|
|
2048
|
-
const mergedOptions = mergedSchemaUrl ? { schemaUrl: mergedSchemaUrl } : void 0;
|
|
2049
|
-
return ResourceImpl.FromAttributeList([...resource.getRawAttributes(), ...this.getRawAttributes()], mergedOptions);
|
|
2050
|
-
}
|
|
2051
|
-
};
|
|
2052
|
-
function resourceFromAttributes(attributes, options) {
|
|
2053
|
-
return ResourceImpl.FromAttributeList(Object.entries(attributes), options);
|
|
2054
|
-
}
|
|
2055
|
-
exports.resourceFromAttributes = resourceFromAttributes;
|
|
2056
|
-
function resourceFromDetectedResource(detectedResource, options) {
|
|
2057
|
-
return new ResourceImpl(detectedResource, options);
|
|
2058
|
-
}
|
|
2059
|
-
exports.resourceFromDetectedResource = resourceFromDetectedResource;
|
|
2060
|
-
function emptyResource() {
|
|
2061
|
-
return resourceFromAttributes({});
|
|
2062
|
-
}
|
|
2063
|
-
exports.emptyResource = emptyResource;
|
|
2064
|
-
function defaultResource() {
|
|
2065
|
-
return resourceFromAttributes({
|
|
2066
|
-
[semantic_conventions_1$1.ATTR_SERVICE_NAME]: (0, default_service_name_1.defaultServiceName)(),
|
|
2067
|
-
[semantic_conventions_1$1.ATTR_TELEMETRY_SDK_LANGUAGE]: core_1$3.SDK_INFO[semantic_conventions_1$1.ATTR_TELEMETRY_SDK_LANGUAGE],
|
|
2068
|
-
[semantic_conventions_1$1.ATTR_TELEMETRY_SDK_NAME]: core_1$3.SDK_INFO[semantic_conventions_1$1.ATTR_TELEMETRY_SDK_NAME],
|
|
2069
|
-
[semantic_conventions_1$1.ATTR_TELEMETRY_SDK_VERSION]: core_1$3.SDK_INFO[semantic_conventions_1$1.ATTR_TELEMETRY_SDK_VERSION]
|
|
2070
|
-
});
|
|
2071
|
-
}
|
|
2072
|
-
exports.defaultResource = defaultResource;
|
|
2073
|
-
function guardedRawAttributes(attributes) {
|
|
2074
|
-
return attributes.map(([k, v]) => {
|
|
2075
|
-
if ((0, utils_1.isPromiseLike)(v)) return [k, v.catch((err) => {
|
|
2076
|
-
api_1$8.diag.debug("promise rejection for resource attribute: %s - %s", k, err);
|
|
2077
|
-
})];
|
|
2078
|
-
return [k, v];
|
|
2079
|
-
});
|
|
2080
|
-
}
|
|
2081
|
-
function validateSchemaUrl(schemaUrl) {
|
|
2082
|
-
if (typeof schemaUrl === "string" || schemaUrl === void 0) return schemaUrl;
|
|
2083
|
-
api_1$8.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.", schemaUrl);
|
|
2084
|
-
}
|
|
2085
|
-
function mergeSchemaUrl(old, updating) {
|
|
2086
|
-
const oldSchemaUrl = old?.schemaUrl;
|
|
2087
|
-
const updatingSchemaUrl = updating?.schemaUrl;
|
|
2088
|
-
const isOldEmpty = oldSchemaUrl === void 0 || oldSchemaUrl === "";
|
|
2089
|
-
const isUpdatingEmpty = updatingSchemaUrl === void 0 || updatingSchemaUrl === "";
|
|
2090
|
-
if (isOldEmpty) return updatingSchemaUrl;
|
|
2091
|
-
if (isUpdatingEmpty) return oldSchemaUrl;
|
|
2092
|
-
if (oldSchemaUrl === updatingSchemaUrl) return oldSchemaUrl;
|
|
2093
|
-
api_1$8.diag.warn("Schema URL merge conflict: old resource has \"%s\", updating resource has \"%s\". Resulting resource will have undefined Schema URL.", oldSchemaUrl, updatingSchemaUrl);
|
|
2094
|
-
}
|
|
2095
|
-
}));
|
|
2096
|
-
//#endregion
|
|
2097
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detect-resources.js
|
|
2098
|
-
var require_detect_resources = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2099
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2100
|
-
exports.detectResources = void 0;
|
|
2101
|
-
const api_1$7 = __require("@opentelemetry/api");
|
|
2102
|
-
const ResourceImpl_1 = require_ResourceImpl();
|
|
2103
|
-
/**
|
|
2104
|
-
* Runs all resource detectors and returns the results merged into a single Resource.
|
|
2105
|
-
*
|
|
2106
|
-
* @param config Configuration for resource detection
|
|
2107
|
-
*/
|
|
2108
|
-
const detectResources = (config = {}) => {
|
|
2109
|
-
return (config.detectors || []).map((d) => {
|
|
2110
|
-
try {
|
|
2111
|
-
const resource = (0, ResourceImpl_1.resourceFromDetectedResource)(d.detect(config));
|
|
2112
|
-
api_1$7.diag.debug(`${d.constructor.name} found resource.`, resource);
|
|
2113
|
-
return resource;
|
|
2114
|
-
} catch (e) {
|
|
2115
|
-
api_1$7.diag.debug(`${d.constructor.name} failed: ${e.message}`);
|
|
2116
|
-
return (0, ResourceImpl_1.emptyResource)();
|
|
2117
|
-
}
|
|
2118
|
-
}).reduce((acc, resource) => acc.merge(resource), (0, ResourceImpl_1.emptyResource)());
|
|
2119
|
-
};
|
|
2120
|
-
exports.detectResources = detectResources;
|
|
2121
|
-
}));
|
|
2122
|
-
//#endregion
|
|
2123
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/EnvDetector.js
|
|
2124
|
-
var require_EnvDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2125
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2126
|
-
exports.envDetector = void 0;
|
|
2127
|
-
const api_1$6 = __require("@opentelemetry/api");
|
|
2128
|
-
const semantic_conventions_1 = __require("@opentelemetry/semantic-conventions");
|
|
2129
|
-
const core_1$2 = __require("@opentelemetry/core");
|
|
2130
|
-
/**
|
|
2131
|
-
* EnvDetector can be used to detect the presence of and create a Resource
|
|
2132
|
-
* from the OTEL_RESOURCE_ATTRIBUTES environment variable.
|
|
2133
|
-
*/
|
|
2134
|
-
var EnvDetector = class {
|
|
2135
|
-
_MAX_LENGTH = 255;
|
|
2136
|
-
_COMMA_SEPARATOR = ",";
|
|
2137
|
-
_LABEL_KEY_VALUE_SPLITTER = "=";
|
|
2138
|
-
/**
|
|
2139
|
-
* Returns a {@link Resource} populated with attributes from the
|
|
2140
|
-
* OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async
|
|
2141
|
-
* function to conform to the Detector interface.
|
|
2142
|
-
*
|
|
2143
|
-
* @param config The resource detection config
|
|
2144
|
-
*/
|
|
2145
|
-
detect(_config) {
|
|
2146
|
-
const attributes = {};
|
|
2147
|
-
const rawAttributes = (0, core_1$2.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES");
|
|
2148
|
-
const serviceName = (0, core_1$2.getStringFromEnv)("OTEL_SERVICE_NAME");
|
|
2149
|
-
if (rawAttributes) try {
|
|
2150
|
-
const parsedAttributes = this._parseResourceAttributes(rawAttributes);
|
|
2151
|
-
Object.assign(attributes, parsedAttributes);
|
|
2152
|
-
} catch (e) {
|
|
2153
|
-
api_1$6.diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);
|
|
2154
|
-
}
|
|
2155
|
-
if (serviceName) attributes[semantic_conventions_1.ATTR_SERVICE_NAME] = serviceName;
|
|
2156
|
-
return { attributes };
|
|
2157
|
-
}
|
|
2158
|
-
/**
|
|
2159
|
-
* Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment
|
|
2160
|
-
* variable.
|
|
2161
|
-
*
|
|
2162
|
-
* OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the
|
|
2163
|
-
* format "key1=value1,key2=value2". The ',' and '=' characters in keys
|
|
2164
|
-
* and values MUST be percent-encoded. Other characters MAY be percent-encoded.
|
|
2165
|
-
*
|
|
2166
|
-
* Per the spec, on any error (e.g., decoding failure), the entire environment
|
|
2167
|
-
* variable value is discarded.
|
|
2168
|
-
*
|
|
2169
|
-
* @param rawEnvAttributes The resource attributes as a comma-separated list
|
|
2170
|
-
* of key/value pairs.
|
|
2171
|
-
* @returns The parsed resource attributes.
|
|
2172
|
-
* @throws Error if parsing fails (caller handles by discarding all attributes)
|
|
2173
|
-
*/
|
|
2174
|
-
_parseResourceAttributes(rawEnvAttributes) {
|
|
2175
|
-
if (!rawEnvAttributes) return {};
|
|
2176
|
-
const attributes = {};
|
|
2177
|
-
const rawAttributes = rawEnvAttributes.split(this._COMMA_SEPARATOR).filter((attr) => attr.trim() !== "");
|
|
2178
|
-
for (const rawAttribute of rawAttributes) {
|
|
2179
|
-
const keyValuePair = rawAttribute.split(this._LABEL_KEY_VALUE_SPLITTER);
|
|
2180
|
-
if (keyValuePair.length !== 2) throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${rawAttribute}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);
|
|
2181
|
-
const [rawKey, rawValue] = keyValuePair;
|
|
2182
|
-
const key = rawKey.trim();
|
|
2183
|
-
const value = rawValue.trim();
|
|
2184
|
-
if (key.length === 0) throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${rawAttribute}".`);
|
|
2185
|
-
let decodedKey;
|
|
2186
|
-
let decodedValue;
|
|
2187
|
-
try {
|
|
2188
|
-
decodedKey = decodeURIComponent(key);
|
|
2189
|
-
decodedValue = decodeURIComponent(value);
|
|
2190
|
-
} catch (e) {
|
|
2191
|
-
throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${rawAttribute}": ${e instanceof Error ? e.message : e}`);
|
|
2192
|
-
}
|
|
2193
|
-
if (decodedKey.length > this._MAX_LENGTH) throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${decodedKey}".`);
|
|
2194
|
-
if (decodedValue.length > this._MAX_LENGTH) throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${decodedKey}".`);
|
|
2195
|
-
attributes[decodedKey] = decodedValue;
|
|
2196
|
-
}
|
|
2197
|
-
return attributes;
|
|
2198
|
-
}
|
|
2199
|
-
};
|
|
2200
|
-
exports.envDetector = new EnvDetector();
|
|
2201
|
-
}));
|
|
2202
|
-
//#endregion
|
|
2203
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/semconv.js
|
|
2204
|
-
var require_semconv = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2205
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2206
|
-
exports.ATTR_WEBENGINE_VERSION = exports.ATTR_WEBENGINE_NAME = exports.ATTR_WEBENGINE_DESCRIPTION = exports.ATTR_SERVICE_NAMESPACE = exports.ATTR_SERVICE_INSTANCE_ID = exports.ATTR_PROCESS_RUNTIME_VERSION = exports.ATTR_PROCESS_RUNTIME_NAME = exports.ATTR_PROCESS_RUNTIME_DESCRIPTION = exports.ATTR_PROCESS_PID = exports.ATTR_PROCESS_OWNER = exports.ATTR_PROCESS_EXECUTABLE_PATH = exports.ATTR_PROCESS_EXECUTABLE_NAME = exports.ATTR_PROCESS_COMMAND_ARGS = exports.ATTR_PROCESS_COMMAND = exports.ATTR_OS_VERSION = exports.ATTR_OS_TYPE = exports.ATTR_K8S_POD_NAME = exports.ATTR_K8S_NAMESPACE_NAME = exports.ATTR_K8S_DEPLOYMENT_NAME = exports.ATTR_K8S_CLUSTER_NAME = exports.ATTR_HOST_TYPE = exports.ATTR_HOST_NAME = exports.ATTR_HOST_IMAGE_VERSION = exports.ATTR_HOST_IMAGE_NAME = exports.ATTR_HOST_IMAGE_ID = exports.ATTR_HOST_ID = exports.ATTR_HOST_ARCH = exports.ATTR_CONTAINER_NAME = exports.ATTR_CONTAINER_IMAGE_TAGS = exports.ATTR_CONTAINER_IMAGE_NAME = exports.ATTR_CONTAINER_ID = exports.ATTR_CLOUD_REGION = exports.ATTR_CLOUD_PROVIDER = exports.ATTR_CLOUD_AVAILABILITY_ZONE = exports.ATTR_CLOUD_ACCOUNT_ID = void 0;
|
|
2207
|
-
/**
|
|
2208
|
-
* The cloud account ID the resource is assigned to.
|
|
2209
|
-
*
|
|
2210
|
-
* @example 111111111111
|
|
2211
|
-
* @example opentelemetry
|
|
2212
|
-
*
|
|
2213
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2214
|
-
*/
|
|
2215
|
-
exports.ATTR_CLOUD_ACCOUNT_ID = "cloud.account.id";
|
|
2216
|
-
/**
|
|
2217
|
-
* Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.
|
|
2218
|
-
*
|
|
2219
|
-
* @example us-east-1c
|
|
2220
|
-
*
|
|
2221
|
-
* @note Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
|
|
2222
|
-
*
|
|
2223
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2224
|
-
*/
|
|
2225
|
-
exports.ATTR_CLOUD_AVAILABILITY_ZONE = "cloud.availability_zone";
|
|
2226
|
-
/**
|
|
2227
|
-
* Name of the cloud provider.
|
|
2228
|
-
*
|
|
2229
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2230
|
-
*/
|
|
2231
|
-
exports.ATTR_CLOUD_PROVIDER = "cloud.provider";
|
|
2232
|
-
/**
|
|
2233
|
-
* The geographical region the resource is running.
|
|
2234
|
-
*
|
|
2235
|
-
* @example us-central1
|
|
2236
|
-
* @example us-east-1
|
|
2237
|
-
*
|
|
2238
|
-
* @note Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).
|
|
2239
|
-
*
|
|
2240
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2241
|
-
*/
|
|
2242
|
-
exports.ATTR_CLOUD_REGION = "cloud.region";
|
|
2243
|
-
/**
|
|
2244
|
-
* Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/containers/run/#container-identification). The UUID might be abbreviated.
|
|
2245
|
-
*
|
|
2246
|
-
* @example a3bf90e006b2
|
|
2247
|
-
*
|
|
2248
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2249
|
-
*/
|
|
2250
|
-
exports.ATTR_CONTAINER_ID = "container.id";
|
|
2251
|
-
/**
|
|
2252
|
-
* Name of the image the container was built on.
|
|
2253
|
-
*
|
|
2254
|
-
* @example gcr.io/opentelemetry/operator
|
|
2255
|
-
*
|
|
2256
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2257
|
-
*/
|
|
2258
|
-
exports.ATTR_CONTAINER_IMAGE_NAME = "container.image.name";
|
|
2259
|
-
/**
|
|
2260
|
-
* Container image tags. An example can be found in [Docker Image Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). Should be only the `<tag>` section of the full name for example from `registry.example.com/my-org/my-image:<tag>`.
|
|
2261
|
-
*
|
|
2262
|
-
* @example ["v1.27.1", "3.5.7-0"]
|
|
2263
|
-
*
|
|
2264
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2265
|
-
*/
|
|
2266
|
-
exports.ATTR_CONTAINER_IMAGE_TAGS = "container.image.tags";
|
|
2267
|
-
/**
|
|
2268
|
-
* Container name used by container runtime.
|
|
2269
|
-
*
|
|
2270
|
-
* @example opentelemetry-autoconf
|
|
2271
|
-
*
|
|
2272
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2273
|
-
*/
|
|
2274
|
-
exports.ATTR_CONTAINER_NAME = "container.name";
|
|
2275
|
-
/**
|
|
2276
|
-
* The CPU architecture the host system is running on.
|
|
2277
|
-
*
|
|
2278
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2279
|
-
*/
|
|
2280
|
-
exports.ATTR_HOST_ARCH = "host.arch";
|
|
2281
|
-
/**
|
|
2282
|
-
* Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system.
|
|
2283
|
-
*
|
|
2284
|
-
* @example fdbf79e8af94cb7f9e8df36789187052
|
|
2285
|
-
*
|
|
2286
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2287
|
-
*/
|
|
2288
|
-
exports.ATTR_HOST_ID = "host.id";
|
|
2289
|
-
/**
|
|
2290
|
-
* VM image ID or host OS image ID. For Cloud, this value is from the provider.
|
|
2291
|
-
*
|
|
2292
|
-
* @example ami-07b06b442921831e5
|
|
2293
|
-
*
|
|
2294
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2295
|
-
*/
|
|
2296
|
-
exports.ATTR_HOST_IMAGE_ID = "host.image.id";
|
|
2297
|
-
/**
|
|
2298
|
-
* Name of the VM image or OS install the host was instantiated from.
|
|
2299
|
-
*
|
|
2300
|
-
* @example infra-ami-eks-worker-node-7d4ec78312
|
|
2301
|
-
* @example CentOS-8-x86_64-1905
|
|
2302
|
-
*
|
|
2303
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2304
|
-
*/
|
|
2305
|
-
exports.ATTR_HOST_IMAGE_NAME = "host.image.name";
|
|
2306
|
-
/**
|
|
2307
|
-
* The version string of the VM image or host OS as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
|
|
2308
|
-
*
|
|
2309
|
-
* @example 0.1
|
|
2310
|
-
*
|
|
2311
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2312
|
-
*/
|
|
2313
|
-
exports.ATTR_HOST_IMAGE_VERSION = "host.image.version";
|
|
2314
|
-
/**
|
|
2315
|
-
* Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.
|
|
2316
|
-
*
|
|
2317
|
-
* @example opentelemetry-test
|
|
2318
|
-
*
|
|
2319
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2320
|
-
*/
|
|
2321
|
-
exports.ATTR_HOST_NAME = "host.name";
|
|
2322
|
-
/**
|
|
2323
|
-
* Type of host. For Cloud, this must be the machine type.
|
|
2324
|
-
*
|
|
2325
|
-
* @example n1-standard-1
|
|
2326
|
-
*
|
|
2327
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2328
|
-
*/
|
|
2329
|
-
exports.ATTR_HOST_TYPE = "host.type";
|
|
2330
|
-
/**
|
|
2331
|
-
* The name of the cluster.
|
|
2332
|
-
*
|
|
2333
|
-
* @example opentelemetry-cluster
|
|
2334
|
-
*
|
|
2335
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2336
|
-
*/
|
|
2337
|
-
exports.ATTR_K8S_CLUSTER_NAME = "k8s.cluster.name";
|
|
2338
|
-
/**
|
|
2339
|
-
* The name of the Deployment.
|
|
2340
|
-
*
|
|
2341
|
-
* @example opentelemetry
|
|
2342
|
-
*
|
|
2343
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2344
|
-
*/
|
|
2345
|
-
exports.ATTR_K8S_DEPLOYMENT_NAME = "k8s.deployment.name";
|
|
2346
|
-
/**
|
|
2347
|
-
* The name of the namespace that the pod is running in.
|
|
2348
|
-
*
|
|
2349
|
-
* @example default
|
|
2350
|
-
*
|
|
2351
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2352
|
-
*/
|
|
2353
|
-
exports.ATTR_K8S_NAMESPACE_NAME = "k8s.namespace.name";
|
|
2354
|
-
/**
|
|
2355
|
-
* The name of the Pod.
|
|
2356
|
-
*
|
|
2357
|
-
* @example opentelemetry-pod-autoconf
|
|
2358
|
-
*
|
|
2359
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2360
|
-
*/
|
|
2361
|
-
exports.ATTR_K8S_POD_NAME = "k8s.pod.name";
|
|
2362
|
-
/**
|
|
2363
|
-
* The operating system type.
|
|
2364
|
-
*
|
|
2365
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2366
|
-
*/
|
|
2367
|
-
exports.ATTR_OS_TYPE = "os.type";
|
|
2368
|
-
/**
|
|
2369
|
-
* The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
|
|
2370
|
-
*
|
|
2371
|
-
* @example 14.2.1
|
|
2372
|
-
* @example 18.04.1
|
|
2373
|
-
*
|
|
2374
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2375
|
-
*/
|
|
2376
|
-
exports.ATTR_OS_VERSION = "os.version";
|
|
2377
|
-
/**
|
|
2378
|
-
* The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`.
|
|
2379
|
-
*
|
|
2380
|
-
* @example cmd/otelcol
|
|
2381
|
-
*
|
|
2382
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2383
|
-
*/
|
|
2384
|
-
exports.ATTR_PROCESS_COMMAND = "process.command";
|
|
2385
|
-
/**
|
|
2386
|
-
* All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`.
|
|
2387
|
-
*
|
|
2388
|
-
* @example ["cmd/otecol", "--config=config.yaml"]
|
|
2389
|
-
*
|
|
2390
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2391
|
-
*/
|
|
2392
|
-
exports.ATTR_PROCESS_COMMAND_ARGS = "process.command_args";
|
|
2393
|
-
/**
|
|
2394
|
-
* The name of the process executable. On Linux based systems, this **SHOULD** be set to the base name of the target of `/proc/[pid]/exe`. On Windows, this **SHOULD** be set to the base name of `GetProcessImageFileNameW`.
|
|
2395
|
-
*
|
|
2396
|
-
* @example otelcol
|
|
2397
|
-
*
|
|
2398
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2399
|
-
*/
|
|
2400
|
-
exports.ATTR_PROCESS_EXECUTABLE_NAME = "process.executable.name";
|
|
2401
|
-
/**
|
|
2402
|
-
* The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`.
|
|
2403
|
-
*
|
|
2404
|
-
* @example /usr/bin/cmd/otelcol
|
|
2405
|
-
*
|
|
2406
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2407
|
-
*/
|
|
2408
|
-
exports.ATTR_PROCESS_EXECUTABLE_PATH = "process.executable.path";
|
|
2409
|
-
/**
|
|
2410
|
-
* The username of the user that owns the process.
|
|
2411
|
-
*
|
|
2412
|
-
* @example root
|
|
2413
|
-
*
|
|
2414
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2415
|
-
*/
|
|
2416
|
-
exports.ATTR_PROCESS_OWNER = "process.owner";
|
|
2417
|
-
/**
|
|
2418
|
-
* Process identifier (PID).
|
|
2419
|
-
*
|
|
2420
|
-
* @example 1234
|
|
2421
|
-
*
|
|
2422
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2423
|
-
*/
|
|
2424
|
-
exports.ATTR_PROCESS_PID = "process.pid";
|
|
2425
|
-
/**
|
|
2426
|
-
* An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment.
|
|
2427
|
-
*
|
|
2428
|
-
* @example "Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0"
|
|
2429
|
-
*
|
|
2430
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2431
|
-
*/
|
|
2432
|
-
exports.ATTR_PROCESS_RUNTIME_DESCRIPTION = "process.runtime.description";
|
|
2433
|
-
/**
|
|
2434
|
-
* The name of the runtime of this process.
|
|
2435
|
-
*
|
|
2436
|
-
* @example OpenJDK Runtime Environment
|
|
2437
|
-
*
|
|
2438
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2439
|
-
*/
|
|
2440
|
-
exports.ATTR_PROCESS_RUNTIME_NAME = "process.runtime.name";
|
|
2441
|
-
/**
|
|
2442
|
-
* The version of the runtime of this process, as returned by the runtime without modification.
|
|
2443
|
-
*
|
|
2444
|
-
* @example "14.0.2"
|
|
2445
|
-
*
|
|
2446
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2447
|
-
*/
|
|
2448
|
-
exports.ATTR_PROCESS_RUNTIME_VERSION = "process.runtime.version";
|
|
2449
|
-
/**
|
|
2450
|
-
* The string ID of the service instance.
|
|
2451
|
-
*
|
|
2452
|
-
* @example 627cc493-f310-47de-96bd-71410b7dec09
|
|
2453
|
-
*
|
|
2454
|
-
* @note **MUST** be unique for each instance of the same `service.namespace,service.name` pair (in other words
|
|
2455
|
-
* `service.namespace,service.name,service.instance.id` triplet **MUST** be globally unique). The ID helps to
|
|
2456
|
-
* distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
|
|
2457
|
-
* service).
|
|
2458
|
-
*
|
|
2459
|
-
* Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
|
|
2460
|
-
* 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
|
|
2461
|
-
* this value if stability is desirable. In that case, the ID **SHOULD** be used as source of a UUID Version 5 and
|
|
2462
|
-
* **SHOULD** use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
|
|
2463
|
-
*
|
|
2464
|
-
* UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
|
|
2465
|
-
* needed. Similar to what can be seen in the man page for the
|
|
2466
|
-
* [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/latest/machine-id.html) file, the underlying
|
|
2467
|
-
* data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
|
|
2468
|
-
* or not via another resource attribute.
|
|
2469
|
-
*
|
|
2470
|
-
* For applications running behind an application server (like unicorn), we do not recommend using one identifier
|
|
2471
|
-
* for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
|
|
2472
|
-
* thread in unicorn) to have its own instance.id.
|
|
2473
|
-
*
|
|
2474
|
-
* It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
|
|
2475
|
-
* service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
|
|
2476
|
-
* likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
|
|
2477
|
-
* However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
|
|
2478
|
-
* for that telemetry. This is typically the case for scraping receivers, as they know the target address and
|
|
2479
|
-
* port.
|
|
2480
|
-
*
|
|
2481
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2482
|
-
*/
|
|
2483
|
-
exports.ATTR_SERVICE_INSTANCE_ID = "service.instance.id";
|
|
2484
|
-
/**
|
|
2485
|
-
* A namespace for `service.name`.
|
|
2486
|
-
*
|
|
2487
|
-
* @example Shop
|
|
2488
|
-
*
|
|
2489
|
-
* @note A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.
|
|
2490
|
-
*
|
|
2491
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2492
|
-
*/
|
|
2493
|
-
exports.ATTR_SERVICE_NAMESPACE = "service.namespace";
|
|
2494
|
-
/**
|
|
2495
|
-
* Additional description of the web engine (e.g. detailed version and edition information).
|
|
2496
|
-
*
|
|
2497
|
-
* @example WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final
|
|
2498
|
-
*
|
|
2499
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2500
|
-
*/
|
|
2501
|
-
exports.ATTR_WEBENGINE_DESCRIPTION = "webengine.description";
|
|
2502
|
-
/**
|
|
2503
|
-
* The name of the web engine.
|
|
2504
|
-
*
|
|
2505
|
-
* @example WildFly
|
|
2506
|
-
*
|
|
2507
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2508
|
-
*/
|
|
2509
|
-
exports.ATTR_WEBENGINE_NAME = "webengine.name";
|
|
2510
|
-
/**
|
|
2511
|
-
* The version of the web engine.
|
|
2512
|
-
*
|
|
2513
|
-
* @example 21.0.0
|
|
2514
|
-
*
|
|
2515
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
2516
|
-
*/
|
|
2517
|
-
exports.ATTR_WEBENGINE_VERSION = "webengine.version";
|
|
2518
|
-
}));
|
|
2519
|
-
//#endregion
|
|
2520
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId.js
|
|
2521
|
-
var require_getMachineId = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2522
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2523
|
-
exports.getMachineId = void 0;
|
|
2524
|
-
const process$1 = __require("process");
|
|
2525
|
-
let getMachineIdImpl;
|
|
2526
|
-
async function getMachineId() {
|
|
2527
|
-
if (!getMachineIdImpl) switch (process$1.platform) {
|
|
2528
|
-
case "darwin":
|
|
2529
|
-
getMachineIdImpl = (await import("../getMachineId-darwin-CVjKuDgj.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
2530
|
-
break;
|
|
2531
|
-
case "linux":
|
|
2532
|
-
getMachineIdImpl = (await import("../getMachineId-linux-DbG4BXa-.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
2533
|
-
break;
|
|
2534
|
-
case "freebsd":
|
|
2535
|
-
getMachineIdImpl = (await import("../getMachineId-bsd-Bn0le7-J.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
2536
|
-
break;
|
|
2537
|
-
case "win32":
|
|
2538
|
-
getMachineIdImpl = (await import("../getMachineId-win-c5zxTSS1.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
2539
|
-
break;
|
|
2540
|
-
default:
|
|
2541
|
-
getMachineIdImpl = (await import("../getMachineId-unsupported-lC8T9hPE.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
2542
|
-
break;
|
|
2543
|
-
}
|
|
2544
|
-
return getMachineIdImpl();
|
|
2545
|
-
}
|
|
2546
|
-
exports.getMachineId = getMachineId;
|
|
2547
|
-
}));
|
|
2548
|
-
//#endregion
|
|
2549
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/utils.js
|
|
2550
|
-
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2551
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2552
|
-
exports.normalizeType = exports.normalizeArch = void 0;
|
|
2553
|
-
const normalizeArch = (nodeArchString) => {
|
|
2554
|
-
switch (nodeArchString) {
|
|
2555
|
-
case "arm": return "arm32";
|
|
2556
|
-
case "ppc": return "ppc32";
|
|
2557
|
-
case "x64": return "amd64";
|
|
2558
|
-
default: return nodeArchString;
|
|
2559
|
-
}
|
|
2560
|
-
};
|
|
2561
|
-
exports.normalizeArch = normalizeArch;
|
|
2562
|
-
const normalizeType = (nodePlatform) => {
|
|
2563
|
-
switch (nodePlatform) {
|
|
2564
|
-
case "sunos": return "solaris";
|
|
2565
|
-
case "win32": return "windows";
|
|
2566
|
-
default: return nodePlatform;
|
|
2567
|
-
}
|
|
2568
|
-
};
|
|
2569
|
-
exports.normalizeType = normalizeType;
|
|
2570
|
-
}));
|
|
2571
|
-
//#endregion
|
|
2572
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/HostDetector.js
|
|
2573
|
-
var require_HostDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2574
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2575
|
-
exports.hostDetector = void 0;
|
|
2576
|
-
const semconv_1 = require_semconv();
|
|
2577
|
-
const os_1$1 = __require("os");
|
|
2578
|
-
const getMachineId_1 = require_getMachineId();
|
|
2579
|
-
const utils_1 = require_utils();
|
|
2580
|
-
/**
|
|
2581
|
-
* HostDetector detects the resources related to the host current process is
|
|
2582
|
-
* running on. Currently only non-cloud-based attributes are included.
|
|
2583
|
-
*/
|
|
2584
|
-
var HostDetector = class {
|
|
2585
|
-
detect(_config) {
|
|
2586
|
-
return { attributes: {
|
|
2587
|
-
[semconv_1.ATTR_HOST_NAME]: (0, os_1$1.hostname)(),
|
|
2588
|
-
[semconv_1.ATTR_HOST_ARCH]: (0, utils_1.normalizeArch)((0, os_1$1.arch)()),
|
|
2589
|
-
[semconv_1.ATTR_HOST_ID]: (0, getMachineId_1.getMachineId)()
|
|
2590
|
-
} };
|
|
2591
|
-
}
|
|
2592
|
-
};
|
|
2593
|
-
exports.hostDetector = new HostDetector();
|
|
2594
|
-
}));
|
|
2595
|
-
//#endregion
|
|
2596
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/OSDetector.js
|
|
2597
|
-
var require_OSDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2598
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2599
|
-
exports.osDetector = void 0;
|
|
2600
|
-
const semconv_1 = require_semconv();
|
|
2601
|
-
const os_1 = __require("os");
|
|
2602
|
-
const utils_1 = require_utils();
|
|
2603
|
-
/**
|
|
2604
|
-
* OSDetector detects the resources related to the operating system (OS) on
|
|
2605
|
-
* which the process represented by this resource is running.
|
|
2606
|
-
*/
|
|
2607
|
-
var OSDetector = class {
|
|
2608
|
-
detect(_config) {
|
|
2609
|
-
return { attributes: {
|
|
2610
|
-
[semconv_1.ATTR_OS_TYPE]: (0, utils_1.normalizeType)((0, os_1.platform)()),
|
|
2611
|
-
[semconv_1.ATTR_OS_VERSION]: (0, os_1.release)()
|
|
2612
|
-
} };
|
|
2613
|
-
}
|
|
2614
|
-
};
|
|
2615
|
-
exports.osDetector = new OSDetector();
|
|
2616
|
-
}));
|
|
2617
|
-
//#endregion
|
|
2618
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/ProcessDetector.js
|
|
2619
|
-
var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2620
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2621
|
-
exports.processDetector = void 0;
|
|
2622
|
-
const api_1$5 = __require("@opentelemetry/api");
|
|
2623
|
-
const semconv_1 = require_semconv();
|
|
2624
|
-
const os = __require("os");
|
|
2625
|
-
/**
|
|
2626
|
-
* ProcessDetector will be used to detect the resources related current process running
|
|
2627
|
-
* and being instrumented from the NodeJS Process module.
|
|
2628
|
-
*/
|
|
2629
|
-
var ProcessDetector = class {
|
|
2630
|
-
detect(_config) {
|
|
2631
|
-
const attributes = {
|
|
2632
|
-
[semconv_1.ATTR_PROCESS_PID]: process.pid,
|
|
2633
|
-
[semconv_1.ATTR_PROCESS_EXECUTABLE_NAME]: process.title,
|
|
2634
|
-
[semconv_1.ATTR_PROCESS_EXECUTABLE_PATH]: process.execPath,
|
|
2635
|
-
[semconv_1.ATTR_PROCESS_COMMAND_ARGS]: [
|
|
2636
|
-
process.argv[0],
|
|
2637
|
-
...process.execArgv,
|
|
2638
|
-
...process.argv.slice(1)
|
|
2639
|
-
],
|
|
2640
|
-
[semconv_1.ATTR_PROCESS_RUNTIME_VERSION]: process.versions.node,
|
|
2641
|
-
[semconv_1.ATTR_PROCESS_RUNTIME_NAME]: "nodejs",
|
|
2642
|
-
[semconv_1.ATTR_PROCESS_RUNTIME_DESCRIPTION]: "Node.js"
|
|
2643
|
-
};
|
|
2644
|
-
if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
2645
|
-
try {
|
|
2646
|
-
const userInfo = os.userInfo();
|
|
2647
|
-
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
|
|
2648
|
-
} catch (e) {
|
|
2649
|
-
api_1$5.diag.debug(`error obtaining process owner: ${e}`);
|
|
2650
|
-
}
|
|
2651
|
-
return { attributes };
|
|
2652
|
-
}
|
|
2653
|
-
};
|
|
2654
|
-
exports.processDetector = new ProcessDetector();
|
|
2655
|
-
}));
|
|
2656
|
-
//#endregion
|
|
2657
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/ServiceInstanceIdDetector.js
|
|
2658
|
-
var require_ServiceInstanceIdDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2659
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2660
|
-
exports.serviceInstanceIdDetector = void 0;
|
|
2661
|
-
const semconv_1 = require_semconv();
|
|
2662
|
-
const crypto_1 = __require("crypto");
|
|
2663
|
-
/**
|
|
2664
|
-
* ServiceInstanceIdDetector detects the resources related to the service instance ID.
|
|
2665
|
-
*/
|
|
2666
|
-
var ServiceInstanceIdDetector = class {
|
|
2667
|
-
detect(_config) {
|
|
2668
|
-
return { attributes: { [semconv_1.ATTR_SERVICE_INSTANCE_ID]: (0, crypto_1.randomUUID)() } };
|
|
2669
|
-
}
|
|
2670
|
-
};
|
|
2671
|
-
/**
|
|
2672
|
-
* @experimental
|
|
2673
|
-
*/
|
|
2674
|
-
exports.serviceInstanceIdDetector = new ServiceInstanceIdDetector();
|
|
2675
|
-
}));
|
|
2676
|
-
//#endregion
|
|
2677
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/index.js
|
|
2678
|
-
var require_node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2679
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2680
|
-
exports.serviceInstanceIdDetector = exports.processDetector = exports.osDetector = exports.hostDetector = void 0;
|
|
2681
|
-
var HostDetector_1 = require_HostDetector();
|
|
2682
|
-
Object.defineProperty(exports, "hostDetector", {
|
|
2683
|
-
enumerable: true,
|
|
2684
|
-
get: function() {
|
|
2685
|
-
return HostDetector_1.hostDetector;
|
|
2686
|
-
}
|
|
2687
|
-
});
|
|
2688
|
-
var OSDetector_1 = require_OSDetector();
|
|
2689
|
-
Object.defineProperty(exports, "osDetector", {
|
|
2690
|
-
enumerable: true,
|
|
2691
|
-
get: function() {
|
|
2692
|
-
return OSDetector_1.osDetector;
|
|
2693
|
-
}
|
|
2694
|
-
});
|
|
2695
|
-
var ProcessDetector_1 = require_ProcessDetector();
|
|
2696
|
-
Object.defineProperty(exports, "processDetector", {
|
|
2697
|
-
enumerable: true,
|
|
2698
|
-
get: function() {
|
|
2699
|
-
return ProcessDetector_1.processDetector;
|
|
2700
|
-
}
|
|
2701
|
-
});
|
|
2702
|
-
var ServiceInstanceIdDetector_1 = require_ServiceInstanceIdDetector();
|
|
2703
|
-
Object.defineProperty(exports, "serviceInstanceIdDetector", {
|
|
2704
|
-
enumerable: true,
|
|
2705
|
-
get: function() {
|
|
2706
|
-
return ServiceInstanceIdDetector_1.serviceInstanceIdDetector;
|
|
2707
|
-
}
|
|
2708
|
-
});
|
|
2709
|
-
}));
|
|
2710
|
-
//#endregion
|
|
2711
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/index.js
|
|
2712
|
-
var require_platform = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2713
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2714
|
-
exports.serviceInstanceIdDetector = exports.processDetector = exports.osDetector = exports.hostDetector = void 0;
|
|
2715
|
-
var node_1 = require_node();
|
|
2716
|
-
Object.defineProperty(exports, "hostDetector", {
|
|
2717
|
-
enumerable: true,
|
|
2718
|
-
get: function() {
|
|
2719
|
-
return node_1.hostDetector;
|
|
2720
|
-
}
|
|
2721
|
-
});
|
|
2722
|
-
Object.defineProperty(exports, "osDetector", {
|
|
2723
|
-
enumerable: true,
|
|
2724
|
-
get: function() {
|
|
2725
|
-
return node_1.osDetector;
|
|
2726
|
-
}
|
|
2727
|
-
});
|
|
2728
|
-
Object.defineProperty(exports, "processDetector", {
|
|
2729
|
-
enumerable: true,
|
|
2730
|
-
get: function() {
|
|
2731
|
-
return node_1.processDetector;
|
|
2732
|
-
}
|
|
2733
|
-
});
|
|
2734
|
-
Object.defineProperty(exports, "serviceInstanceIdDetector", {
|
|
2735
|
-
enumerable: true,
|
|
2736
|
-
get: function() {
|
|
2737
|
-
return node_1.serviceInstanceIdDetector;
|
|
2738
|
-
}
|
|
2739
|
-
});
|
|
2740
|
-
}));
|
|
2741
|
-
//#endregion
|
|
2742
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/NoopDetector.js
|
|
2743
|
-
var require_NoopDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2744
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2745
|
-
exports.noopDetector = exports.NoopDetector = void 0;
|
|
2746
|
-
var NoopDetector = class {
|
|
2747
|
-
detect() {
|
|
2748
|
-
return { attributes: {} };
|
|
2749
|
-
}
|
|
2750
|
-
};
|
|
2751
|
-
exports.NoopDetector = NoopDetector;
|
|
2752
|
-
exports.noopDetector = new NoopDetector();
|
|
2753
|
-
}));
|
|
2754
|
-
//#endregion
|
|
2755
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/index.js
|
|
2756
|
-
var require_detectors = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2757
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2758
|
-
exports.noopDetector = exports.serviceInstanceIdDetector = exports.processDetector = exports.osDetector = exports.hostDetector = exports.envDetector = void 0;
|
|
2759
|
-
var EnvDetector_1 = require_EnvDetector();
|
|
2760
|
-
Object.defineProperty(exports, "envDetector", {
|
|
2761
|
-
enumerable: true,
|
|
2762
|
-
get: function() {
|
|
2763
|
-
return EnvDetector_1.envDetector;
|
|
2764
|
-
}
|
|
2765
|
-
});
|
|
2766
|
-
var platform_1 = require_platform();
|
|
2767
|
-
Object.defineProperty(exports, "hostDetector", {
|
|
2768
|
-
enumerable: true,
|
|
2769
|
-
get: function() {
|
|
2770
|
-
return platform_1.hostDetector;
|
|
2771
|
-
}
|
|
2772
|
-
});
|
|
2773
|
-
Object.defineProperty(exports, "osDetector", {
|
|
2774
|
-
enumerable: true,
|
|
2775
|
-
get: function() {
|
|
2776
|
-
return platform_1.osDetector;
|
|
2777
|
-
}
|
|
2778
|
-
});
|
|
2779
|
-
Object.defineProperty(exports, "processDetector", {
|
|
2780
|
-
enumerable: true,
|
|
2781
|
-
get: function() {
|
|
2782
|
-
return platform_1.processDetector;
|
|
2783
|
-
}
|
|
2784
|
-
});
|
|
2785
|
-
Object.defineProperty(exports, "serviceInstanceIdDetector", {
|
|
2786
|
-
enumerable: true,
|
|
2787
|
-
get: function() {
|
|
2788
|
-
return platform_1.serviceInstanceIdDetector;
|
|
2789
|
-
}
|
|
2790
|
-
});
|
|
2791
|
-
var NoopDetector_1 = require_NoopDetector();
|
|
2792
|
-
Object.defineProperty(exports, "noopDetector", {
|
|
2793
|
-
enumerable: true,
|
|
2794
|
-
get: function() {
|
|
2795
|
-
return NoopDetector_1.noopDetector;
|
|
2796
|
-
}
|
|
2797
|
-
});
|
|
2798
|
-
}));
|
|
2799
|
-
//#endregion
|
|
2800
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/index.js
|
|
2801
|
-
var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2802
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2803
|
-
exports.defaultServiceName = exports.emptyResource = exports.defaultResource = exports.resourceFromAttributes = exports.serviceInstanceIdDetector = exports.processDetector = exports.osDetector = exports.hostDetector = exports.envDetector = exports.detectResources = void 0;
|
|
2804
|
-
var detect_resources_1 = require_detect_resources();
|
|
2805
|
-
Object.defineProperty(exports, "detectResources", {
|
|
2806
|
-
enumerable: true,
|
|
2807
|
-
get: function() {
|
|
2808
|
-
return detect_resources_1.detectResources;
|
|
2809
|
-
}
|
|
2810
|
-
});
|
|
2811
|
-
var detectors_1 = require_detectors();
|
|
2812
|
-
Object.defineProperty(exports, "envDetector", {
|
|
2813
|
-
enumerable: true,
|
|
2814
|
-
get: function() {
|
|
2815
|
-
return detectors_1.envDetector;
|
|
2816
|
-
}
|
|
2817
|
-
});
|
|
2818
|
-
Object.defineProperty(exports, "hostDetector", {
|
|
2819
|
-
enumerable: true,
|
|
2820
|
-
get: function() {
|
|
2821
|
-
return detectors_1.hostDetector;
|
|
2822
|
-
}
|
|
2823
|
-
});
|
|
2824
|
-
Object.defineProperty(exports, "osDetector", {
|
|
2825
|
-
enumerable: true,
|
|
2826
|
-
get: function() {
|
|
2827
|
-
return detectors_1.osDetector;
|
|
2828
|
-
}
|
|
2829
|
-
});
|
|
2830
|
-
Object.defineProperty(exports, "processDetector", {
|
|
2831
|
-
enumerable: true,
|
|
2832
|
-
get: function() {
|
|
2833
|
-
return detectors_1.processDetector;
|
|
2834
|
-
}
|
|
2835
|
-
});
|
|
2836
|
-
Object.defineProperty(exports, "serviceInstanceIdDetector", {
|
|
2837
|
-
enumerable: true,
|
|
2838
|
-
get: function() {
|
|
2839
|
-
return detectors_1.serviceInstanceIdDetector;
|
|
2840
|
-
}
|
|
2841
|
-
});
|
|
2842
|
-
var ResourceImpl_1 = require_ResourceImpl();
|
|
2843
|
-
Object.defineProperty(exports, "resourceFromAttributes", {
|
|
2844
|
-
enumerable: true,
|
|
2845
|
-
get: function() {
|
|
2846
|
-
return ResourceImpl_1.resourceFromAttributes;
|
|
2847
|
-
}
|
|
2848
|
-
});
|
|
2849
|
-
Object.defineProperty(exports, "defaultResource", {
|
|
2850
|
-
enumerable: true,
|
|
2851
|
-
get: function() {
|
|
2852
|
-
return ResourceImpl_1.defaultResource;
|
|
2853
|
-
}
|
|
2854
|
-
});
|
|
2855
|
-
Object.defineProperty(exports, "emptyResource", {
|
|
2856
|
-
enumerable: true,
|
|
2857
|
-
get: function() {
|
|
2858
|
-
return ResourceImpl_1.emptyResource;
|
|
2859
|
-
}
|
|
2860
|
-
});
|
|
2861
|
-
var default_service_name_1 = require_default_service_name();
|
|
2862
|
-
Object.defineProperty(exports, "defaultServiceName", {
|
|
2863
|
-
enumerable: true,
|
|
2864
|
-
get: function() {
|
|
2865
|
-
return default_service_name_1.defaultServiceName;
|
|
2866
|
-
}
|
|
2867
|
-
});
|
|
2868
|
-
}));
|
|
2869
|
-
//#endregion
|
|
2870
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/ViewRegistry.js
|
|
2871
|
-
var require_ViewRegistry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2872
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2873
|
-
exports.ViewRegistry = void 0;
|
|
2874
|
-
var ViewRegistry = class {
|
|
2875
|
-
_registeredViews = [];
|
|
2876
|
-
addView(view) {
|
|
2877
|
-
this._registeredViews.push(view);
|
|
2878
|
-
}
|
|
2879
|
-
findViews(instrument, meter) {
|
|
2880
|
-
return this._registeredViews.filter((registeredView) => {
|
|
2881
|
-
return this._matchInstrument(registeredView.instrumentSelector, instrument) && this._matchMeter(registeredView.meterSelector, meter);
|
|
2882
|
-
});
|
|
2883
|
-
}
|
|
2884
|
-
_matchInstrument(selector, instrument) {
|
|
2885
|
-
return (selector.getType() === void 0 || instrument.type === selector.getType()) && selector.getNameFilter().match(instrument.name) && selector.getUnitFilter().match(instrument.unit);
|
|
2886
|
-
}
|
|
2887
|
-
_matchMeter(selector, meter) {
|
|
2888
|
-
return selector.getNameFilter().match(meter.name) && (meter.version === void 0 || selector.getVersionFilter().match(meter.version)) && (meter.schemaUrl === void 0 || selector.getSchemaUrlFilter().match(meter.schemaUrl));
|
|
2889
|
-
}
|
|
2890
|
-
};
|
|
2891
|
-
exports.ViewRegistry = ViewRegistry;
|
|
2892
|
-
}));
|
|
2893
|
-
//#endregion
|
|
2894
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.js
|
|
2895
|
-
var require_InstrumentDescriptor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2896
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2897
|
-
exports.isValidName = exports.isDescriptorCompatibleWith = exports.createInstrumentDescriptorWithView = exports.createInstrumentDescriptor = void 0;
|
|
2898
|
-
const api_1$4 = __require("@opentelemetry/api");
|
|
2899
|
-
const utils_1 = require_utils$2();
|
|
2900
|
-
function createInstrumentDescriptor(name, type, options) {
|
|
2901
|
-
if (!isValidName(name)) api_1$4.diag.warn(`Invalid metric name: "${name}". The metric name should be a ASCII string with a length no greater than 255 characters.`);
|
|
2902
|
-
return {
|
|
2903
|
-
name,
|
|
2904
|
-
type,
|
|
2905
|
-
description: options?.description ?? "",
|
|
2906
|
-
unit: options?.unit ?? "",
|
|
2907
|
-
valueType: options?.valueType ?? api_1$4.ValueType.DOUBLE,
|
|
2908
|
-
advice: options?.advice ?? {}
|
|
2909
|
-
};
|
|
2910
|
-
}
|
|
2911
|
-
exports.createInstrumentDescriptor = createInstrumentDescriptor;
|
|
2912
|
-
function createInstrumentDescriptorWithView(view, instrument) {
|
|
2913
|
-
return {
|
|
2914
|
-
name: view.name ?? instrument.name,
|
|
2915
|
-
description: view.description ?? instrument.description,
|
|
2916
|
-
type: instrument.type,
|
|
2917
|
-
unit: instrument.unit,
|
|
2918
|
-
valueType: instrument.valueType,
|
|
2919
|
-
advice: instrument.advice
|
|
2920
|
-
};
|
|
2921
|
-
}
|
|
2922
|
-
exports.createInstrumentDescriptorWithView = createInstrumentDescriptorWithView;
|
|
2923
|
-
function isDescriptorCompatibleWith(descriptor, otherDescriptor) {
|
|
2924
|
-
return (0, utils_1.equalsCaseInsensitive)(descriptor.name, otherDescriptor.name) && descriptor.unit === otherDescriptor.unit && descriptor.type === otherDescriptor.type && descriptor.valueType === otherDescriptor.valueType;
|
|
2925
|
-
}
|
|
2926
|
-
exports.isDescriptorCompatibleWith = isDescriptorCompatibleWith;
|
|
2927
|
-
const NAME_REGEXP = /^[a-z][a-z0-9_.\-/]{0,254}$/i;
|
|
2928
|
-
function isValidName(name) {
|
|
2929
|
-
return NAME_REGEXP.test(name);
|
|
2930
|
-
}
|
|
2931
|
-
exports.isValidName = isValidName;
|
|
2932
|
-
}));
|
|
2933
|
-
//#endregion
|
|
2934
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/Instruments.js
|
|
2935
|
-
var require_Instruments = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2936
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2937
|
-
exports.isObservableInstrument = exports.ObservableUpDownCounterInstrument = exports.ObservableGaugeInstrument = exports.ObservableCounterInstrument = exports.ObservableInstrument = exports.HistogramInstrument = exports.GaugeInstrument = exports.CounterInstrument = exports.UpDownCounterInstrument = exports.SyncInstrument = void 0;
|
|
2938
|
-
const api_1$3 = __require("@opentelemetry/api");
|
|
2939
|
-
const core_1$1 = __require("@opentelemetry/core");
|
|
2940
|
-
var SyncInstrument = class {
|
|
2941
|
-
_writableMetricStorage;
|
|
2942
|
-
_descriptor;
|
|
2943
|
-
constructor(writableMetricStorage, descriptor) {
|
|
2944
|
-
this._writableMetricStorage = writableMetricStorage;
|
|
2945
|
-
this._descriptor = descriptor;
|
|
2946
|
-
}
|
|
2947
|
-
_record(value, attributes = {}, context = api_1$3.context.active()) {
|
|
2948
|
-
if (typeof value !== "number") {
|
|
2949
|
-
api_1$3.diag.warn(`non-number value provided to metric ${this._descriptor.name}: ${value}`);
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
if (this._descriptor.valueType === api_1$3.ValueType.INT && !Number.isInteger(value)) {
|
|
2953
|
-
api_1$3.diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`);
|
|
2954
|
-
value = Math.trunc(value);
|
|
2955
|
-
if (!Number.isInteger(value)) return;
|
|
2956
|
-
}
|
|
2957
|
-
this._writableMetricStorage.record(value, attributes, context, (0, core_1$1.millisToHrTime)(Date.now()));
|
|
2958
|
-
}
|
|
2959
|
-
};
|
|
2960
|
-
exports.SyncInstrument = SyncInstrument;
|
|
2961
|
-
/**
|
|
2962
|
-
* The class implements {@link UpDownCounter} interface.
|
|
2963
|
-
*/
|
|
2964
|
-
var UpDownCounterInstrument = class extends SyncInstrument {
|
|
2965
|
-
/**
|
|
2966
|
-
* Increment value of counter by the input. Inputs may be negative.
|
|
2967
|
-
*/
|
|
2968
|
-
add(value, attributes, ctx) {
|
|
2969
|
-
this._record(value, attributes, ctx);
|
|
2970
|
-
}
|
|
2971
|
-
};
|
|
2972
|
-
exports.UpDownCounterInstrument = UpDownCounterInstrument;
|
|
2973
|
-
/**
|
|
2974
|
-
* The class implements {@link Counter} interface.
|
|
2975
|
-
*/
|
|
2976
|
-
var CounterInstrument = class extends SyncInstrument {
|
|
2977
|
-
/**
|
|
2978
|
-
* Increment value of counter by the input. Inputs may not be negative.
|
|
2979
|
-
*/
|
|
2980
|
-
add(value, attributes, ctx) {
|
|
2981
|
-
if (value < 0) {
|
|
2982
|
-
api_1$3.diag.warn(`negative value provided to counter ${this._descriptor.name}: ${value}`);
|
|
2983
|
-
return;
|
|
2984
|
-
}
|
|
2985
|
-
this._record(value, attributes, ctx);
|
|
2986
|
-
}
|
|
2987
|
-
};
|
|
2988
|
-
exports.CounterInstrument = CounterInstrument;
|
|
2989
|
-
/**
|
|
2990
|
-
* The class implements {@link Gauge} interface.
|
|
2991
|
-
*/
|
|
2992
|
-
var GaugeInstrument = class extends SyncInstrument {
|
|
2993
|
-
/**
|
|
2994
|
-
* Records a measurement.
|
|
2995
|
-
*/
|
|
2996
|
-
record(value, attributes, ctx) {
|
|
2997
|
-
this._record(value, attributes, ctx);
|
|
2998
|
-
}
|
|
2999
|
-
};
|
|
3000
|
-
exports.GaugeInstrument = GaugeInstrument;
|
|
3001
|
-
/**
|
|
3002
|
-
* The class implements {@link Histogram} interface.
|
|
3003
|
-
*/
|
|
3004
|
-
var HistogramInstrument = class extends SyncInstrument {
|
|
3005
|
-
/**
|
|
3006
|
-
* Records a measurement. Value of the measurement must not be negative.
|
|
3007
|
-
*/
|
|
3008
|
-
record(value, attributes, ctx) {
|
|
3009
|
-
if (value < 0) {
|
|
3010
|
-
api_1$3.diag.warn(`negative value provided to histogram ${this._descriptor.name}: ${value}`);
|
|
3011
|
-
return;
|
|
3012
|
-
}
|
|
3013
|
-
this._record(value, attributes, ctx);
|
|
3014
|
-
}
|
|
3015
|
-
};
|
|
3016
|
-
exports.HistogramInstrument = HistogramInstrument;
|
|
3017
|
-
var ObservableInstrument = class {
|
|
3018
|
-
/** @internal */
|
|
3019
|
-
_metricStorages;
|
|
3020
|
-
/** @internal */
|
|
3021
|
-
_descriptor;
|
|
3022
|
-
_observableRegistry;
|
|
3023
|
-
constructor(descriptor, metricStorages, observableRegistry) {
|
|
3024
|
-
this._descriptor = descriptor;
|
|
3025
|
-
this._metricStorages = metricStorages;
|
|
3026
|
-
this._observableRegistry = observableRegistry;
|
|
3027
|
-
}
|
|
3028
|
-
/**
|
|
3029
|
-
* @see {Observable.addCallback}
|
|
3030
|
-
*/
|
|
3031
|
-
addCallback(callback) {
|
|
3032
|
-
this._observableRegistry.addCallback(callback, this);
|
|
3033
|
-
}
|
|
3034
|
-
/**
|
|
3035
|
-
* @see {Observable.removeCallback}
|
|
3036
|
-
*/
|
|
3037
|
-
removeCallback(callback) {
|
|
3038
|
-
this._observableRegistry.removeCallback(callback, this);
|
|
3039
|
-
}
|
|
3040
|
-
};
|
|
3041
|
-
exports.ObservableInstrument = ObservableInstrument;
|
|
3042
|
-
var ObservableCounterInstrument = class extends ObservableInstrument {};
|
|
3043
|
-
exports.ObservableCounterInstrument = ObservableCounterInstrument;
|
|
3044
|
-
var ObservableGaugeInstrument = class extends ObservableInstrument {};
|
|
3045
|
-
exports.ObservableGaugeInstrument = ObservableGaugeInstrument;
|
|
3046
|
-
var ObservableUpDownCounterInstrument = class extends ObservableInstrument {};
|
|
3047
|
-
exports.ObservableUpDownCounterInstrument = ObservableUpDownCounterInstrument;
|
|
3048
|
-
function isObservableInstrument(it) {
|
|
3049
|
-
return it instanceof ObservableInstrument;
|
|
3050
|
-
}
|
|
3051
|
-
exports.isObservableInstrument = isObservableInstrument;
|
|
3052
|
-
}));
|
|
3053
|
-
//#endregion
|
|
3054
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/Meter.js
|
|
3055
|
-
var require_Meter = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3056
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3057
|
-
exports.Meter = void 0;
|
|
3058
|
-
const InstrumentDescriptor_1 = require_InstrumentDescriptor();
|
|
3059
|
-
const Instruments_1 = require_Instruments();
|
|
3060
|
-
const MetricData_1 = require_MetricData();
|
|
3061
|
-
/**
|
|
3062
|
-
* This class implements the {@link IMeter} interface.
|
|
3063
|
-
*/
|
|
3064
|
-
var Meter = class {
|
|
3065
|
-
_meterSharedState;
|
|
3066
|
-
constructor(meterSharedState) {
|
|
3067
|
-
this._meterSharedState = meterSharedState;
|
|
3068
|
-
}
|
|
3069
|
-
/**
|
|
3070
|
-
* Create a {@link Gauge} instrument.
|
|
3071
|
-
*/
|
|
3072
|
-
createGauge(name, options) {
|
|
3073
|
-
const descriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(name, MetricData_1.InstrumentType.GAUGE, options);
|
|
3074
|
-
const storage = this._meterSharedState.registerMetricStorage(descriptor);
|
|
3075
|
-
return new Instruments_1.GaugeInstrument(storage, descriptor);
|
|
3076
|
-
}
|
|
3077
|
-
/**
|
|
3078
|
-
* Create a {@link Histogram} instrument.
|
|
3079
|
-
*/
|
|
3080
|
-
createHistogram(name, options) {
|
|
3081
|
-
const descriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(name, MetricData_1.InstrumentType.HISTOGRAM, options);
|
|
3082
|
-
const storage = this._meterSharedState.registerMetricStorage(descriptor);
|
|
3083
|
-
return new Instruments_1.HistogramInstrument(storage, descriptor);
|
|
3084
|
-
}
|
|
3085
|
-
/**
|
|
3086
|
-
* Create a {@link Counter} instrument.
|
|
3087
|
-
*/
|
|
3088
|
-
createCounter(name, options) {
|
|
3089
|
-
const descriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(name, MetricData_1.InstrumentType.COUNTER, options);
|
|
3090
|
-
const storage = this._meterSharedState.registerMetricStorage(descriptor);
|
|
3091
|
-
return new Instruments_1.CounterInstrument(storage, descriptor);
|
|
3092
|
-
}
|
|
3093
|
-
/**
|
|
3094
|
-
* Create a {@link UpDownCounter} instrument.
|
|
3095
|
-
*/
|
|
3096
|
-
createUpDownCounter(name, options) {
|
|
3097
|
-
const descriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(name, MetricData_1.InstrumentType.UP_DOWN_COUNTER, options);
|
|
3098
|
-
const storage = this._meterSharedState.registerMetricStorage(descriptor);
|
|
3099
|
-
return new Instruments_1.UpDownCounterInstrument(storage, descriptor);
|
|
3100
|
-
}
|
|
3101
|
-
/**
|
|
3102
|
-
* Create a {@link ObservableGauge} instrument.
|
|
3103
|
-
*/
|
|
3104
|
-
createObservableGauge(name, options) {
|
|
3105
|
-
const descriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(name, MetricData_1.InstrumentType.OBSERVABLE_GAUGE, options);
|
|
3106
|
-
const storages = this._meterSharedState.registerAsyncMetricStorage(descriptor);
|
|
3107
|
-
return new Instruments_1.ObservableGaugeInstrument(descriptor, storages, this._meterSharedState.observableRegistry);
|
|
3108
|
-
}
|
|
3109
|
-
/**
|
|
3110
|
-
* Create a {@link ObservableCounter} instrument.
|
|
3111
|
-
*/
|
|
3112
|
-
createObservableCounter(name, options) {
|
|
3113
|
-
const descriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(name, MetricData_1.InstrumentType.OBSERVABLE_COUNTER, options);
|
|
3114
|
-
const storages = this._meterSharedState.registerAsyncMetricStorage(descriptor);
|
|
3115
|
-
return new Instruments_1.ObservableCounterInstrument(descriptor, storages, this._meterSharedState.observableRegistry);
|
|
3116
|
-
}
|
|
3117
|
-
/**
|
|
3118
|
-
* Create a {@link ObservableUpDownCounter} instrument.
|
|
3119
|
-
*/
|
|
3120
|
-
createObservableUpDownCounter(name, options) {
|
|
3121
|
-
const descriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(name, MetricData_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER, options);
|
|
3122
|
-
const storages = this._meterSharedState.registerAsyncMetricStorage(descriptor);
|
|
3123
|
-
return new Instruments_1.ObservableUpDownCounterInstrument(descriptor, storages, this._meterSharedState.observableRegistry);
|
|
3124
|
-
}
|
|
3125
|
-
/**
|
|
3126
|
-
* @see {@link Meter.addBatchObservableCallback}
|
|
3127
|
-
*/
|
|
3128
|
-
addBatchObservableCallback(callback, observables) {
|
|
3129
|
-
this._meterSharedState.observableRegistry.addBatchCallback(callback, observables);
|
|
3130
|
-
}
|
|
3131
|
-
/**
|
|
3132
|
-
* @see {@link Meter.removeBatchObservableCallback}
|
|
3133
|
-
*/
|
|
3134
|
-
removeBatchObservableCallback(callback, observables) {
|
|
3135
|
-
this._meterSharedState.observableRegistry.removeBatchCallback(callback, observables);
|
|
3136
|
-
}
|
|
3137
|
-
};
|
|
3138
|
-
exports.Meter = Meter;
|
|
3139
|
-
}));
|
|
3140
|
-
//#endregion
|
|
3141
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorage.js
|
|
3142
|
-
var require_MetricStorage = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3143
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3144
|
-
exports.MetricStorage = void 0;
|
|
3145
|
-
const InstrumentDescriptor_1 = require_InstrumentDescriptor();
|
|
3146
|
-
/**
|
|
3147
|
-
* Internal interface.
|
|
3148
|
-
*
|
|
3149
|
-
* Represents a storage from which we can collect metrics.
|
|
3150
|
-
*/
|
|
3151
|
-
var MetricStorage = class {
|
|
3152
|
-
_instrumentDescriptor;
|
|
3153
|
-
constructor(instrumentDescriptor) {
|
|
3154
|
-
this._instrumentDescriptor = instrumentDescriptor;
|
|
3155
|
-
}
|
|
3156
|
-
getInstrumentDescriptor() {
|
|
3157
|
-
return this._instrumentDescriptor;
|
|
3158
|
-
}
|
|
3159
|
-
updateDescription(description) {
|
|
3160
|
-
this._instrumentDescriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptor)(this._instrumentDescriptor.name, this._instrumentDescriptor.type, {
|
|
3161
|
-
description,
|
|
3162
|
-
valueType: this._instrumentDescriptor.valueType,
|
|
3163
|
-
unit: this._instrumentDescriptor.unit,
|
|
3164
|
-
advice: this._instrumentDescriptor.advice
|
|
3165
|
-
});
|
|
3166
|
-
}
|
|
3167
|
-
};
|
|
3168
|
-
exports.MetricStorage = MetricStorage;
|
|
3169
|
-
}));
|
|
3170
|
-
//#endregion
|
|
3171
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.js
|
|
3172
|
-
var require_HashMap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3173
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3174
|
-
exports.AttributeHashMap = exports.HashMap = void 0;
|
|
3175
|
-
const utils_1 = require_utils$2();
|
|
3176
|
-
var HashMap = class {
|
|
3177
|
-
_valueMap = /* @__PURE__ */ new Map();
|
|
3178
|
-
_keyMap = /* @__PURE__ */ new Map();
|
|
3179
|
-
_hash;
|
|
3180
|
-
constructor(hash) {
|
|
3181
|
-
this._hash = hash;
|
|
3182
|
-
}
|
|
3183
|
-
get(key, hashCode) {
|
|
3184
|
-
hashCode ??= this._hash(key);
|
|
3185
|
-
return this._valueMap.get(hashCode);
|
|
3186
|
-
}
|
|
3187
|
-
getOrDefault(key, defaultFactory) {
|
|
3188
|
-
const hash = this._hash(key);
|
|
3189
|
-
if (this._valueMap.has(hash)) return this._valueMap.get(hash);
|
|
3190
|
-
const val = defaultFactory();
|
|
3191
|
-
if (!this._keyMap.has(hash)) this._keyMap.set(hash, key);
|
|
3192
|
-
this._valueMap.set(hash, val);
|
|
3193
|
-
return val;
|
|
3194
|
-
}
|
|
3195
|
-
set(key, value, hashCode) {
|
|
3196
|
-
hashCode ??= this._hash(key);
|
|
3197
|
-
if (!this._keyMap.has(hashCode)) this._keyMap.set(hashCode, key);
|
|
3198
|
-
this._valueMap.set(hashCode, value);
|
|
3199
|
-
}
|
|
3200
|
-
has(key, hashCode) {
|
|
3201
|
-
hashCode ??= this._hash(key);
|
|
3202
|
-
return this._valueMap.has(hashCode);
|
|
3203
|
-
}
|
|
3204
|
-
*keys() {
|
|
3205
|
-
const keyIterator = this._keyMap.entries();
|
|
3206
|
-
let next = keyIterator.next();
|
|
3207
|
-
while (next.done !== true) {
|
|
3208
|
-
yield [next.value[1], next.value[0]];
|
|
3209
|
-
next = keyIterator.next();
|
|
3210
|
-
}
|
|
3211
|
-
}
|
|
3212
|
-
*entries() {
|
|
3213
|
-
const valueIterator = this._valueMap.entries();
|
|
3214
|
-
let next = valueIterator.next();
|
|
3215
|
-
while (next.done !== true) {
|
|
3216
|
-
yield [
|
|
3217
|
-
this._keyMap.get(next.value[0]),
|
|
3218
|
-
next.value[1],
|
|
3219
|
-
next.value[0]
|
|
3220
|
-
];
|
|
3221
|
-
next = valueIterator.next();
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
get size() {
|
|
3225
|
-
return this._valueMap.size;
|
|
3226
|
-
}
|
|
3227
|
-
};
|
|
3228
|
-
exports.HashMap = HashMap;
|
|
3229
|
-
var AttributeHashMap = class extends HashMap {
|
|
3230
|
-
constructor() {
|
|
3231
|
-
super(utils_1.hashAttributes);
|
|
3232
|
-
}
|
|
3233
|
-
};
|
|
3234
|
-
exports.AttributeHashMap = AttributeHashMap;
|
|
3235
|
-
}));
|
|
3236
|
-
//#endregion
|
|
3237
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.js
|
|
3238
|
-
var require_DeltaMetricProcessor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3239
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3240
|
-
exports.DeltaMetricProcessor = void 0;
|
|
3241
|
-
const utils_1 = require_utils$2();
|
|
3242
|
-
const HashMap_1 = require_HashMap();
|
|
3243
|
-
/**
|
|
3244
|
-
* Internal interface.
|
|
3245
|
-
*
|
|
3246
|
-
* Allows synchronous collection of metrics. This processor should allow
|
|
3247
|
-
* allocation of new aggregation cells for metrics and convert cumulative
|
|
3248
|
-
* recording to delta data points.
|
|
3249
|
-
*/
|
|
3250
|
-
var DeltaMetricProcessor = class {
|
|
3251
|
-
_activeCollectionStorage = new HashMap_1.AttributeHashMap();
|
|
3252
|
-
_cumulativeMemoStorage = new HashMap_1.AttributeHashMap();
|
|
3253
|
-
_cardinalityLimit;
|
|
3254
|
-
_overflowAttributes = { "otel.metric.overflow": true };
|
|
3255
|
-
_overflowHashCode;
|
|
3256
|
-
_aggregator;
|
|
3257
|
-
constructor(aggregator, aggregationCardinalityLimit) {
|
|
3258
|
-
this._aggregator = aggregator;
|
|
3259
|
-
this._cardinalityLimit = (aggregationCardinalityLimit ?? 2e3) - 1;
|
|
3260
|
-
this._overflowHashCode = (0, utils_1.hashAttributes)(this._overflowAttributes);
|
|
3261
|
-
}
|
|
3262
|
-
record(value, attributes, _context, collectionTime) {
|
|
3263
|
-
let accumulation = this._activeCollectionStorage.get(attributes);
|
|
3264
|
-
if (!accumulation) {
|
|
3265
|
-
if (this._activeCollectionStorage.size >= this._cardinalityLimit) {
|
|
3266
|
-
this._activeCollectionStorage.getOrDefault(this._overflowAttributes, () => this._aggregator.createAccumulation(collectionTime))?.record(value);
|
|
3267
|
-
return;
|
|
3268
|
-
}
|
|
3269
|
-
accumulation = this._aggregator.createAccumulation(collectionTime);
|
|
3270
|
-
this._activeCollectionStorage.set(attributes, accumulation);
|
|
3271
|
-
}
|
|
3272
|
-
accumulation?.record(value);
|
|
3273
|
-
}
|
|
3274
|
-
batchCumulate(measurements, collectionTime) {
|
|
3275
|
-
for (const [originalAttributes, value, originalHashCode] of measurements.entries()) {
|
|
3276
|
-
let attributes = originalAttributes;
|
|
3277
|
-
let hashCode = originalHashCode;
|
|
3278
|
-
const accumulation = this._aggregator.createAccumulation(collectionTime);
|
|
3279
|
-
accumulation?.record(value);
|
|
3280
|
-
let delta = accumulation;
|
|
3281
|
-
if (this._cumulativeMemoStorage.has(attributes, hashCode)) {
|
|
3282
|
-
const previous = this._cumulativeMemoStorage.get(attributes, hashCode);
|
|
3283
|
-
delta = this._aggregator.diff(previous, accumulation);
|
|
3284
|
-
} else if (this._cumulativeMemoStorage.size >= this._cardinalityLimit) {
|
|
3285
|
-
attributes = this._overflowAttributes;
|
|
3286
|
-
hashCode = this._overflowHashCode;
|
|
3287
|
-
if (this._cumulativeMemoStorage.has(attributes, hashCode)) {
|
|
3288
|
-
const previous = this._cumulativeMemoStorage.get(attributes, hashCode);
|
|
3289
|
-
delta = this._aggregator.diff(previous, accumulation);
|
|
3290
|
-
}
|
|
3291
|
-
}
|
|
3292
|
-
if (this._activeCollectionStorage.has(attributes, hashCode)) {
|
|
3293
|
-
const active = this._activeCollectionStorage.get(attributes, hashCode);
|
|
3294
|
-
delta = this._aggregator.merge(active, delta);
|
|
3295
|
-
}
|
|
3296
|
-
this._cumulativeMemoStorage.set(attributes, accumulation, hashCode);
|
|
3297
|
-
this._activeCollectionStorage.set(attributes, delta, hashCode);
|
|
3298
|
-
}
|
|
3299
|
-
}
|
|
3300
|
-
/**
|
|
3301
|
-
* Returns a collection of delta metrics. Start time is the when first
|
|
3302
|
-
* time event collected.
|
|
3303
|
-
*/
|
|
3304
|
-
collect() {
|
|
3305
|
-
const unreportedDelta = this._activeCollectionStorage;
|
|
3306
|
-
this._activeCollectionStorage = new HashMap_1.AttributeHashMap();
|
|
3307
|
-
return unreportedDelta;
|
|
3308
|
-
}
|
|
3309
|
-
};
|
|
3310
|
-
exports.DeltaMetricProcessor = DeltaMetricProcessor;
|
|
3311
|
-
}));
|
|
3312
|
-
//#endregion
|
|
3313
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.js
|
|
3314
|
-
var require_TemporalMetricProcessor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3315
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3316
|
-
exports.TemporalMetricProcessor = void 0;
|
|
3317
|
-
const AggregationTemporality_1 = require_AggregationTemporality();
|
|
3318
|
-
const HashMap_1 = require_HashMap();
|
|
3319
|
-
exports.TemporalMetricProcessor = class TemporalMetricProcessor {
|
|
3320
|
-
_aggregator;
|
|
3321
|
-
_unreportedAccumulations = /* @__PURE__ */ new Map();
|
|
3322
|
-
_reportHistory = /* @__PURE__ */ new Map();
|
|
3323
|
-
constructor(aggregator, collectorHandles) {
|
|
3324
|
-
this._aggregator = aggregator;
|
|
3325
|
-
collectorHandles.forEach((handle) => {
|
|
3326
|
-
this._unreportedAccumulations.set(handle, []);
|
|
3327
|
-
});
|
|
3328
|
-
}
|
|
3329
|
-
/**
|
|
3330
|
-
* Builds the {@link MetricData} streams to report against a specific MetricCollector.
|
|
3331
|
-
* @param collector The information of the MetricCollector.
|
|
3332
|
-
* @param collectors The registered collectors.
|
|
3333
|
-
* @param instrumentDescriptor The instrumentation descriptor that these metrics generated with.
|
|
3334
|
-
* @param currentAccumulations The current accumulation of metric data from instruments.
|
|
3335
|
-
* @param collectionTime The current collection timestamp.
|
|
3336
|
-
* @returns The {@link MetricData} points or `null`.
|
|
3337
|
-
*/
|
|
3338
|
-
buildMetrics(collector, instrumentDescriptor, currentAccumulations, collectionTime) {
|
|
3339
|
-
this._stashAccumulations(currentAccumulations);
|
|
3340
|
-
const unreportedAccumulations = this._getMergedUnreportedAccumulations(collector);
|
|
3341
|
-
let result = unreportedAccumulations;
|
|
3342
|
-
let aggregationTemporality;
|
|
3343
|
-
if (this._reportHistory.has(collector)) {
|
|
3344
|
-
const last = this._reportHistory.get(collector);
|
|
3345
|
-
const lastCollectionTime = last.collectionTime;
|
|
3346
|
-
aggregationTemporality = last.aggregationTemporality;
|
|
3347
|
-
if (aggregationTemporality === AggregationTemporality_1.AggregationTemporality.CUMULATIVE) result = TemporalMetricProcessor.merge(last.accumulations, unreportedAccumulations, this._aggregator);
|
|
3348
|
-
else result = TemporalMetricProcessor.calibrateStartTime(last.accumulations, unreportedAccumulations, lastCollectionTime);
|
|
3349
|
-
} else aggregationTemporality = collector.selectAggregationTemporality(instrumentDescriptor.type);
|
|
3350
|
-
this._reportHistory.set(collector, {
|
|
3351
|
-
accumulations: result,
|
|
3352
|
-
collectionTime,
|
|
3353
|
-
aggregationTemporality
|
|
3354
|
-
});
|
|
3355
|
-
const accumulationRecords = AttributesMapToAccumulationRecords(result);
|
|
3356
|
-
if (accumulationRecords.length === 0) return;
|
|
3357
|
-
return this._aggregator.toMetricData(instrumentDescriptor, aggregationTemporality, accumulationRecords, collectionTime);
|
|
3358
|
-
}
|
|
3359
|
-
_stashAccumulations(currentAccumulation) {
|
|
3360
|
-
const registeredCollectors = this._unreportedAccumulations.keys();
|
|
3361
|
-
for (const collector of registeredCollectors) {
|
|
3362
|
-
let stash = this._unreportedAccumulations.get(collector);
|
|
3363
|
-
if (stash === void 0) {
|
|
3364
|
-
stash = [];
|
|
3365
|
-
this._unreportedAccumulations.set(collector, stash);
|
|
3366
|
-
}
|
|
3367
|
-
stash.push(currentAccumulation);
|
|
3368
|
-
}
|
|
3369
|
-
}
|
|
3370
|
-
_getMergedUnreportedAccumulations(collector) {
|
|
3371
|
-
let result = new HashMap_1.AttributeHashMap();
|
|
3372
|
-
const unreportedList = this._unreportedAccumulations.get(collector);
|
|
3373
|
-
this._unreportedAccumulations.set(collector, []);
|
|
3374
|
-
if (unreportedList === void 0) return result;
|
|
3375
|
-
for (const it of unreportedList) result = TemporalMetricProcessor.merge(result, it, this._aggregator);
|
|
3376
|
-
return result;
|
|
3377
|
-
}
|
|
3378
|
-
static merge(last, current, aggregator) {
|
|
3379
|
-
const result = last;
|
|
3380
|
-
const iterator = current.entries();
|
|
3381
|
-
let next = iterator.next();
|
|
3382
|
-
while (next.done !== true) {
|
|
3383
|
-
const [key, record, hash] = next.value;
|
|
3384
|
-
if (last.has(key, hash)) {
|
|
3385
|
-
const lastAccumulation = last.get(key, hash);
|
|
3386
|
-
const accumulation = aggregator.merge(lastAccumulation, record);
|
|
3387
|
-
result.set(key, accumulation, hash);
|
|
3388
|
-
} else result.set(key, record, hash);
|
|
3389
|
-
next = iterator.next();
|
|
3390
|
-
}
|
|
3391
|
-
return result;
|
|
3392
|
-
}
|
|
3393
|
-
/**
|
|
3394
|
-
* Calibrate the reported metric streams' startTime to lastCollectionTime. Leaves
|
|
3395
|
-
* the new stream to be the initial observation time unchanged.
|
|
3396
|
-
*/
|
|
3397
|
-
static calibrateStartTime(last, current, lastCollectionTime) {
|
|
3398
|
-
for (const [key, hash] of last.keys()) current.get(key, hash)?.setStartTime(lastCollectionTime);
|
|
3399
|
-
return current;
|
|
3400
|
-
}
|
|
3401
|
-
};
|
|
3402
|
-
function AttributesMapToAccumulationRecords(map) {
|
|
3403
|
-
return Array.from(map.entries());
|
|
3404
|
-
}
|
|
3405
|
-
}));
|
|
3406
|
-
//#endregion
|
|
3407
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/AsyncMetricStorage.js
|
|
3408
|
-
var require_AsyncMetricStorage = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3409
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3410
|
-
exports.AsyncMetricStorage = void 0;
|
|
3411
|
-
const MetricStorage_1 = require_MetricStorage();
|
|
3412
|
-
const DeltaMetricProcessor_1 = require_DeltaMetricProcessor();
|
|
3413
|
-
const TemporalMetricProcessor_1 = require_TemporalMetricProcessor();
|
|
3414
|
-
const HashMap_1 = require_HashMap();
|
|
3415
|
-
/**
|
|
3416
|
-
* Internal interface.
|
|
3417
|
-
*
|
|
3418
|
-
* Stores and aggregates {@link MetricData} for asynchronous instruments.
|
|
3419
|
-
*/
|
|
3420
|
-
var AsyncMetricStorage = class extends MetricStorage_1.MetricStorage {
|
|
3421
|
-
_aggregationCardinalityLimit;
|
|
3422
|
-
_deltaMetricStorage;
|
|
3423
|
-
_temporalMetricStorage;
|
|
3424
|
-
_attributesProcessor;
|
|
3425
|
-
constructor(_instrumentDescriptor, aggregator, attributesProcessor, collectorHandles, aggregationCardinalityLimit) {
|
|
3426
|
-
super(_instrumentDescriptor);
|
|
3427
|
-
this._aggregationCardinalityLimit = aggregationCardinalityLimit;
|
|
3428
|
-
this._deltaMetricStorage = new DeltaMetricProcessor_1.DeltaMetricProcessor(aggregator, this._aggregationCardinalityLimit);
|
|
3429
|
-
this._temporalMetricStorage = new TemporalMetricProcessor_1.TemporalMetricProcessor(aggregator, collectorHandles);
|
|
3430
|
-
this._attributesProcessor = attributesProcessor;
|
|
3431
|
-
}
|
|
3432
|
-
record(measurements, observationTime) {
|
|
3433
|
-
const processed = new HashMap_1.AttributeHashMap();
|
|
3434
|
-
for (const [attributes, value] of measurements.entries()) processed.set(this._attributesProcessor.process(attributes), value);
|
|
3435
|
-
this._deltaMetricStorage.batchCumulate(processed, observationTime);
|
|
3436
|
-
}
|
|
3437
|
-
/**
|
|
3438
|
-
* Collects the metrics from this storage. The ObservableCallback is invoked
|
|
3439
|
-
* during the collection.
|
|
3440
|
-
*
|
|
3441
|
-
* Note: This is a stateful operation and may reset any interval-related
|
|
3442
|
-
* state for the MetricCollector.
|
|
3443
|
-
*/
|
|
3444
|
-
collect(collector, collectionTime) {
|
|
3445
|
-
const accumulations = this._deltaMetricStorage.collect();
|
|
3446
|
-
return this._temporalMetricStorage.buildMetrics(collector, this._instrumentDescriptor, accumulations, collectionTime);
|
|
3447
|
-
}
|
|
3448
|
-
};
|
|
3449
|
-
exports.AsyncMetricStorage = AsyncMetricStorage;
|
|
3450
|
-
}));
|
|
3451
|
-
//#endregion
|
|
3452
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/RegistrationConflicts.js
|
|
3453
|
-
var require_RegistrationConflicts = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3454
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3455
|
-
exports.getConflictResolutionRecipe = exports.getDescriptionResolutionRecipe = exports.getTypeConflictResolutionRecipe = exports.getUnitConflictResolutionRecipe = exports.getValueTypeConflictResolutionRecipe = exports.getIncompatibilityDetails = void 0;
|
|
3456
|
-
function getIncompatibilityDetails(existing, otherDescriptor) {
|
|
3457
|
-
let incompatibility = "";
|
|
3458
|
-
if (existing.unit !== otherDescriptor.unit) incompatibility += `\t- Unit '${existing.unit}' does not match '${otherDescriptor.unit}'\n`;
|
|
3459
|
-
if (existing.type !== otherDescriptor.type) incompatibility += `\t- Type '${existing.type}' does not match '${otherDescriptor.type}'\n`;
|
|
3460
|
-
if (existing.valueType !== otherDescriptor.valueType) incompatibility += `\t- Value Type '${existing.valueType}' does not match '${otherDescriptor.valueType}'\n`;
|
|
3461
|
-
if (existing.description !== otherDescriptor.description) incompatibility += `\t- Description '${existing.description}' does not match '${otherDescriptor.description}'\n`;
|
|
3462
|
-
return incompatibility;
|
|
3463
|
-
}
|
|
3464
|
-
exports.getIncompatibilityDetails = getIncompatibilityDetails;
|
|
3465
|
-
function getValueTypeConflictResolutionRecipe(existing, otherDescriptor) {
|
|
3466
|
-
return `\t- use valueType '${existing.valueType}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;
|
|
3467
|
-
}
|
|
3468
|
-
exports.getValueTypeConflictResolutionRecipe = getValueTypeConflictResolutionRecipe;
|
|
3469
|
-
function getUnitConflictResolutionRecipe(existing, otherDescriptor) {
|
|
3470
|
-
return `\t- use unit '${existing.unit}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;
|
|
3471
|
-
}
|
|
3472
|
-
exports.getUnitConflictResolutionRecipe = getUnitConflictResolutionRecipe;
|
|
3473
|
-
function getTypeConflictResolutionRecipe(existing, otherDescriptor) {
|
|
3474
|
-
const selector = {
|
|
3475
|
-
name: otherDescriptor.name,
|
|
3476
|
-
type: otherDescriptor.type,
|
|
3477
|
-
unit: otherDescriptor.unit
|
|
3478
|
-
};
|
|
3479
|
-
const selectorString = JSON.stringify(selector);
|
|
3480
|
-
return `\t- create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'`;
|
|
3481
|
-
}
|
|
3482
|
-
exports.getTypeConflictResolutionRecipe = getTypeConflictResolutionRecipe;
|
|
3483
|
-
function getDescriptionResolutionRecipe(existing, otherDescriptor) {
|
|
3484
|
-
const selector = {
|
|
3485
|
-
name: otherDescriptor.name,
|
|
3486
|
-
type: otherDescriptor.type,
|
|
3487
|
-
unit: otherDescriptor.unit
|
|
3488
|
-
};
|
|
3489
|
-
const selectorString = JSON.stringify(selector);
|
|
3490
|
-
return `\t- create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'
|
|
3491
|
-
\t- OR - create a new view with the name ${existing.name} and description '${existing.description}' and InstrumentSelector ${selectorString}
|
|
3492
|
-
\t- OR - create a new view with the name ${otherDescriptor.name} and description '${existing.description}' and InstrumentSelector ${selectorString}`;
|
|
3493
|
-
}
|
|
3494
|
-
exports.getDescriptionResolutionRecipe = getDescriptionResolutionRecipe;
|
|
3495
|
-
function getConflictResolutionRecipe(existing, otherDescriptor) {
|
|
3496
|
-
if (existing.valueType !== otherDescriptor.valueType) return getValueTypeConflictResolutionRecipe(existing, otherDescriptor);
|
|
3497
|
-
if (existing.unit !== otherDescriptor.unit) return getUnitConflictResolutionRecipe(existing, otherDescriptor);
|
|
3498
|
-
if (existing.type !== otherDescriptor.type) return getTypeConflictResolutionRecipe(existing, otherDescriptor);
|
|
3499
|
-
if (existing.description !== otherDescriptor.description) return getDescriptionResolutionRecipe(existing, otherDescriptor);
|
|
3500
|
-
return "";
|
|
3501
|
-
}
|
|
3502
|
-
exports.getConflictResolutionRecipe = getConflictResolutionRecipe;
|
|
3503
|
-
}));
|
|
3504
|
-
//#endregion
|
|
3505
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorageRegistry.js
|
|
3506
|
-
var require_MetricStorageRegistry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3507
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3508
|
-
exports.MetricStorageRegistry = void 0;
|
|
3509
|
-
const InstrumentDescriptor_1 = require_InstrumentDescriptor();
|
|
3510
|
-
const api = __require("@opentelemetry/api");
|
|
3511
|
-
const RegistrationConflicts_1 = require_RegistrationConflicts();
|
|
3512
|
-
exports.MetricStorageRegistry = class MetricStorageRegistry {
|
|
3513
|
-
_sharedRegistry = /* @__PURE__ */ new Map();
|
|
3514
|
-
_perCollectorRegistry = /* @__PURE__ */ new Map();
|
|
3515
|
-
static create() {
|
|
3516
|
-
return new MetricStorageRegistry();
|
|
3517
|
-
}
|
|
3518
|
-
getStorages(collector) {
|
|
3519
|
-
let storages = [];
|
|
3520
|
-
for (const metricStorages of this._sharedRegistry.values()) storages = storages.concat(metricStorages);
|
|
3521
|
-
const perCollectorStorages = this._perCollectorRegistry.get(collector);
|
|
3522
|
-
if (perCollectorStorages != null) for (const metricStorages of perCollectorStorages.values()) storages = storages.concat(metricStorages);
|
|
3523
|
-
return storages;
|
|
3524
|
-
}
|
|
3525
|
-
register(storage) {
|
|
3526
|
-
this._registerStorage(storage, this._sharedRegistry);
|
|
3527
|
-
}
|
|
3528
|
-
registerForCollector(collector, storage) {
|
|
3529
|
-
let storageMap = this._perCollectorRegistry.get(collector);
|
|
3530
|
-
if (storageMap == null) {
|
|
3531
|
-
storageMap = /* @__PURE__ */ new Map();
|
|
3532
|
-
this._perCollectorRegistry.set(collector, storageMap);
|
|
3533
|
-
}
|
|
3534
|
-
this._registerStorage(storage, storageMap);
|
|
3535
|
-
}
|
|
3536
|
-
findOrUpdateCompatibleStorage(expectedDescriptor) {
|
|
3537
|
-
const storages = this._sharedRegistry.get(expectedDescriptor.name);
|
|
3538
|
-
if (storages === void 0) return null;
|
|
3539
|
-
return this._findOrUpdateCompatibleStorage(expectedDescriptor, storages);
|
|
3540
|
-
}
|
|
3541
|
-
findOrUpdateCompatibleCollectorStorage(collector, expectedDescriptor) {
|
|
3542
|
-
const storageMap = this._perCollectorRegistry.get(collector);
|
|
3543
|
-
if (storageMap === void 0) return null;
|
|
3544
|
-
const storages = storageMap.get(expectedDescriptor.name);
|
|
3545
|
-
if (storages === void 0) return null;
|
|
3546
|
-
return this._findOrUpdateCompatibleStorage(expectedDescriptor, storages);
|
|
3547
|
-
}
|
|
3548
|
-
_registerStorage(storage, storageMap) {
|
|
3549
|
-
const descriptor = storage.getInstrumentDescriptor();
|
|
3550
|
-
const storages = storageMap.get(descriptor.name);
|
|
3551
|
-
if (storages === void 0) {
|
|
3552
|
-
storageMap.set(descriptor.name, [storage]);
|
|
3553
|
-
return;
|
|
3554
|
-
}
|
|
3555
|
-
storages.push(storage);
|
|
3556
|
-
}
|
|
3557
|
-
_findOrUpdateCompatibleStorage(expectedDescriptor, existingStorages) {
|
|
3558
|
-
let compatibleStorage = null;
|
|
3559
|
-
for (const existingStorage of existingStorages) {
|
|
3560
|
-
const existingDescriptor = existingStorage.getInstrumentDescriptor();
|
|
3561
|
-
if ((0, InstrumentDescriptor_1.isDescriptorCompatibleWith)(existingDescriptor, expectedDescriptor)) {
|
|
3562
|
-
if (existingDescriptor.description !== expectedDescriptor.description) {
|
|
3563
|
-
if (expectedDescriptor.description.length > existingDescriptor.description.length) existingStorage.updateDescription(expectedDescriptor.description);
|
|
3564
|
-
api.diag.warn("A view or instrument with the name ", expectedDescriptor.name, " has already been registered, but has a different description and is incompatible with another registered view.\n", "Details:\n", (0, RegistrationConflicts_1.getIncompatibilityDetails)(existingDescriptor, expectedDescriptor), "The longer description will be used.\nTo resolve the conflict:", (0, RegistrationConflicts_1.getConflictResolutionRecipe)(existingDescriptor, expectedDescriptor));
|
|
3565
|
-
}
|
|
3566
|
-
compatibleStorage = existingStorage;
|
|
3567
|
-
} else api.diag.warn("A view or instrument with the name ", expectedDescriptor.name, " has already been registered and is incompatible with another registered view.\n", "Details:\n", (0, RegistrationConflicts_1.getIncompatibilityDetails)(existingDescriptor, expectedDescriptor), "To resolve the conflict:\n", (0, RegistrationConflicts_1.getConflictResolutionRecipe)(existingDescriptor, expectedDescriptor));
|
|
3568
|
-
}
|
|
3569
|
-
return compatibleStorage;
|
|
3570
|
-
}
|
|
3571
|
-
};
|
|
3572
|
-
}));
|
|
3573
|
-
//#endregion
|
|
3574
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/MultiWritableMetricStorage.js
|
|
3575
|
-
var require_MultiWritableMetricStorage = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3576
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3577
|
-
exports.MultiMetricStorage = void 0;
|
|
3578
|
-
/**
|
|
3579
|
-
* Internal interface.
|
|
3580
|
-
*/
|
|
3581
|
-
var MultiMetricStorage = class {
|
|
3582
|
-
_backingStorages;
|
|
3583
|
-
constructor(backingStorages) {
|
|
3584
|
-
this._backingStorages = backingStorages;
|
|
3585
|
-
}
|
|
3586
|
-
record(value, attributes, context, recordTime) {
|
|
3587
|
-
const storages = this._backingStorages;
|
|
3588
|
-
for (let i = 0; i < storages.length; i++) storages[i].record(value, attributes, context, recordTime);
|
|
3589
|
-
}
|
|
3590
|
-
};
|
|
3591
|
-
exports.MultiMetricStorage = MultiMetricStorage;
|
|
3592
|
-
}));
|
|
3593
|
-
//#endregion
|
|
3594
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/ObservableResult.js
|
|
3595
|
-
var require_ObservableResult = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3596
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3597
|
-
exports.BatchObservableResultImpl = exports.ObservableResultImpl = void 0;
|
|
3598
|
-
const api_1$2 = __require("@opentelemetry/api");
|
|
3599
|
-
const HashMap_1 = require_HashMap();
|
|
3600
|
-
const Instruments_1 = require_Instruments();
|
|
3601
|
-
/**
|
|
3602
|
-
* The class implements {@link ObservableResult} interface.
|
|
3603
|
-
*/
|
|
3604
|
-
var ObservableResultImpl = class {
|
|
3605
|
-
/**
|
|
3606
|
-
* @internal
|
|
3607
|
-
*/
|
|
3608
|
-
_buffer = new HashMap_1.AttributeHashMap();
|
|
3609
|
-
_instrumentName;
|
|
3610
|
-
_valueType;
|
|
3611
|
-
constructor(instrumentName, valueType) {
|
|
3612
|
-
this._instrumentName = instrumentName;
|
|
3613
|
-
this._valueType = valueType;
|
|
3614
|
-
}
|
|
3615
|
-
/**
|
|
3616
|
-
* Observe a measurement of the value associated with the given attributes.
|
|
3617
|
-
*/
|
|
3618
|
-
observe(value, attributes = {}) {
|
|
3619
|
-
if (typeof value !== "number") {
|
|
3620
|
-
api_1$2.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${value}`);
|
|
3621
|
-
return;
|
|
3622
|
-
}
|
|
3623
|
-
if (this._valueType === api_1$2.ValueType.INT && !Number.isInteger(value)) {
|
|
3624
|
-
api_1$2.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`);
|
|
3625
|
-
value = Math.trunc(value);
|
|
3626
|
-
if (!Number.isInteger(value)) return;
|
|
3627
|
-
}
|
|
3628
|
-
this._buffer.set(attributes, value);
|
|
3629
|
-
}
|
|
3630
|
-
};
|
|
3631
|
-
exports.ObservableResultImpl = ObservableResultImpl;
|
|
3632
|
-
/**
|
|
3633
|
-
* The class implements {@link BatchObservableCallback} interface.
|
|
3634
|
-
*/
|
|
3635
|
-
var BatchObservableResultImpl = class {
|
|
3636
|
-
/**
|
|
3637
|
-
* @internal
|
|
3638
|
-
*/
|
|
3639
|
-
_buffer = /* @__PURE__ */ new Map();
|
|
3640
|
-
/**
|
|
3641
|
-
* Observe a measurement of the value associated with the given attributes.
|
|
3642
|
-
*/
|
|
3643
|
-
observe(metric, value, attributes = {}) {
|
|
3644
|
-
if (!(0, Instruments_1.isObservableInstrument)(metric)) return;
|
|
3645
|
-
let map = this._buffer.get(metric);
|
|
3646
|
-
if (map == null) {
|
|
3647
|
-
map = new HashMap_1.AttributeHashMap();
|
|
3648
|
-
this._buffer.set(metric, map);
|
|
3649
|
-
}
|
|
3650
|
-
if (typeof value !== "number") {
|
|
3651
|
-
api_1$2.diag.warn(`non-number value provided to metric ${metric._descriptor.name}: ${value}`);
|
|
3652
|
-
return;
|
|
3653
|
-
}
|
|
3654
|
-
if (metric._descriptor.valueType === api_1$2.ValueType.INT && !Number.isInteger(value)) {
|
|
3655
|
-
api_1$2.diag.warn(`INT value type cannot accept a floating-point value for ${metric._descriptor.name}, ignoring the fractional digits.`);
|
|
3656
|
-
value = Math.trunc(value);
|
|
3657
|
-
if (!Number.isInteger(value)) return;
|
|
3658
|
-
}
|
|
3659
|
-
map.set(attributes, value);
|
|
3660
|
-
}
|
|
3661
|
-
};
|
|
3662
|
-
exports.BatchObservableResultImpl = BatchObservableResultImpl;
|
|
3663
|
-
}));
|
|
3664
|
-
//#endregion
|
|
3665
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/ObservableRegistry.js
|
|
3666
|
-
var require_ObservableRegistry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3667
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3668
|
-
exports.ObservableRegistry = void 0;
|
|
3669
|
-
const api_1$1 = __require("@opentelemetry/api");
|
|
3670
|
-
const Instruments_1 = require_Instruments();
|
|
3671
|
-
const ObservableResult_1 = require_ObservableResult();
|
|
3672
|
-
const utils_1 = require_utils$2();
|
|
3673
|
-
/**
|
|
3674
|
-
* An internal interface for managing ObservableCallbacks.
|
|
3675
|
-
*
|
|
3676
|
-
* Every registered callback associated with a set of instruments are be evaluated
|
|
3677
|
-
* exactly once during collection prior to reading data for that instrument.
|
|
3678
|
-
*/
|
|
3679
|
-
var ObservableRegistry = class {
|
|
3680
|
-
_callbacks = [];
|
|
3681
|
-
_batchCallbacks = [];
|
|
3682
|
-
addCallback(callback, instrument) {
|
|
3683
|
-
if (this._findCallback(callback, instrument) >= 0) return;
|
|
3684
|
-
this._callbacks.push({
|
|
3685
|
-
callback,
|
|
3686
|
-
instrument
|
|
3687
|
-
});
|
|
3688
|
-
}
|
|
3689
|
-
removeCallback(callback, instrument) {
|
|
3690
|
-
const idx = this._findCallback(callback, instrument);
|
|
3691
|
-
if (idx < 0) return;
|
|
3692
|
-
this._callbacks.splice(idx, 1);
|
|
3693
|
-
}
|
|
3694
|
-
addBatchCallback(callback, instruments) {
|
|
3695
|
-
const observableInstruments = new Set(instruments.filter(Instruments_1.isObservableInstrument));
|
|
3696
|
-
if (observableInstruments.size === 0) {
|
|
3697
|
-
api_1$1.diag.error("BatchObservableCallback is not associated with valid instruments", instruments);
|
|
3698
|
-
return;
|
|
3699
|
-
}
|
|
3700
|
-
if (this._findBatchCallback(callback, observableInstruments) >= 0) return;
|
|
3701
|
-
this._batchCallbacks.push({
|
|
3702
|
-
callback,
|
|
3703
|
-
instruments: observableInstruments
|
|
3704
|
-
});
|
|
3705
|
-
}
|
|
3706
|
-
removeBatchCallback(callback, instruments) {
|
|
3707
|
-
const observableInstruments = new Set(instruments.filter(Instruments_1.isObservableInstrument));
|
|
3708
|
-
const idx = this._findBatchCallback(callback, observableInstruments);
|
|
3709
|
-
if (idx < 0) return;
|
|
3710
|
-
this._batchCallbacks.splice(idx, 1);
|
|
3711
|
-
}
|
|
3712
|
-
/**
|
|
3713
|
-
* @returns a promise of rejected reasons for invoking callbacks.
|
|
3714
|
-
*/
|
|
3715
|
-
async observe(collectionTime, timeoutMillis) {
|
|
3716
|
-
const callbackFutures = this._observeCallbacks(collectionTime, timeoutMillis);
|
|
3717
|
-
const batchCallbackFutures = this._observeBatchCallbacks(collectionTime, timeoutMillis);
|
|
3718
|
-
return (await Promise.allSettled([...callbackFutures, ...batchCallbackFutures])).filter((result) => result.status === "rejected").map((result) => result.reason);
|
|
3719
|
-
}
|
|
3720
|
-
_observeCallbacks(observationTime, timeoutMillis) {
|
|
3721
|
-
return this._callbacks.map(async ({ callback, instrument }) => {
|
|
3722
|
-
const observableResult = new ObservableResult_1.ObservableResultImpl(instrument._descriptor.name, instrument._descriptor.valueType);
|
|
3723
|
-
let callPromise = Promise.resolve(callback(observableResult));
|
|
3724
|
-
if (timeoutMillis != null) callPromise = (0, utils_1.callWithTimeout)(callPromise, timeoutMillis);
|
|
3725
|
-
await callPromise;
|
|
3726
|
-
instrument._metricStorages.forEach((metricStorage) => {
|
|
3727
|
-
metricStorage.record(observableResult._buffer, observationTime);
|
|
3728
|
-
});
|
|
3729
|
-
});
|
|
3730
|
-
}
|
|
3731
|
-
_observeBatchCallbacks(observationTime, timeoutMillis) {
|
|
3732
|
-
return this._batchCallbacks.map(async ({ callback, instruments }) => {
|
|
3733
|
-
const observableResult = new ObservableResult_1.BatchObservableResultImpl();
|
|
3734
|
-
let callPromise = Promise.resolve(callback(observableResult));
|
|
3735
|
-
if (timeoutMillis != null) callPromise = (0, utils_1.callWithTimeout)(callPromise, timeoutMillis);
|
|
3736
|
-
await callPromise;
|
|
3737
|
-
instruments.forEach((instrument) => {
|
|
3738
|
-
const buffer = observableResult._buffer.get(instrument);
|
|
3739
|
-
if (buffer == null) return;
|
|
3740
|
-
instrument._metricStorages.forEach((metricStorage) => {
|
|
3741
|
-
metricStorage.record(buffer, observationTime);
|
|
3742
|
-
});
|
|
3743
|
-
});
|
|
3744
|
-
});
|
|
3745
|
-
}
|
|
3746
|
-
_findCallback(callback, instrument) {
|
|
3747
|
-
return this._callbacks.findIndex((record) => {
|
|
3748
|
-
return record.callback === callback && record.instrument === instrument;
|
|
3749
|
-
});
|
|
3750
|
-
}
|
|
3751
|
-
_findBatchCallback(callback, instruments) {
|
|
3752
|
-
return this._batchCallbacks.findIndex((record) => {
|
|
3753
|
-
return record.callback === callback && (0, utils_1.setEquals)(record.instruments, instruments);
|
|
3754
|
-
});
|
|
3755
|
-
}
|
|
3756
|
-
};
|
|
3757
|
-
exports.ObservableRegistry = ObservableRegistry;
|
|
3758
|
-
}));
|
|
3759
|
-
//#endregion
|
|
3760
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/SyncMetricStorage.js
|
|
3761
|
-
var require_SyncMetricStorage = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3762
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3763
|
-
exports.SyncMetricStorage = void 0;
|
|
3764
|
-
const MetricStorage_1 = require_MetricStorage();
|
|
3765
|
-
const DeltaMetricProcessor_1 = require_DeltaMetricProcessor();
|
|
3766
|
-
const TemporalMetricProcessor_1 = require_TemporalMetricProcessor();
|
|
3767
|
-
/**
|
|
3768
|
-
* Internal interface.
|
|
3769
|
-
*
|
|
3770
|
-
* Stores and aggregates {@link MetricData} for synchronous instruments.
|
|
3771
|
-
*/
|
|
3772
|
-
var SyncMetricStorage = class extends MetricStorage_1.MetricStorage {
|
|
3773
|
-
_aggregationCardinalityLimit;
|
|
3774
|
-
_deltaMetricStorage;
|
|
3775
|
-
_temporalMetricStorage;
|
|
3776
|
-
_attributesProcessor;
|
|
3777
|
-
constructor(instrumentDescriptor, aggregator, attributesProcessor, collectorHandles, aggregationCardinalityLimit) {
|
|
3778
|
-
super(instrumentDescriptor);
|
|
3779
|
-
this._aggregationCardinalityLimit = aggregationCardinalityLimit;
|
|
3780
|
-
this._deltaMetricStorage = new DeltaMetricProcessor_1.DeltaMetricProcessor(aggregator, this._aggregationCardinalityLimit);
|
|
3781
|
-
this._temporalMetricStorage = new TemporalMetricProcessor_1.TemporalMetricProcessor(aggregator, collectorHandles);
|
|
3782
|
-
this._attributesProcessor = attributesProcessor;
|
|
3783
|
-
}
|
|
3784
|
-
record(value, attributes, context, recordTime) {
|
|
3785
|
-
attributes = this._attributesProcessor.process(attributes, context);
|
|
3786
|
-
this._deltaMetricStorage.record(value, attributes, context, recordTime);
|
|
3787
|
-
}
|
|
3788
|
-
/**
|
|
3789
|
-
* Collects the metrics from this storage.
|
|
3790
|
-
*
|
|
3791
|
-
* Note: This is a stateful operation and may reset any interval-related
|
|
3792
|
-
* state for the MetricCollector.
|
|
3793
|
-
*/
|
|
3794
|
-
collect(collector, collectionTime) {
|
|
3795
|
-
const accumulations = this._deltaMetricStorage.collect();
|
|
3796
|
-
return this._temporalMetricStorage.buildMetrics(collector, this._instrumentDescriptor, accumulations, collectionTime);
|
|
3797
|
-
}
|
|
3798
|
-
};
|
|
3799
|
-
exports.SyncMetricStorage = SyncMetricStorage;
|
|
3800
|
-
}));
|
|
3801
|
-
//#endregion
|
|
3802
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.js
|
|
3803
|
-
var require_AttributesProcessor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3804
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3805
|
-
exports.createDenyListAttributesProcessor = exports.createAllowListAttributesProcessor = exports.createMultiAttributesProcessor = exports.createNoopAttributesProcessor = void 0;
|
|
3806
|
-
var NoopAttributesProcessor = class {
|
|
3807
|
-
process(incoming, _context) {
|
|
3808
|
-
return incoming;
|
|
3809
|
-
}
|
|
3810
|
-
};
|
|
3811
|
-
var MultiAttributesProcessor = class {
|
|
3812
|
-
_processors;
|
|
3813
|
-
constructor(processors) {
|
|
3814
|
-
this._processors = processors;
|
|
3815
|
-
}
|
|
3816
|
-
process(incoming, context) {
|
|
3817
|
-
let filteredAttributes = incoming;
|
|
3818
|
-
for (const processor of this._processors) filteredAttributes = processor.process(filteredAttributes, context);
|
|
3819
|
-
return filteredAttributes;
|
|
3820
|
-
}
|
|
3821
|
-
};
|
|
3822
|
-
var AllowListProcessor = class {
|
|
3823
|
-
_allowedAttributeNames;
|
|
3824
|
-
constructor(allowedAttributeNames) {
|
|
3825
|
-
this._allowedAttributeNames = new Set(allowedAttributeNames);
|
|
3826
|
-
}
|
|
3827
|
-
process(incoming, _context) {
|
|
3828
|
-
const filteredAttributes = {};
|
|
3829
|
-
for (const attributeName in incoming) if (Object.prototype.hasOwnProperty.call(incoming, attributeName) && this._allowedAttributeNames.has(attributeName)) filteredAttributes[attributeName] = incoming[attributeName];
|
|
3830
|
-
return filteredAttributes;
|
|
3831
|
-
}
|
|
3832
|
-
};
|
|
3833
|
-
var DenyListProcessor = class {
|
|
3834
|
-
_deniedAttributeNames;
|
|
3835
|
-
constructor(deniedAttributeNames) {
|
|
3836
|
-
this._deniedAttributeNames = new Set(deniedAttributeNames);
|
|
3837
|
-
}
|
|
3838
|
-
process(incoming, _context) {
|
|
3839
|
-
const filteredAttributes = {};
|
|
3840
|
-
for (const attributeName in incoming) if (Object.prototype.hasOwnProperty.call(incoming, attributeName) && !this._deniedAttributeNames.has(attributeName)) filteredAttributes[attributeName] = incoming[attributeName];
|
|
3841
|
-
return filteredAttributes;
|
|
3842
|
-
}
|
|
3843
|
-
};
|
|
3844
|
-
/**
|
|
3845
|
-
* @internal
|
|
3846
|
-
*
|
|
3847
|
-
* Create an {@link IAttributesProcessor} that acts as a simple pass-through for attributes.
|
|
3848
|
-
*/
|
|
3849
|
-
function createNoopAttributesProcessor() {
|
|
3850
|
-
return NOOP;
|
|
3851
|
-
}
|
|
3852
|
-
exports.createNoopAttributesProcessor = createNoopAttributesProcessor;
|
|
3853
|
-
/**
|
|
3854
|
-
* @internal
|
|
3855
|
-
*
|
|
3856
|
-
* Create an {@link IAttributesProcessor} that applies all processors from the provided list in order.
|
|
3857
|
-
*
|
|
3858
|
-
* @param processors Processors to apply in order.
|
|
3859
|
-
*/
|
|
3860
|
-
function createMultiAttributesProcessor(processors) {
|
|
3861
|
-
return new MultiAttributesProcessor(processors);
|
|
3862
|
-
}
|
|
3863
|
-
exports.createMultiAttributesProcessor = createMultiAttributesProcessor;
|
|
3864
|
-
/**
|
|
3865
|
-
* Create an {@link IAttributesProcessor} that filters by allowed attribute names and drops any names that are not in the
|
|
3866
|
-
* allow list.
|
|
3867
|
-
*/
|
|
3868
|
-
function createAllowListAttributesProcessor(attributeAllowList) {
|
|
3869
|
-
return new AllowListProcessor(attributeAllowList);
|
|
3870
|
-
}
|
|
3871
|
-
exports.createAllowListAttributesProcessor = createAllowListAttributesProcessor;
|
|
3872
|
-
/**
|
|
3873
|
-
* Create an {@link IAttributesProcessor} that drops attributes based on the names provided in the deny list
|
|
3874
|
-
*/
|
|
3875
|
-
function createDenyListAttributesProcessor(attributeDenyList) {
|
|
3876
|
-
return new DenyListProcessor(attributeDenyList);
|
|
3877
|
-
}
|
|
3878
|
-
exports.createDenyListAttributesProcessor = createDenyListAttributesProcessor;
|
|
3879
|
-
const NOOP = new NoopAttributesProcessor();
|
|
3880
|
-
}));
|
|
3881
|
-
//#endregion
|
|
3882
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterSharedState.js
|
|
3883
|
-
var require_MeterSharedState = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3884
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3885
|
-
exports.MeterSharedState = void 0;
|
|
3886
|
-
const InstrumentDescriptor_1 = require_InstrumentDescriptor();
|
|
3887
|
-
const Meter_1 = require_Meter();
|
|
3888
|
-
const AsyncMetricStorage_1 = require_AsyncMetricStorage();
|
|
3889
|
-
const MetricStorageRegistry_1 = require_MetricStorageRegistry();
|
|
3890
|
-
const MultiWritableMetricStorage_1 = require_MultiWritableMetricStorage();
|
|
3891
|
-
const ObservableRegistry_1 = require_ObservableRegistry();
|
|
3892
|
-
const SyncMetricStorage_1 = require_SyncMetricStorage();
|
|
3893
|
-
const AttributesProcessor_1 = require_AttributesProcessor();
|
|
3894
|
-
/**
|
|
3895
|
-
* An internal record for shared meter provider states.
|
|
3896
|
-
*/
|
|
3897
|
-
var MeterSharedState = class {
|
|
3898
|
-
metricStorageRegistry = new MetricStorageRegistry_1.MetricStorageRegistry();
|
|
3899
|
-
observableRegistry = new ObservableRegistry_1.ObservableRegistry();
|
|
3900
|
-
meter;
|
|
3901
|
-
_meterProviderSharedState;
|
|
3902
|
-
_instrumentationScope;
|
|
3903
|
-
constructor(meterProviderSharedState, instrumentationScope) {
|
|
3904
|
-
this.meter = new Meter_1.Meter(this);
|
|
3905
|
-
this._meterProviderSharedState = meterProviderSharedState;
|
|
3906
|
-
this._instrumentationScope = instrumentationScope;
|
|
3907
|
-
}
|
|
3908
|
-
registerMetricStorage(descriptor) {
|
|
3909
|
-
const storages = this._registerMetricStorage(descriptor, SyncMetricStorage_1.SyncMetricStorage);
|
|
3910
|
-
if (storages.length === 1) return storages[0];
|
|
3911
|
-
return new MultiWritableMetricStorage_1.MultiMetricStorage(storages);
|
|
3912
|
-
}
|
|
3913
|
-
registerAsyncMetricStorage(descriptor) {
|
|
3914
|
-
return this._registerMetricStorage(descriptor, AsyncMetricStorage_1.AsyncMetricStorage);
|
|
3915
|
-
}
|
|
3916
|
-
/**
|
|
3917
|
-
* @param collector opaque handle of {@link MetricCollector} which initiated the collection.
|
|
3918
|
-
* @param collectionTime the HrTime at which the collection was initiated.
|
|
3919
|
-
* @param options options for collection.
|
|
3920
|
-
* @returns the list of metric data collected.
|
|
3921
|
-
*/
|
|
3922
|
-
async collect(collector, collectionTime, options) {
|
|
3923
|
-
/**
|
|
3924
|
-
* 1. Call all observable callbacks first.
|
|
3925
|
-
* 2. Collect metric result for the collector.
|
|
3926
|
-
*/
|
|
3927
|
-
const errors = await this.observableRegistry.observe(collectionTime, options?.timeoutMillis);
|
|
3928
|
-
const storages = this.metricStorageRegistry.getStorages(collector);
|
|
3929
|
-
if (storages.length === 0) return null;
|
|
3930
|
-
const metricDataList = [];
|
|
3931
|
-
storages.forEach((metricStorage) => {
|
|
3932
|
-
const metricData = metricStorage.collect(collector, collectionTime);
|
|
3933
|
-
if (metricData != null) metricDataList.push(metricData);
|
|
3934
|
-
});
|
|
3935
|
-
if (metricDataList.length === 0) return { errors };
|
|
3936
|
-
return {
|
|
3937
|
-
scopeMetrics: {
|
|
3938
|
-
scope: this._instrumentationScope,
|
|
3939
|
-
metrics: metricDataList
|
|
3940
|
-
},
|
|
3941
|
-
errors
|
|
3942
|
-
};
|
|
3943
|
-
}
|
|
3944
|
-
_registerMetricStorage(descriptor, MetricStorageType) {
|
|
3945
|
-
let storages = this._meterProviderSharedState.viewRegistry.findViews(descriptor, this._instrumentationScope).map((view) => {
|
|
3946
|
-
const viewDescriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptorWithView)(view, descriptor);
|
|
3947
|
-
const compatibleStorage = this.metricStorageRegistry.findOrUpdateCompatibleStorage(viewDescriptor);
|
|
3948
|
-
if (compatibleStorage != null) return compatibleStorage;
|
|
3949
|
-
const viewStorage = new MetricStorageType(viewDescriptor, view.aggregation.createAggregator(viewDescriptor), view.attributesProcessor, this._meterProviderSharedState.metricCollectors, view.aggregationCardinalityLimit);
|
|
3950
|
-
this.metricStorageRegistry.register(viewStorage);
|
|
3951
|
-
return viewStorage;
|
|
3952
|
-
});
|
|
3953
|
-
if (storages.length === 0) {
|
|
3954
|
-
const collectorStorages = this._meterProviderSharedState.selectAggregations(descriptor.type).map(([collector, aggregation]) => {
|
|
3955
|
-
const compatibleStorage = this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(collector, descriptor);
|
|
3956
|
-
if (compatibleStorage != null) return compatibleStorage;
|
|
3957
|
-
const aggregator = aggregation.createAggregator(descriptor);
|
|
3958
|
-
const cardinalityLimit = collector.selectCardinalityLimit(descriptor.type);
|
|
3959
|
-
const storage = new MetricStorageType(descriptor, aggregator, (0, AttributesProcessor_1.createNoopAttributesProcessor)(), [collector], cardinalityLimit);
|
|
3960
|
-
this.metricStorageRegistry.registerForCollector(collector, storage);
|
|
3961
|
-
return storage;
|
|
3962
|
-
});
|
|
3963
|
-
storages = storages.concat(collectorStorages);
|
|
3964
|
-
}
|
|
3965
|
-
return storages;
|
|
3966
|
-
}
|
|
3967
|
-
};
|
|
3968
|
-
exports.MeterSharedState = MeterSharedState;
|
|
3969
|
-
}));
|
|
3970
|
-
//#endregion
|
|
3971
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterProviderSharedState.js
|
|
3972
|
-
var require_MeterProviderSharedState = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3973
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3974
|
-
exports.MeterProviderSharedState = void 0;
|
|
3975
|
-
const utils_1 = require_utils$2();
|
|
3976
|
-
const ViewRegistry_1 = require_ViewRegistry();
|
|
3977
|
-
const MeterSharedState_1 = require_MeterSharedState();
|
|
3978
|
-
const AggregationOption_1 = require_AggregationOption();
|
|
3979
|
-
/**
|
|
3980
|
-
* An internal record for shared meter provider states.
|
|
3981
|
-
*/
|
|
3982
|
-
var MeterProviderSharedState = class {
|
|
3983
|
-
viewRegistry = new ViewRegistry_1.ViewRegistry();
|
|
3984
|
-
metricCollectors = [];
|
|
3985
|
-
meterSharedStates = /* @__PURE__ */ new Map();
|
|
3986
|
-
resource;
|
|
3987
|
-
constructor(resource) {
|
|
3988
|
-
this.resource = resource;
|
|
3989
|
-
}
|
|
3990
|
-
getMeterSharedState(instrumentationScope) {
|
|
3991
|
-
const id = (0, utils_1.instrumentationScopeId)(instrumentationScope);
|
|
3992
|
-
let meterSharedState = this.meterSharedStates.get(id);
|
|
3993
|
-
if (meterSharedState == null) {
|
|
3994
|
-
meterSharedState = new MeterSharedState_1.MeterSharedState(this, instrumentationScope);
|
|
3995
|
-
this.meterSharedStates.set(id, meterSharedState);
|
|
3996
|
-
}
|
|
3997
|
-
return meterSharedState;
|
|
3998
|
-
}
|
|
3999
|
-
selectAggregations(instrumentType) {
|
|
4000
|
-
const result = [];
|
|
4001
|
-
for (const collector of this.metricCollectors) result.push([collector, (0, AggregationOption_1.toAggregation)(collector.selectAggregation(instrumentType))]);
|
|
4002
|
-
return result;
|
|
4003
|
-
}
|
|
4004
|
-
};
|
|
4005
|
-
exports.MeterProviderSharedState = MeterProviderSharedState;
|
|
4006
|
-
}));
|
|
4007
|
-
//#endregion
|
|
4008
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricCollector.js
|
|
4009
|
-
var require_MetricCollector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4010
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4011
|
-
exports.MetricCollector = void 0;
|
|
4012
|
-
const core_1 = __require("@opentelemetry/core");
|
|
4013
|
-
/**
|
|
4014
|
-
* An internal opaque interface that the MetricReader receives as
|
|
4015
|
-
* MetricProducer. It acts as the storage key to the internal metric stream
|
|
4016
|
-
* state for each MetricReader.
|
|
4017
|
-
*/
|
|
4018
|
-
var MetricCollector = class {
|
|
4019
|
-
_sharedState;
|
|
4020
|
-
_metricReader;
|
|
4021
|
-
constructor(sharedState, metricReader) {
|
|
4022
|
-
this._sharedState = sharedState;
|
|
4023
|
-
this._metricReader = metricReader;
|
|
4024
|
-
}
|
|
4025
|
-
async collect(options) {
|
|
4026
|
-
const collectionTime = (0, core_1.millisToHrTime)(Date.now());
|
|
4027
|
-
const scopeMetrics = [];
|
|
4028
|
-
const errors = [];
|
|
4029
|
-
const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()).map(async (meterSharedState) => {
|
|
4030
|
-
const current = await meterSharedState.collect(this, collectionTime, options);
|
|
4031
|
-
if (current?.scopeMetrics != null) scopeMetrics.push(current.scopeMetrics);
|
|
4032
|
-
if (current?.errors != null) errors.push(...current.errors);
|
|
4033
|
-
});
|
|
4034
|
-
await Promise.all(meterCollectionPromises);
|
|
4035
|
-
return {
|
|
4036
|
-
resourceMetrics: {
|
|
4037
|
-
resource: this._sharedState.resource,
|
|
4038
|
-
scopeMetrics
|
|
4039
|
-
},
|
|
4040
|
-
errors
|
|
4041
|
-
};
|
|
4042
|
-
}
|
|
4043
|
-
/**
|
|
4044
|
-
* Delegates for MetricReader.forceFlush.
|
|
4045
|
-
*/
|
|
4046
|
-
async forceFlush(options) {
|
|
4047
|
-
await this._metricReader.forceFlush(options);
|
|
4048
|
-
}
|
|
4049
|
-
/**
|
|
4050
|
-
* Delegates for MetricReader.shutdown.
|
|
4051
|
-
*/
|
|
4052
|
-
async shutdown(options) {
|
|
4053
|
-
await this._metricReader.shutdown(options);
|
|
4054
|
-
}
|
|
4055
|
-
selectAggregationTemporality(instrumentType) {
|
|
4056
|
-
return this._metricReader.selectAggregationTemporality(instrumentType);
|
|
4057
|
-
}
|
|
4058
|
-
selectAggregation(instrumentType) {
|
|
4059
|
-
return this._metricReader.selectAggregation(instrumentType);
|
|
4060
|
-
}
|
|
4061
|
-
/**
|
|
4062
|
-
* Select the cardinality limit for the given {@link InstrumentType} for this
|
|
4063
|
-
* collector.
|
|
4064
|
-
*/
|
|
4065
|
-
selectCardinalityLimit(instrumentType) {
|
|
4066
|
-
return this._metricReader.selectCardinalityLimit?.(instrumentType) ?? 2e3;
|
|
4067
|
-
}
|
|
4068
|
-
};
|
|
4069
|
-
exports.MetricCollector = MetricCollector;
|
|
4070
|
-
}));
|
|
4071
|
-
//#endregion
|
|
4072
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/Predicate.js
|
|
4073
|
-
var require_Predicate = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4074
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4075
|
-
exports.ExactPredicate = exports.PatternPredicate = void 0;
|
|
4076
|
-
const ESCAPE = /[\^$\\.+?()[\]{}|]/g;
|
|
4077
|
-
exports.PatternPredicate = class PatternPredicate {
|
|
4078
|
-
_matchAll;
|
|
4079
|
-
_regexp;
|
|
4080
|
-
constructor(pattern) {
|
|
4081
|
-
if (pattern === "*") {
|
|
4082
|
-
this._matchAll = true;
|
|
4083
|
-
this._regexp = /.*/;
|
|
4084
|
-
} else {
|
|
4085
|
-
this._matchAll = false;
|
|
4086
|
-
this._regexp = new RegExp(PatternPredicate.escapePattern(pattern));
|
|
4087
|
-
}
|
|
4088
|
-
}
|
|
4089
|
-
match(str) {
|
|
4090
|
-
if (this._matchAll) return true;
|
|
4091
|
-
return this._regexp.test(str);
|
|
4092
|
-
}
|
|
4093
|
-
static escapePattern(pattern) {
|
|
4094
|
-
return `^${pattern.replace(ESCAPE, "\\$&").replace("*", ".*")}$`;
|
|
4095
|
-
}
|
|
4096
|
-
static hasWildcard(pattern) {
|
|
4097
|
-
return pattern.includes("*");
|
|
4098
|
-
}
|
|
4099
|
-
};
|
|
4100
|
-
var ExactPredicate = class {
|
|
4101
|
-
_matchAll;
|
|
4102
|
-
_pattern;
|
|
4103
|
-
constructor(pattern) {
|
|
4104
|
-
this._matchAll = pattern === void 0;
|
|
4105
|
-
this._pattern = pattern;
|
|
4106
|
-
}
|
|
4107
|
-
match(str) {
|
|
4108
|
-
if (this._matchAll) return true;
|
|
4109
|
-
if (str === this._pattern) return true;
|
|
4110
|
-
return false;
|
|
4111
|
-
}
|
|
4112
|
-
};
|
|
4113
|
-
exports.ExactPredicate = ExactPredicate;
|
|
4114
|
-
}));
|
|
4115
|
-
//#endregion
|
|
4116
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/InstrumentSelector.js
|
|
4117
|
-
var require_InstrumentSelector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4118
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4119
|
-
exports.InstrumentSelector = void 0;
|
|
4120
|
-
const Predicate_1 = require_Predicate();
|
|
4121
|
-
var InstrumentSelector = class {
|
|
4122
|
-
_nameFilter;
|
|
4123
|
-
_type;
|
|
4124
|
-
_unitFilter;
|
|
4125
|
-
constructor(criteria) {
|
|
4126
|
-
this._nameFilter = new Predicate_1.PatternPredicate(criteria?.name ?? "*");
|
|
4127
|
-
this._type = criteria?.type;
|
|
4128
|
-
this._unitFilter = new Predicate_1.ExactPredicate(criteria?.unit);
|
|
4129
|
-
}
|
|
4130
|
-
getType() {
|
|
4131
|
-
return this._type;
|
|
4132
|
-
}
|
|
4133
|
-
getNameFilter() {
|
|
4134
|
-
return this._nameFilter;
|
|
4135
|
-
}
|
|
4136
|
-
getUnitFilter() {
|
|
4137
|
-
return this._unitFilter;
|
|
4138
|
-
}
|
|
4139
|
-
};
|
|
4140
|
-
exports.InstrumentSelector = InstrumentSelector;
|
|
4141
|
-
}));
|
|
4142
|
-
//#endregion
|
|
4143
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/MeterSelector.js
|
|
4144
|
-
var require_MeterSelector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4145
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4146
|
-
exports.MeterSelector = void 0;
|
|
4147
|
-
const Predicate_1 = require_Predicate();
|
|
4148
|
-
var MeterSelector = class {
|
|
4149
|
-
_nameFilter;
|
|
4150
|
-
_versionFilter;
|
|
4151
|
-
_schemaUrlFilter;
|
|
4152
|
-
constructor(criteria) {
|
|
4153
|
-
this._nameFilter = new Predicate_1.ExactPredicate(criteria?.name);
|
|
4154
|
-
this._versionFilter = new Predicate_1.ExactPredicate(criteria?.version);
|
|
4155
|
-
this._schemaUrlFilter = new Predicate_1.ExactPredicate(criteria?.schemaUrl);
|
|
4156
|
-
}
|
|
4157
|
-
getNameFilter() {
|
|
4158
|
-
return this._nameFilter;
|
|
4159
|
-
}
|
|
4160
|
-
/**
|
|
4161
|
-
* TODO: semver filter? no spec yet.
|
|
4162
|
-
*/
|
|
4163
|
-
getVersionFilter() {
|
|
4164
|
-
return this._versionFilter;
|
|
4165
|
-
}
|
|
4166
|
-
getSchemaUrlFilter() {
|
|
4167
|
-
return this._schemaUrlFilter;
|
|
4168
|
-
}
|
|
4169
|
-
};
|
|
4170
|
-
exports.MeterSelector = MeterSelector;
|
|
4171
|
-
}));
|
|
4172
|
-
//#endregion
|
|
4173
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/View.js
|
|
4174
|
-
var require_View = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4175
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4176
|
-
exports.View = void 0;
|
|
4177
|
-
const Predicate_1 = require_Predicate();
|
|
4178
|
-
const AttributesProcessor_1 = require_AttributesProcessor();
|
|
4179
|
-
const InstrumentSelector_1 = require_InstrumentSelector();
|
|
4180
|
-
const MeterSelector_1 = require_MeterSelector();
|
|
4181
|
-
const AggregationOption_1 = require_AggregationOption();
|
|
4182
|
-
function isSelectorNotProvided(options) {
|
|
4183
|
-
return options.instrumentName == null && options.instrumentType == null && options.instrumentUnit == null && options.meterName == null && options.meterVersion == null && options.meterSchemaUrl == null;
|
|
4184
|
-
}
|
|
4185
|
-
function validateViewOptions(viewOptions) {
|
|
4186
|
-
if (isSelectorNotProvided(viewOptions)) throw new Error("Cannot create view with no selector arguments supplied");
|
|
4187
|
-
if (viewOptions.name != null && (viewOptions?.instrumentName == null || Predicate_1.PatternPredicate.hasWildcard(viewOptions.instrumentName))) throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");
|
|
4188
|
-
}
|
|
4189
|
-
/**
|
|
4190
|
-
* Can be passed to a {@link MeterProvider} to select instruments and alter their metric stream.
|
|
4191
|
-
*/
|
|
4192
|
-
var View = class {
|
|
4193
|
-
name;
|
|
4194
|
-
description;
|
|
4195
|
-
aggregation;
|
|
4196
|
-
attributesProcessor;
|
|
4197
|
-
instrumentSelector;
|
|
4198
|
-
meterSelector;
|
|
4199
|
-
aggregationCardinalityLimit;
|
|
4200
|
-
/**
|
|
4201
|
-
* Create a new {@link View} instance.
|
|
4202
|
-
*
|
|
4203
|
-
* Parameters can be categorized as two types:
|
|
4204
|
-
* Instrument selection criteria: Used to describe the instrument(s) this view will be applied to.
|
|
4205
|
-
* Will be treated as additive (the Instrument has to meet all the provided criteria to be selected).
|
|
4206
|
-
*
|
|
4207
|
-
* Metric stream altering: Alter the metric stream of instruments selected by instrument selection criteria.
|
|
4208
|
-
*
|
|
4209
|
-
* @param viewOptions {@link ViewOptions} for altering the metric stream and instrument selection.
|
|
4210
|
-
* @param viewOptions.name
|
|
4211
|
-
* Alters the metric stream:
|
|
4212
|
-
* This will be used as the name of the metrics stream.
|
|
4213
|
-
* If not provided, the original Instrument name will be used.
|
|
4214
|
-
* @param viewOptions.description
|
|
4215
|
-
* Alters the metric stream:
|
|
4216
|
-
* This will be used as the description of the metrics stream.
|
|
4217
|
-
* If not provided, the original Instrument description will be used by default.
|
|
4218
|
-
* @param viewOptions.attributesProcessors
|
|
4219
|
-
* Alters the metric stream:
|
|
4220
|
-
* If provided, the attributes will be modified as defined by the added processors.
|
|
4221
|
-
* If not provided, all attribute keys will be used by default.
|
|
4222
|
-
* @param viewOptions.aggregationCardinalityLimit
|
|
4223
|
-
* Alters the metric stream:
|
|
4224
|
-
* Sets a limit on the number of unique attribute combinations (cardinality) that can be aggregated.
|
|
4225
|
-
* If not provided, the default limit of 2000 will be used.
|
|
4226
|
-
* @param viewOptions.aggregation
|
|
4227
|
-
* Alters the metric stream:
|
|
4228
|
-
* Alters the {@link Aggregation} of the metric stream.
|
|
4229
|
-
* @param viewOptions.instrumentName
|
|
4230
|
-
* Instrument selection criteria:
|
|
4231
|
-
* Original name of the Instrument(s) with wildcard support.
|
|
4232
|
-
* @param viewOptions.instrumentType
|
|
4233
|
-
* Instrument selection criteria:
|
|
4234
|
-
* The original type of the Instrument(s).
|
|
4235
|
-
* @param viewOptions.instrumentUnit
|
|
4236
|
-
* Instrument selection criteria:
|
|
4237
|
-
* The unit of the Instrument(s).
|
|
4238
|
-
* @param viewOptions.meterName
|
|
4239
|
-
* Instrument selection criteria:
|
|
4240
|
-
* The name of the Meter. No wildcard support, name must match the meter exactly.
|
|
4241
|
-
* @param viewOptions.meterVersion
|
|
4242
|
-
* Instrument selection criteria:
|
|
4243
|
-
* The version of the Meter. No wildcard support, version must match exactly.
|
|
4244
|
-
* @param viewOptions.meterSchemaUrl
|
|
4245
|
-
* Instrument selection criteria:
|
|
4246
|
-
* The schema URL of the Meter. No wildcard support, schema URL must match exactly.
|
|
4247
|
-
*
|
|
4248
|
-
* @example
|
|
4249
|
-
* // Create a view that changes the Instrument 'my.instrument' to use to an
|
|
4250
|
-
* // ExplicitBucketHistogramAggregation with the boundaries [20, 30, 40]
|
|
4251
|
-
* new View({
|
|
4252
|
-
* aggregation: new ExplicitBucketHistogramAggregation([20, 30, 40]),
|
|
4253
|
-
* instrumentName: 'my.instrument'
|
|
4254
|
-
* })
|
|
4255
|
-
*/
|
|
4256
|
-
constructor(viewOptions) {
|
|
4257
|
-
validateViewOptions(viewOptions);
|
|
4258
|
-
if (viewOptions.attributesProcessors != null) this.attributesProcessor = (0, AttributesProcessor_1.createMultiAttributesProcessor)(viewOptions.attributesProcessors);
|
|
4259
|
-
else this.attributesProcessor = (0, AttributesProcessor_1.createNoopAttributesProcessor)();
|
|
4260
|
-
this.name = viewOptions.name;
|
|
4261
|
-
this.description = viewOptions.description;
|
|
4262
|
-
this.aggregation = (0, AggregationOption_1.toAggregation)(viewOptions.aggregation ?? { type: AggregationOption_1.AggregationType.DEFAULT });
|
|
4263
|
-
this.instrumentSelector = new InstrumentSelector_1.InstrumentSelector({
|
|
4264
|
-
name: viewOptions.instrumentName,
|
|
4265
|
-
type: viewOptions.instrumentType,
|
|
4266
|
-
unit: viewOptions.instrumentUnit
|
|
4267
|
-
});
|
|
4268
|
-
this.meterSelector = new MeterSelector_1.MeterSelector({
|
|
4269
|
-
name: viewOptions.meterName,
|
|
4270
|
-
version: viewOptions.meterVersion,
|
|
4271
|
-
schemaUrl: viewOptions.meterSchemaUrl
|
|
4272
|
-
});
|
|
4273
|
-
this.aggregationCardinalityLimit = viewOptions.aggregationCardinalityLimit;
|
|
4274
|
-
}
|
|
4275
|
-
};
|
|
4276
|
-
exports.View = View;
|
|
4277
|
-
}));
|
|
4278
|
-
//#endregion
|
|
4279
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/MeterProvider.js
|
|
4280
|
-
var require_MeterProvider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4281
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4282
|
-
exports.MeterProvider = void 0;
|
|
4283
|
-
const api_1 = __require("@opentelemetry/api");
|
|
4284
|
-
const resources_1 = require_src$1();
|
|
4285
|
-
const MeterProviderSharedState_1 = require_MeterProviderSharedState();
|
|
4286
|
-
const MetricCollector_1 = require_MetricCollector();
|
|
4287
|
-
const View_1 = require_View();
|
|
4288
|
-
/**
|
|
4289
|
-
* This class implements the {@link MeterProvider} interface.
|
|
4290
|
-
*/
|
|
4291
|
-
var MeterProvider = class {
|
|
4292
|
-
_sharedState;
|
|
4293
|
-
_shutdown = false;
|
|
4294
|
-
constructor(options) {
|
|
4295
|
-
this._sharedState = new MeterProviderSharedState_1.MeterProviderSharedState(options?.resource ?? (0, resources_1.defaultResource)());
|
|
4296
|
-
if (options?.views != null && options.views.length > 0) for (const viewOption of options.views) this._sharedState.viewRegistry.addView(new View_1.View(viewOption));
|
|
4297
|
-
if (options?.readers != null && options.readers.length > 0) for (const metricReader of options.readers) {
|
|
4298
|
-
const collector = new MetricCollector_1.MetricCollector(this._sharedState, metricReader);
|
|
4299
|
-
metricReader.setMetricProducer(collector);
|
|
4300
|
-
this._sharedState.metricCollectors.push(collector);
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
|
-
/**
|
|
4304
|
-
* Get a meter with the configuration of the MeterProvider.
|
|
4305
|
-
*/
|
|
4306
|
-
getMeter(name, version = "", options = {}) {
|
|
4307
|
-
if (this._shutdown) {
|
|
4308
|
-
api_1.diag.warn("A shutdown MeterProvider cannot provide a Meter");
|
|
4309
|
-
return (0, api_1.createNoopMeter)();
|
|
4310
|
-
}
|
|
4311
|
-
return this._sharedState.getMeterSharedState({
|
|
4312
|
-
name,
|
|
4313
|
-
version,
|
|
4314
|
-
schemaUrl: options.schemaUrl
|
|
4315
|
-
}).meter;
|
|
4316
|
-
}
|
|
4317
|
-
/**
|
|
4318
|
-
* Shut down the MeterProvider and all registered
|
|
4319
|
-
* MetricReaders.
|
|
4320
|
-
*
|
|
4321
|
-
* Returns a promise which is resolved when all flushes are complete.
|
|
4322
|
-
*/
|
|
4323
|
-
async shutdown(options) {
|
|
4324
|
-
if (this._shutdown) {
|
|
4325
|
-
api_1.diag.warn("shutdown may only be called once per MeterProvider");
|
|
4326
|
-
return;
|
|
4327
|
-
}
|
|
4328
|
-
this._shutdown = true;
|
|
4329
|
-
await Promise.all(this._sharedState.metricCollectors.map((collector) => {
|
|
4330
|
-
return collector.shutdown(options);
|
|
4331
|
-
}));
|
|
4332
|
-
}
|
|
4333
|
-
/**
|
|
4334
|
-
* Notifies all registered MetricReaders to flush any buffered data.
|
|
4335
|
-
*
|
|
4336
|
-
* Returns a promise which is resolved when all flushes are complete.
|
|
4337
|
-
*/
|
|
4338
|
-
async forceFlush(options) {
|
|
4339
|
-
if (this._shutdown) {
|
|
4340
|
-
api_1.diag.warn("invalid attempt to force flush after MeterProvider shutdown");
|
|
4341
|
-
return;
|
|
4342
|
-
}
|
|
4343
|
-
await Promise.all(this._sharedState.metricCollectors.map((collector) => {
|
|
4344
|
-
return collector.forceFlush(options);
|
|
4345
|
-
}));
|
|
4346
|
-
}
|
|
4347
|
-
};
|
|
4348
|
-
exports.MeterProvider = MeterProvider;
|
|
4349
|
-
}));
|
|
4350
|
-
//#endregion
|
|
18
|
+
import { AggregationTemporality, InMemoryMetricExporter, MeterProvider, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
|
4351
19
|
//#region src/federation/send.test.ts
|
|
4352
|
-
var import_src = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4353
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4354
|
-
exports.TimeoutError = exports.createDenyListAttributesProcessor = exports.createAllowListAttributesProcessor = exports.AggregationType = exports.MeterProvider = exports.ConsoleMetricExporter = exports.InMemoryMetricExporter = exports.PeriodicExportingMetricReader = exports.MetricReader = exports.InstrumentType = exports.DataPointType = exports.AggregationTemporality = void 0;
|
|
4355
|
-
var AggregationTemporality_1 = require_AggregationTemporality();
|
|
4356
|
-
Object.defineProperty(exports, "AggregationTemporality", {
|
|
4357
|
-
enumerable: true,
|
|
4358
|
-
get: function() {
|
|
4359
|
-
return AggregationTemporality_1.AggregationTemporality;
|
|
4360
|
-
}
|
|
4361
|
-
});
|
|
4362
|
-
var MetricData_1 = require_MetricData();
|
|
4363
|
-
Object.defineProperty(exports, "DataPointType", {
|
|
4364
|
-
enumerable: true,
|
|
4365
|
-
get: function() {
|
|
4366
|
-
return MetricData_1.DataPointType;
|
|
4367
|
-
}
|
|
4368
|
-
});
|
|
4369
|
-
Object.defineProperty(exports, "InstrumentType", {
|
|
4370
|
-
enumerable: true,
|
|
4371
|
-
get: function() {
|
|
4372
|
-
return MetricData_1.InstrumentType;
|
|
4373
|
-
}
|
|
4374
|
-
});
|
|
4375
|
-
var MetricReader_1 = require_MetricReader();
|
|
4376
|
-
Object.defineProperty(exports, "MetricReader", {
|
|
4377
|
-
enumerable: true,
|
|
4378
|
-
get: function() {
|
|
4379
|
-
return MetricReader_1.MetricReader;
|
|
4380
|
-
}
|
|
4381
|
-
});
|
|
4382
|
-
var PeriodicExportingMetricReader_1 = require_PeriodicExportingMetricReader();
|
|
4383
|
-
Object.defineProperty(exports, "PeriodicExportingMetricReader", {
|
|
4384
|
-
enumerable: true,
|
|
4385
|
-
get: function() {
|
|
4386
|
-
return PeriodicExportingMetricReader_1.PeriodicExportingMetricReader;
|
|
4387
|
-
}
|
|
4388
|
-
});
|
|
4389
|
-
var InMemoryMetricExporter_1 = require_InMemoryMetricExporter();
|
|
4390
|
-
Object.defineProperty(exports, "InMemoryMetricExporter", {
|
|
4391
|
-
enumerable: true,
|
|
4392
|
-
get: function() {
|
|
4393
|
-
return InMemoryMetricExporter_1.InMemoryMetricExporter;
|
|
4394
|
-
}
|
|
4395
|
-
});
|
|
4396
|
-
var ConsoleMetricExporter_1 = require_ConsoleMetricExporter();
|
|
4397
|
-
Object.defineProperty(exports, "ConsoleMetricExporter", {
|
|
4398
|
-
enumerable: true,
|
|
4399
|
-
get: function() {
|
|
4400
|
-
return ConsoleMetricExporter_1.ConsoleMetricExporter;
|
|
4401
|
-
}
|
|
4402
|
-
});
|
|
4403
|
-
var MeterProvider_1 = require_MeterProvider();
|
|
4404
|
-
Object.defineProperty(exports, "MeterProvider", {
|
|
4405
|
-
enumerable: true,
|
|
4406
|
-
get: function() {
|
|
4407
|
-
return MeterProvider_1.MeterProvider;
|
|
4408
|
-
}
|
|
4409
|
-
});
|
|
4410
|
-
var AggregationOption_1 = require_AggregationOption();
|
|
4411
|
-
Object.defineProperty(exports, "AggregationType", {
|
|
4412
|
-
enumerable: true,
|
|
4413
|
-
get: function() {
|
|
4414
|
-
return AggregationOption_1.AggregationType;
|
|
4415
|
-
}
|
|
4416
|
-
});
|
|
4417
|
-
var AttributesProcessor_1 = require_AttributesProcessor();
|
|
4418
|
-
Object.defineProperty(exports, "createAllowListAttributesProcessor", {
|
|
4419
|
-
enumerable: true,
|
|
4420
|
-
get: function() {
|
|
4421
|
-
return AttributesProcessor_1.createAllowListAttributesProcessor;
|
|
4422
|
-
}
|
|
4423
|
-
});
|
|
4424
|
-
Object.defineProperty(exports, "createDenyListAttributesProcessor", {
|
|
4425
|
-
enumerable: true,
|
|
4426
|
-
get: function() {
|
|
4427
|
-
return AttributesProcessor_1.createDenyListAttributesProcessor;
|
|
4428
|
-
}
|
|
4429
|
-
});
|
|
4430
|
-
var utils_1 = require_utils$2();
|
|
4431
|
-
Object.defineProperty(exports, "TimeoutError", {
|
|
4432
|
-
enumerable: true,
|
|
4433
|
-
get: function() {
|
|
4434
|
-
return utils_1.TimeoutError;
|
|
4435
|
-
}
|
|
4436
|
-
});
|
|
4437
|
-
})))();
|
|
4438
20
|
test("extractInboxes()", () => {
|
|
4439
21
|
const recipients = [
|
|
4440
22
|
new Person({
|
|
@@ -4937,8 +519,8 @@ test("sendActivity() records OpenTelemetry delivery metrics", async (t) => {
|
|
|
4937
519
|
});
|
|
4938
520
|
});
|
|
4939
521
|
test("sendActivity() exports delivery metrics through OpenTelemetry SDK", async () => {
|
|
4940
|
-
const exporter = new
|
|
4941
|
-
const meterProvider = new
|
|
522
|
+
const exporter = new InMemoryMetricExporter(AggregationTemporality.CUMULATIVE);
|
|
523
|
+
const meterProvider = new MeterProvider({ readers: [new PeriodicExportingMetricReader({
|
|
4942
524
|
exporter,
|
|
4943
525
|
exportIntervalMillis: 6e4
|
|
4944
526
|
})] });
|