@ms-cloudpack/telemetry 0.11.75 → 0.12.0

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