@ms-cloudpack/telemetry 0.11.75 → 0.12.1

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.
@@ -0,0 +1,501 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ import { createRequire as topLevelCreateRequire } from 'node:module';
4
+ import topLevelPath from 'node:path';
5
+ import topLevelUrl from 'node:url';
6
+ const require = topLevelCreateRequire(import.meta.url);
7
+ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
8
+ const __dirname = topLevelPath.dirname(__filename);
9
+ import {
10
+ BreezePerformanceCounterNames,
11
+ CustomSDKStatsCounter,
12
+ CustomerSDKStats,
13
+ DropCode,
14
+ DropReason,
15
+ ExceptionType,
16
+ RetryCode,
17
+ RetryReason,
18
+ STATSBEAT_LANGUAGE,
19
+ StatsbeatMetrics,
20
+ TelemetryType,
21
+ getAttachType,
22
+ packageVersion,
23
+ require_src3 as require_src
24
+ } from "./chunk-KMOWBBY7.js";
25
+ import {
26
+ __name,
27
+ __toESM,
28
+ diag,
29
+ init_esm
30
+ } from "./chunk-UQTA3BJ6.js";
31
+
32
+ // ../../node_modules/.store/@azure-monitor-opentelemetry-exporter-npm-1.0.0-beta.39-2525e0dfa0/package/dist/esm/export/statsbeat/customerSDKStats.js
33
+ init_esm();
34
+ var import_sdk_metrics = __toESM(require_src(), 1);
35
+ var CustomerSDKStatsMetrics = class _CustomerSDKStatsMetrics extends StatsbeatMetrics {
36
+ static {
37
+ __name(this, "CustomerSDKStatsMetrics");
38
+ }
39
+ static _instance;
40
+ statsCollectionInterval = 9e5;
41
+ // 15 minutes
42
+ customerSDKStatsMeter;
43
+ customerSDKStatsMeterProvider;
44
+ customerSDKStatsExporter;
45
+ customerSDKStatsCounter;
46
+ customerSDKStatsMetricReader;
47
+ isInitialized = false;
48
+ // Custom dimensions
49
+ language;
50
+ version;
51
+ attach = getAttachType();
52
+ // Observable Gauges
53
+ itemSuccessCountGauge;
54
+ itemDropCountGauge;
55
+ itemRetryCountGauge;
56
+ // Customer SDK Stats properties
57
+ customerProperties;
58
+ constructor(options, exporter) {
59
+ super();
60
+ this.customerSDKStatsExporter = exporter;
61
+ const customerMetricReaderOptions = {
62
+ exporter: this.customerSDKStatsExporter,
63
+ exportIntervalMillis: options.networkCollectionInterval || this.statsCollectionInterval
64
+ };
65
+ this.customerSDKStatsMetricReader = new import_sdk_metrics.PeriodicExportingMetricReader(customerMetricReaderOptions);
66
+ this.customerSDKStatsMeterProvider = new import_sdk_metrics.MeterProvider({
67
+ readers: [this.customerSDKStatsMetricReader]
68
+ });
69
+ this.customerSDKStatsMeter = this.customerSDKStatsMeterProvider.getMeter("Azure Monitor Customer SDK Stats");
70
+ this.language = STATSBEAT_LANGUAGE;
71
+ this.version = packageVersion;
72
+ this.itemSuccessCountGauge = this.customerSDKStatsMeter.createObservableGauge(CustomSDKStatsCounter.ITEM_SUCCESS_COUNT);
73
+ this.itemDropCountGauge = this.customerSDKStatsMeter.createObservableGauge(CustomSDKStatsCounter.ITEM_DROP_COUNT);
74
+ this.itemRetryCountGauge = this.customerSDKStatsMeter.createObservableGauge(CustomSDKStatsCounter.ITEM_RETRY_COUNT);
75
+ if (!this.isInitialized) {
76
+ this.initialize();
77
+ }
78
+ this.isInitialized = true;
79
+ this.customerSDKStatsCounter = new CustomerSDKStats();
80
+ this.customerProperties = {
81
+ language: this.language,
82
+ version: this.version,
83
+ computeType: this.attach
84
+ };
85
+ }
86
+ /**
87
+ * Get singleton instance of CustomerSDKStatsMetrics
88
+ * @param options - Configuration options for customer SDK Stats metrics
89
+ * @returns Promise of the singleton instance
90
+ */
91
+ static async getInstance(options) {
92
+ if (!_CustomerSDKStatsMetrics._instance) {
93
+ const { AzureMonitorStatsbeatExporter } = await import("./statsbeatExporter-XU2SC6L6.js");
94
+ const customerStatsExporterConfig = {
95
+ connectionString: `InstrumentationKey=${options.instrumentationKey};IngestionEndpoint=${options.endpointUrl}`
96
+ };
97
+ const exporter = new AzureMonitorStatsbeatExporter(customerStatsExporterConfig);
98
+ _CustomerSDKStatsMetrics._instance = new _CustomerSDKStatsMetrics(options, exporter);
99
+ }
100
+ return _CustomerSDKStatsMetrics._instance;
101
+ }
102
+ /**
103
+ * Shutdown the singleton instance
104
+ * Used for cleanup and complete shutdown
105
+ */
106
+ static shutdown() {
107
+ if (_CustomerSDKStatsMetrics._instance) {
108
+ const shutdownPromise = _CustomerSDKStatsMetrics._instance.shutdown();
109
+ _CustomerSDKStatsMetrics._instance = void 0;
110
+ return shutdownPromise;
111
+ }
112
+ return void 0;
113
+ }
114
+ /**
115
+ * Shuts down the customer SDK Stats metrics provider
116
+ * @returns Promise<void>
117
+ */
118
+ shutdown() {
119
+ return this.customerSDKStatsMeterProvider.shutdown();
120
+ }
121
+ /**
122
+ * Initializes the customer SDK Stats metrics
123
+ * Sets up the resource provider and adds observable callbacks for each metric
124
+ * @returns Promise<void>
125
+ */
126
+ async initialize() {
127
+ try {
128
+ await super.getResourceProvider();
129
+ this.customerSDKStatsMeter.addBatchObservableCallback(this.itemSuccessCallback.bind(this), [
130
+ this.itemSuccessCountGauge
131
+ ]);
132
+ this.customerSDKStatsMeter.addBatchObservableCallback(this.itemDropCallback.bind(this), [
133
+ this.itemDropCountGauge
134
+ ]);
135
+ this.customerSDKStatsMeter.addBatchObservableCallback(this.itemRetryCallback.bind(this), [
136
+ this.itemRetryCountGauge
137
+ ]);
138
+ } catch (error) {
139
+ diag.debug("Call to get the resource provider failed for customer SDK Stats metrics.");
140
+ }
141
+ }
142
+ // Observable gauge callbacks
143
+ itemSuccessCallback(observableResult) {
144
+ const counter = this.customerSDKStatsCounter;
145
+ const attributes = { ...this.customerProperties, telemetry_type: TelemetryType.UNKNOWN };
146
+ for (const [telemetry_type, count] of counter.totalItemSuccessCount.entries()) {
147
+ if (count > 0) {
148
+ attributes.telemetry_type = telemetry_type;
149
+ observableResult.observe(this.itemSuccessCountGauge, count, {
150
+ ...attributes
151
+ });
152
+ counter.totalItemSuccessCount.set(telemetry_type, 0);
153
+ }
154
+ }
155
+ }
156
+ itemDropCallback(observableResult) {
157
+ const counter = this.customerSDKStatsCounter;
158
+ const baseAttributes = {
159
+ ...this.customerProperties,
160
+ "drop.code": DropCode.UNKNOWN,
161
+ telemetry_type: TelemetryType.UNKNOWN
162
+ };
163
+ for (const [telemetryType, dropCodeMap] of counter.totalItemDropCount.entries()) {
164
+ for (const [dropCode, reasonMap] of dropCodeMap.entries()) {
165
+ for (const [reason, successMap] of reasonMap.entries()) {
166
+ for (const [success, count] of successMap.entries()) {
167
+ const attributes = { ...baseAttributes };
168
+ attributes.telemetry_type = telemetryType;
169
+ attributes["drop.code"] = dropCode;
170
+ if (reason) {
171
+ attributes["drop.reason"] = reason;
172
+ }
173
+ if ((telemetryType === TelemetryType.REQUEST || telemetryType === TelemetryType.DEPENDENCY) && success !== null) {
174
+ attributes["telemetry_success"] = success;
175
+ }
176
+ if (count > 0) {
177
+ observableResult.observe(this.itemDropCountGauge, count, {
178
+ ...attributes
179
+ });
180
+ }
181
+ successMap.set(success, 0);
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+ itemRetryCallback(observableResult) {
188
+ const counter = this.customerSDKStatsCounter;
189
+ const baseAttributes = {
190
+ ...this.customerProperties,
191
+ "retry.code": RetryCode.UNKNOWN,
192
+ telemetry_type: TelemetryType.UNKNOWN
193
+ };
194
+ for (const [telemetryType, retryCodeMap] of counter.totalItemRetryCount.entries()) {
195
+ for (const [retryCode, reasonMap] of retryCodeMap.entries()) {
196
+ for (const [reason, count] of reasonMap.entries()) {
197
+ const attributes = { ...baseAttributes };
198
+ attributes.telemetry_type = telemetryType;
199
+ attributes["retry.code"] = retryCode;
200
+ if (reason) {
201
+ attributes["retry.reason"] = reason;
202
+ }
203
+ if (count > 0) {
204
+ observableResult.observe(this.itemRetryCountGauge, count, {
205
+ ...attributes
206
+ });
207
+ }
208
+ reasonMap.set(reason, 0);
209
+ }
210
+ }
211
+ }
212
+ }
213
+ // Public methods to track metrics
214
+ /**
215
+ * Tracks succcessful items
216
+ * @param envelopes - Number of successful envelopes
217
+ * @param telemetry_type - The type of telemetry being tracked
218
+ */
219
+ countSuccessfulItems(envelopes) {
220
+ const counter = this.customerSDKStatsCounter;
221
+ let telemetry_type;
222
+ for (const envelope of envelopes) {
223
+ telemetry_type = this.getTelemetryTypeFromEnvelope(envelope);
224
+ const currentCount = counter.totalItemSuccessCount.get(telemetry_type) || 0;
225
+ counter.totalItemSuccessCount.set(telemetry_type, currentCount + 1);
226
+ }
227
+ }
228
+ /**
229
+ * Tracks dropped items
230
+ * @param envelopes - Array of envelopes dropped
231
+ * @param dropCode - The drop code indicating the reason for drop
232
+ * @param exceptionMessage - Optional exception message when dropCode is CLIENT_EXCEPTION
233
+ * @param exceptionType - Optional explicit exception type override when dropCode is CLIENT_EXCEPTION
234
+ */
235
+ countDroppedItems(envelopes, dropCode, exceptionMessage, exceptionType) {
236
+ const counter = this.customerSDKStatsCounter;
237
+ let telemetry_type;
238
+ for (const envelope of envelopes) {
239
+ telemetry_type = this.getTelemetryTypeFromEnvelope(envelope);
240
+ let dropCodeMap = counter.totalItemDropCount.get(telemetry_type);
241
+ if (!dropCodeMap) {
242
+ dropCodeMap = /* @__PURE__ */ new Map();
243
+ counter.totalItemDropCount.set(telemetry_type, dropCodeMap);
244
+ }
245
+ let reasonMap = dropCodeMap.get(dropCode);
246
+ if (!reasonMap) {
247
+ reasonMap = /* @__PURE__ */ new Map();
248
+ dropCodeMap.set(dropCode, reasonMap);
249
+ }
250
+ const reason = this.getDropReason(dropCode, exceptionMessage, exceptionType);
251
+ let successMap = reasonMap.get(reason);
252
+ if (!successMap) {
253
+ successMap = /* @__PURE__ */ new Map();
254
+ reasonMap.set(reason, successMap);
255
+ }
256
+ const individualTelemetrySuccess = this.getTelemetrySuccessFromEnvelope(envelope);
257
+ const successKey = (telemetry_type === TelemetryType.REQUEST || telemetry_type === TelemetryType.DEPENDENCY) && individualTelemetrySuccess !== void 0 ? individualTelemetrySuccess : null;
258
+ const currentCount = successMap.get(successKey) || 0;
259
+ successMap.set(successKey, currentCount + 1);
260
+ }
261
+ }
262
+ /**
263
+ * Generates a low-cardinality, informative description for drop reasons
264
+ * @param dropCode - The drop code (enum value or status code number)
265
+ * @param exceptionMessage - Optional exception message for CLIENT_EXCEPTION
266
+ * @param exceptionType - Optional explicit exception type override for CLIENT_EXCEPTION
267
+ * @returns A descriptive reason string with low cardinality
268
+ */
269
+ getDropReason(dropCode, exceptionMessage, exceptionType) {
270
+ if (dropCode === DropCode.CLIENT_EXCEPTION) {
271
+ if (exceptionType) {
272
+ return exceptionType;
273
+ }
274
+ if (exceptionMessage) {
275
+ return this.categorizeExceptionMessage(exceptionMessage);
276
+ }
277
+ return ExceptionType.CLIENT_EXCEPTION;
278
+ }
279
+ if (typeof dropCode === "number") {
280
+ return this.categorizeStatusCode(dropCode);
281
+ }
282
+ switch (dropCode) {
283
+ case DropCode.CLIENT_READONLY:
284
+ return DropReason.CLIENT_READONLY;
285
+ case DropCode.CLIENT_PERSISTENCE_CAPACITY:
286
+ return DropReason.CLIENT_PERSISTENCE_CAPACITY;
287
+ case DropCode.CLIENT_STORAGE_DISABLED:
288
+ return DropReason.CLIENT_STORAGE_DISABLED;
289
+ case DropCode.UNKNOWN:
290
+ default:
291
+ return DropReason.UNKNOWN;
292
+ }
293
+ }
294
+ /**
295
+ * Categorizes exception messages into well-known exception categories
296
+ * @param exceptionMessage - The exception message to categorize
297
+ * @returns A well-known exception category string
298
+ */
299
+ categorizeExceptionMessage(exceptionMessage) {
300
+ const message = exceptionMessage.toLowerCase();
301
+ if (message.includes("timeout") || message.includes("timed out")) {
302
+ return ExceptionType.TIMEOUT_EXCEPTION;
303
+ }
304
+ if (message.includes("network") || message.includes("connection") || message.includes("dns") || message.includes("socket")) {
305
+ return ExceptionType.NETWORK_EXCEPTION;
306
+ }
307
+ if (message.includes("disk") || message.includes("storage") || message.includes("file") || message.includes("persist")) {
308
+ return ExceptionType.STORAGE_EXCEPTION;
309
+ }
310
+ return ExceptionType.CLIENT_EXCEPTION;
311
+ }
312
+ /**
313
+ * Categorizes HTTP status codes into informative descriptions
314
+ * @param statusCode - The HTTP status code
315
+ * @returns A descriptive category string
316
+ */
317
+ categorizeStatusCode(statusCode) {
318
+ if (statusCode >= 400 && statusCode < 500) {
319
+ switch (statusCode) {
320
+ case 400:
321
+ return "Bad request";
322
+ case 401:
323
+ return "Unauthorized";
324
+ case 403:
325
+ return "Forbidden";
326
+ case 404:
327
+ return "Not found";
328
+ case 408:
329
+ return "Request timeout";
330
+ case 413:
331
+ return "Payload too large";
332
+ case 429:
333
+ return "Too many requests";
334
+ default:
335
+ return "Client error 4xx";
336
+ }
337
+ }
338
+ if (statusCode >= 500 && statusCode < 600) {
339
+ switch (statusCode) {
340
+ case 500:
341
+ return "Internal server error";
342
+ case 502:
343
+ return "Bad gateway";
344
+ case 503:
345
+ return "Service unavailable";
346
+ case 504:
347
+ return "Gateway timeout";
348
+ default:
349
+ return "Server error 5xx";
350
+ }
351
+ }
352
+ return `status_${statusCode}`;
353
+ }
354
+ /**
355
+ * Tracks retried envelopes
356
+ * @param envelopes - Number of envelopes retried
357
+ * @param retryCode - The retry code indicating the reason for retry
358
+ * @param exceptionMessage - Optional exception message when retryCode is CLIENT_EXCEPTION
359
+ * @param exceptionType - Optional explicit exception type override when retryCode is CLIENT_EXCEPTION
360
+ */
361
+ countRetryItems(envelopes, retryCode, exceptionMessage, exceptionType) {
362
+ const counter = this.customerSDKStatsCounter;
363
+ let telemetry_type;
364
+ for (const envelope of envelopes) {
365
+ telemetry_type = this.getTelemetryTypeFromEnvelope(envelope);
366
+ let retryCodeMap = counter.totalItemRetryCount.get(telemetry_type);
367
+ if (!retryCodeMap) {
368
+ retryCodeMap = /* @__PURE__ */ new Map();
369
+ counter.totalItemRetryCount.set(telemetry_type, retryCodeMap);
370
+ }
371
+ let reasonMap = retryCodeMap.get(retryCode);
372
+ if (!reasonMap) {
373
+ reasonMap = /* @__PURE__ */ new Map();
374
+ retryCodeMap.set(retryCode, reasonMap);
375
+ }
376
+ const reason = this.getRetryReason(retryCode, exceptionMessage, exceptionType);
377
+ const currentCount = reasonMap.get(reason) || 0;
378
+ reasonMap.set(reason, currentCount + 1);
379
+ }
380
+ }
381
+ /**
382
+ * Generates a low-cardinality, informative description for retry reasons
383
+ * @param retryCode - The retry code (enum value or status code number)
384
+ * @param exceptionMessage - Optional exception message for CLIENT_EXCEPTION
385
+ * @param exceptionType - Optional explicit exception type override for CLIENT_EXCEPTION
386
+ * @returns A descriptive reason string with low cardinality
387
+ */
388
+ getRetryReason(retryCode, exceptionMessage, exceptionType) {
389
+ if (retryCode === RetryCode.CLIENT_EXCEPTION) {
390
+ if (exceptionType) {
391
+ return exceptionType;
392
+ }
393
+ if (exceptionMessage) {
394
+ return this.categorizeExceptionMessage(exceptionMessage);
395
+ }
396
+ return ExceptionType.CLIENT_EXCEPTION;
397
+ }
398
+ if (typeof retryCode === "number") {
399
+ return this.categorizeStatusCode(retryCode);
400
+ }
401
+ switch (retryCode) {
402
+ case RetryCode.CLIENT_TIMEOUT:
403
+ return RetryReason.CLIENT_TIMEOUT;
404
+ case RetryCode.UNKNOWN:
405
+ default:
406
+ return RetryReason.UNKNOWN;
407
+ }
408
+ }
409
+ /**
410
+ * Check if a metric name corresponds to a performance counter
411
+ * @param metricName - The name of the metric to check
412
+ * @returns true if the metric name is a performance counter, false otherwise
413
+ */
414
+ isPerformanceCounterMetric(metricName) {
415
+ return Object.values(BreezePerformanceCounterNames).includes(metricName);
416
+ }
417
+ /**
418
+ * Extract telemetry type from an envelope based on its baseType
419
+ * @param envelope - The envelope to extract telemetry type from
420
+ * @returns The corresponding telemetry type
421
+ */
422
+ getTelemetryTypeFromEnvelope(envelope) {
423
+ if (envelope.data && envelope.data.baseType) {
424
+ switch (envelope.data.baseType) {
425
+ case "MessageData":
426
+ return TelemetryType.TRACE;
427
+ case "AvailabilityData":
428
+ return TelemetryType.AVAILABILITY;
429
+ case "TelemetryEventData":
430
+ return TelemetryType.CUSTOM_EVENT;
431
+ case "TelemetryExceptionData":
432
+ return TelemetryType.EXCEPTION;
433
+ case "PageViewData":
434
+ return TelemetryType.PAGE_VIEW;
435
+ case "RemoteDependencyData":
436
+ return TelemetryType.DEPENDENCY;
437
+ case "RequestData":
438
+ return TelemetryType.REQUEST;
439
+ case "MetricData": {
440
+ const metricsData = envelope.data.baseData;
441
+ if (metricsData && metricsData.metrics && metricsData.metrics.length > 0) {
442
+ const hasPerformanceCounter = metricsData.metrics.some((metric) => this.isPerformanceCounterMetric(metric.name));
443
+ return hasPerformanceCounter ? TelemetryType.PERFORMANCE_COUNTER : TelemetryType.CUSTOM_METRIC;
444
+ }
445
+ return TelemetryType.CUSTOM_METRIC;
446
+ }
447
+ default:
448
+ return TelemetryType.UNKNOWN;
449
+ }
450
+ }
451
+ return TelemetryType.UNKNOWN;
452
+ }
453
+ /**
454
+ * Extract telemetry success value from an envelope for REQUEST and DEPENDENCY telemetry types
455
+ * @param envelope - The envelope to extract success value from
456
+ * @returns The success value if available, undefined otherwise
457
+ */
458
+ getTelemetrySuccessFromEnvelope(envelope) {
459
+ if (!envelope.data || !envelope.data.baseData) {
460
+ return void 0;
461
+ }
462
+ const baseType = envelope.data.baseType;
463
+ if (baseType === "RequestData") {
464
+ const requestData = envelope.data.baseData;
465
+ return requestData.success;
466
+ } else if (baseType === "RemoteDependencyData") {
467
+ const dependencyData = envelope.data.baseData;
468
+ return dependencyData.success;
469
+ }
470
+ return void 0;
471
+ }
472
+ /**
473
+ * Checks if the given error is a timeout-related error
474
+ * @param error - The error to check
475
+ * @returns true if the error is timeout-related, false otherwise
476
+ */
477
+ isTimeoutError(error) {
478
+ const timeoutErrorCodes = [
479
+ "ETIMEDOUT",
480
+ // Connection timed out
481
+ "ESOCKETTIMEDOUT",
482
+ // Socket timeout
483
+ "ECONNRESET",
484
+ // Connection reset (often due to timeout)
485
+ "ENOTFOUND"
486
+ // DNS lookup failed/timeout
487
+ ];
488
+ if (error && error.code && timeoutErrorCodes.includes(error.code)) {
489
+ return true;
490
+ }
491
+ if (error && error.message) {
492
+ const timeoutKeywords = ["timeout", "timed out", "connection reset"];
493
+ const errorMessage = error.message.toLowerCase();
494
+ return timeoutKeywords.some((keyword) => errorMessage.includes(keyword));
495
+ }
496
+ return false;
497
+ }
498
+ };
499
+ export {
500
+ CustomerSDKStatsMetrics
501
+ };
@@ -0,0 +1,48 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ import { createRequire as topLevelCreateRequire } from 'node:module';
4
+ import topLevelPath from 'node:path';
5
+ import topLevelUrl from 'node:url';
6
+ const require = topLevelCreateRequire(import.meta.url);
7
+ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
8
+ const __dirname = topLevelPath.dirname(__filename);
9
+ import {
10
+ require_execAsync
11
+ } from "./chunk-QIPRD32X.js";
12
+ import {
13
+ __commonJS,
14
+ __name,
15
+ __require,
16
+ __toCommonJS,
17
+ esm_exports,
18
+ init_esm
19
+ } from "./chunk-UQTA3BJ6.js";
20
+
21
+ // ../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js
22
+ var require_getMachineId_bsd = __commonJS({
23
+ "../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js"(exports) {
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.getMachineId = void 0;
26
+ var fs_1 = __require("fs");
27
+ var execAsync_1 = require_execAsync();
28
+ var api_1 = (init_esm(), __toCommonJS(esm_exports));
29
+ async function getMachineId() {
30
+ try {
31
+ const result = await fs_1.promises.readFile("/etc/hostid", { encoding: "utf8" });
32
+ return result.trim();
33
+ } catch (e) {
34
+ api_1.diag.debug(`error reading machine id: ${e}`);
35
+ }
36
+ try {
37
+ const result = await (0, execAsync_1.execAsync)("kenv -q smbios.system.uuid");
38
+ return result.stdout.trim();
39
+ } catch (e) {
40
+ api_1.diag.debug(`error reading machine id: ${e}`);
41
+ }
42
+ return void 0;
43
+ }
44
+ __name(getMachineId, "getMachineId");
45
+ exports.getMachineId = getMachineId;
46
+ }
47
+ });
48
+ export default require_getMachineId_bsd();
@@ -0,0 +1,47 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ import { createRequire as topLevelCreateRequire } from 'node:module';
4
+ import topLevelPath from 'node:path';
5
+ import topLevelUrl from 'node:url';
6
+ const require = topLevelCreateRequire(import.meta.url);
7
+ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
8
+ const __dirname = topLevelPath.dirname(__filename);
9
+ import {
10
+ require_execAsync
11
+ } from "./chunk-QIPRD32X.js";
12
+ import {
13
+ __commonJS,
14
+ __name,
15
+ __toCommonJS,
16
+ esm_exports,
17
+ init_esm
18
+ } from "./chunk-UQTA3BJ6.js";
19
+
20
+ // ../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js
21
+ var require_getMachineId_darwin = __commonJS({
22
+ "../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js"(exports) {
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.getMachineId = void 0;
25
+ var execAsync_1 = require_execAsync();
26
+ var api_1 = (init_esm(), __toCommonJS(esm_exports));
27
+ async function getMachineId() {
28
+ try {
29
+ const result = await (0, execAsync_1.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"');
30
+ const idLine = result.stdout.split("\n").find((line) => line.includes("IOPlatformUUID"));
31
+ if (!idLine) {
32
+ return void 0;
33
+ }
34
+ const parts = idLine.split('" = "');
35
+ if (parts.length === 2) {
36
+ return parts[1].slice(0, -1);
37
+ }
38
+ } catch (e) {
39
+ api_1.diag.debug(`error reading machine id: ${e}`);
40
+ }
41
+ return void 0;
42
+ }
43
+ __name(getMachineId, "getMachineId");
44
+ exports.getMachineId = getMachineId;
45
+ }
46
+ });
47
+ export default require_getMachineId_darwin();
@@ -0,0 +1,41 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ import { createRequire as topLevelCreateRequire } from 'node:module';
4
+ import topLevelPath from 'node:path';
5
+ import topLevelUrl from 'node:url';
6
+ const require = topLevelCreateRequire(import.meta.url);
7
+ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
8
+ const __dirname = topLevelPath.dirname(__filename);
9
+ import {
10
+ __commonJS,
11
+ __name,
12
+ __require,
13
+ __toCommonJS,
14
+ esm_exports,
15
+ init_esm
16
+ } from "./chunk-UQTA3BJ6.js";
17
+
18
+ // ../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-linux.js
19
+ var require_getMachineId_linux = __commonJS({
20
+ "../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-linux.js"(exports) {
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.getMachineId = void 0;
23
+ var fs_1 = __require("fs");
24
+ var api_1 = (init_esm(), __toCommonJS(esm_exports));
25
+ async function getMachineId() {
26
+ const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
27
+ for (const path of paths) {
28
+ try {
29
+ const result = await fs_1.promises.readFile(path, { encoding: "utf8" });
30
+ return result.trim();
31
+ } catch (e) {
32
+ api_1.diag.debug(`error reading machine id: ${e}`);
33
+ }
34
+ }
35
+ return void 0;
36
+ }
37
+ __name(getMachineId, "getMachineId");
38
+ exports.getMachineId = getMachineId;
39
+ }
40
+ });
41
+ export default require_getMachineId_linux();
@@ -0,0 +1,31 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ import { createRequire as topLevelCreateRequire } from 'node:module';
4
+ import topLevelPath from 'node:path';
5
+ import topLevelUrl from 'node:url';
6
+ const require = topLevelCreateRequire(import.meta.url);
7
+ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
8
+ const __dirname = topLevelPath.dirname(__filename);
9
+ import {
10
+ __commonJS,
11
+ __name,
12
+ __toCommonJS,
13
+ esm_exports,
14
+ init_esm
15
+ } from "./chunk-UQTA3BJ6.js";
16
+
17
+ // ../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-unsupported.js
18
+ var require_getMachineId_unsupported = __commonJS({
19
+ "../../node_modules/.store/@opentelemetry-resources-virtual-78a075cc9f/package/build/src/detectors/platform/node/machine-id/getMachineId-unsupported.js"(exports) {
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.getMachineId = void 0;
22
+ var api_1 = (init_esm(), __toCommonJS(esm_exports));
23
+ async function getMachineId() {
24
+ api_1.diag.debug("could not read machine-id: unsupported platform");
25
+ return void 0;
26
+ }
27
+ __name(getMachineId, "getMachineId");
28
+ exports.getMachineId = getMachineId;
29
+ }
30
+ });
31
+ export default require_getMachineId_unsupported();