@graphql-hive/gateway 2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e → 2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @graphql-hive/gateway
2
2
 
3
- ## 2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
3
+ ## 2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
4
4
  ### Major Changes
5
5
 
6
6
 
@@ -100,19 +100,19 @@
100
100
  - Added dependency [`@opentelemetry/sdk-trace-base@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-trace-base/v/2.0.1) (to `dependencies`)
101
101
  - Removed dependency [`@graphql-mesh/plugin-mock@^0.105.8` ↗︎](https://www.npmjs.com/package/@graphql-mesh/plugin-mock/v/0.105.8) (from `dependencies`)
102
102
  - Updated dependencies [[`7766e3c`](https://github.com/graphql-hive/gateway/commit/7766e3c52272c5a58cc9a25b9d1a0e2886be11e1), [`a2312e1`](https://github.com/graphql-hive/gateway/commit/a2312e13ae88269457c61c2ef16d01f43207a0d2), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`37113d1`](https://github.com/graphql-hive/gateway/commit/37113d1a446748fd83da9823e27a0f56872317df), [`a7b277d`](https://github.com/graphql-hive/gateway/commit/a7b277d0f4784f7e9be125b3ec7de202ba86caad), [`8db36e9`](https://github.com/graphql-hive/gateway/commit/8db36e9e19e0885d498dd44575ebdf4e25d5bd34), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`cfa763a`](https://github.com/graphql-hive/gateway/commit/cfa763ac9d75310b916064168f8a2c14fc9853ef), [`0a2d8ab`](https://github.com/graphql-hive/gateway/commit/0a2d8abfa4d8e9dacba156055b1230de8d389551), [`4c667df`](https://github.com/graphql-hive/gateway/commit/4c667dfc22371fd0b78f56d7f022c26e386facc9), [`a2312e1`](https://github.com/graphql-hive/gateway/commit/a2312e13ae88269457c61c2ef16d01f43207a0d2), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`42de363`](https://github.com/graphql-hive/gateway/commit/42de3635744b881032b098eb42a1b8e7103bb09f), [`b22e33c`](https://github.com/graphql-hive/gateway/commit/b22e33c09d82f27889a1d49f05c94c814d858fcc), [`33a89bd`](https://github.com/graphql-hive/gateway/commit/33a89bd92774d4b1331e726f15816b942a2d0892), [`7766e3c`](https://github.com/graphql-hive/gateway/commit/7766e3c52272c5a58cc9a25b9d1a0e2886be11e1), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`8db36e9`](https://github.com/graphql-hive/gateway/commit/8db36e9e19e0885d498dd44575ebdf4e25d5bd34), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`37113d1`](https://github.com/graphql-hive/gateway/commit/37113d1a446748fd83da9823e27a0f56872317df), [`5aefad2`](https://github.com/graphql-hive/gateway/commit/5aefad2ac4abe40fd1cb141218bd2679b3e0047d), [`e5eb881`](https://github.com/graphql-hive/gateway/commit/e5eb881e8a063accc55b750e613f4baefa21dda5), [`2cb44ee`](https://github.com/graphql-hive/gateway/commit/2cb44ee21ec00210a9e292b40f0e1964e03ec09f), [`7766e3c`](https://github.com/graphql-hive/gateway/commit/7766e3c52272c5a58cc9a25b9d1a0e2886be11e1), [`7019f12`](https://github.com/graphql-hive/gateway/commit/7019f12f0a571df4c9fd8908110c8b33436a3063), [`f25f27e`](https://github.com/graphql-hive/gateway/commit/f25f27e7c4fa9f38626c19d2f94e62d53dedc03e), [`e70fb84`](https://github.com/graphql-hive/gateway/commit/e70fb84f7acaa7756116f4c4f4dedf9a72c25b6b), [`7e79f17`](https://github.com/graphql-hive/gateway/commit/7e79f17973c5711ee1be87b80f653a5a293075a2), [`8e4e52f`](https://github.com/graphql-hive/gateway/commit/8e4e52f5204ae992704f4edc656c422271b341b7), [`7019f12`](https://github.com/graphql-hive/gateway/commit/7019f12f0a571df4c9fd8908110c8b33436a3063), [`e5eb881`](https://github.com/graphql-hive/gateway/commit/e5eb881e8a063accc55b750e613f4baefa21dda5), [`590b930`](https://github.com/graphql-hive/gateway/commit/590b93040edc6309728e4fda72168fc2d13681a9), [`33a89bd`](https://github.com/graphql-hive/gateway/commit/33a89bd92774d4b1331e726f15816b942a2d0892), [`7766e3c`](https://github.com/graphql-hive/gateway/commit/7766e3c52272c5a58cc9a25b9d1a0e2886be11e1), [`d031c51`](https://github.com/graphql-hive/gateway/commit/d031c51b8cdc244fbbc566fb7f32e48ad0f4283f)]:
103
- - @graphql-hive/gateway-runtime@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
104
- - @graphql-hive/plugin-deduplicate-request@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
105
- - @graphql-mesh/hmac-upstream-signature@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
106
- - @graphql-mesh/plugin-jwt-auth@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
107
- - @graphql-mesh/plugin-opentelemetry@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
108
- - @graphql-mesh/plugin-prometheus@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
109
- - @graphql-mesh/transport-http@1.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
110
- - @graphql-mesh/transport-http-callback@1.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
111
- - @graphql-mesh/transport-ws@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
112
- - @graphql-hive/plugin-aws-sigv4@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
113
- - @graphql-hive/importer@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
114
- - @graphql-hive/pubsub@2.0.0-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
115
- - @graphql-hive/logger@1.0.1-next-aa4250fc26a9b7866639b67c054b3e9c798d172e
103
+ - @graphql-hive/gateway-runtime@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
104
+ - @graphql-hive/plugin-deduplicate-request@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
105
+ - @graphql-mesh/hmac-upstream-signature@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
106
+ - @graphql-mesh/plugin-jwt-auth@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
107
+ - @graphql-mesh/plugin-opentelemetry@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
108
+ - @graphql-mesh/plugin-prometheus@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
109
+ - @graphql-mesh/transport-http@1.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
110
+ - @graphql-mesh/transport-http-callback@1.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
111
+ - @graphql-mesh/transport-ws@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
112
+ - @graphql-hive/plugin-aws-sigv4@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
113
+ - @graphql-hive/importer@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
114
+ - @graphql-hive/pubsub@2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
115
+ - @graphql-hive/logger@1.0.1-next-644c389eef9f770fab018ad7bfc5f099c0fbedda
116
116
 
117
117
  ## 1.16.3
118
118
 
package/dist/bin.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  require('dotenv/config');
4
4
  var module$1 = require('node:module');
5
5
  var logger = require('@graphql-hive/logger');
6
- var cli = require('./cli-DpnGN-Tx.cjs');
6
+ var cli = require('./cli-CPxULGJb.cjs');
7
7
  require('node:cluster');
8
8
  require('node:os');
9
9
  require('node:path');
package/dist/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import 'dotenv/config';
3
3
  import module from 'node:module';
4
4
  import { Logger } from '@graphql-hive/logger';
5
- import { e as enableModuleCachingIfPossible, h as handleNodeWarnings, r as run } from './cli-DUe5Q4KF.js';
5
+ import { e as enableModuleCachingIfPossible, h as handleNodeWarnings, r as run } from './cli-CP9iY6tm.js';
6
6
  import 'node:cluster';
7
7
  import 'node:os';
8
8
  import 'node:path';
@@ -46,6 +46,9 @@ function strToBool(str) {
46
46
  function isDebug() {
47
47
  return getEnvBool("DEBUG");
48
48
  }
49
+ function isNode() {
50
+ return typeof process !== "undefined" && process.versions && process.versions.node && typeof Bun === "undefined";
51
+ }
49
52
 
50
53
  const unit = Object.create(null);
51
54
  const m = 60000, h = m * 60, d = h * 24, y = d * 365.25;
@@ -577,6 +580,16 @@ async function handleOpenTelemetryConfig(ctx, cliOpts) {
577
580
  }).catch(() => null);
578
581
  openTelemetrySetup({
579
582
  traces: { processors },
583
+ resource: await detectResource().catch((err) => {
584
+ if (err && typeof err === "object" && "code" in err && err.code === "ERR_MODULE_NOT_FOUND") {
585
+ ctx.log.warn(
586
+ err,
587
+ `NodeJS modules necessary for environment detection is missing, please install it to auto-detect the environment`
588
+ );
589
+ return void 0;
590
+ }
591
+ throw err;
592
+ }),
580
593
  contextManager
581
594
  });
582
595
  log.info(logAttributes, `${integrationName} integration is enabled`);
@@ -585,6 +598,14 @@ async function handleOpenTelemetryConfig(ctx, cliOpts) {
585
598
  }
586
599
  return false;
587
600
  }
601
+ async function detectResource() {
602
+ if (isNode()) {
603
+ const { getResourceDetectors } = await import('./index-61dm03o3.js').then(function (n) { return n.i; });
604
+ const { detectResources } = await import('./index-Dw4Doxg2.js').then(function (n) { return n.e; });
605
+ return detectResources({ detectors: getResourceDetectors() });
606
+ }
607
+ return void 0;
608
+ }
588
609
 
589
610
  function handleReportingConfig(ctx, loadedConfig, cliOpts) {
590
611
  const confOpts = {
@@ -53,6 +53,9 @@ function strToBool(str) {
53
53
  function isDebug() {
54
54
  return getEnvBool("DEBUG");
55
55
  }
56
+ function isNode() {
57
+ return typeof process !== "undefined" && process.versions && process.versions.node && typeof Bun === "undefined";
58
+ }
56
59
 
57
60
  const unit = Object.create(null);
58
61
  const m = 60000, h = m * 60, d = h * 24, y = d * 365.25;
@@ -584,6 +587,16 @@ async function handleOpenTelemetryConfig(ctx, cliOpts) {
584
587
  }).catch(() => null);
585
588
  openTelemetrySetup({
586
589
  traces: { processors },
590
+ resource: await detectResource().catch((err) => {
591
+ if (err && typeof err === "object" && "code" in err && err.code === "ERR_MODULE_NOT_FOUND") {
592
+ ctx.log.warn(
593
+ err,
594
+ `NodeJS modules necessary for environment detection is missing, please install it to auto-detect the environment`
595
+ );
596
+ return void 0;
597
+ }
598
+ throw err;
599
+ }),
587
600
  contextManager
588
601
  });
589
602
  log.info(logAttributes, `${integrationName} integration is enabled`);
@@ -592,6 +605,14 @@ async function handleOpenTelemetryConfig(ctx, cliOpts) {
592
605
  }
593
606
  return false;
594
607
  }
608
+ async function detectResource() {
609
+ if (isNode()) {
610
+ const { getResourceDetectors } = await Promise.resolve().then(function () { return require('./index-DWaHa380.cjs'); }).then(function (n) { return n.index; });
611
+ const { detectResources } = await Promise.resolve().then(function () { return require('./index-B44NjpxU.cjs'); }).then(function (n) { return n.esm; });
612
+ return detectResources({ detectors: getResourceDetectors() });
613
+ }
614
+ return void 0;
615
+ }
595
616
 
596
617
  function handleReportingConfig(ctx, loadedConfig, cliOpts) {
597
618
  const confOpts = {
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ var child_process = require('child_process');
4
+ var util = require('util');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var child_process__namespace = /*#__PURE__*/_interopNamespace(child_process);
25
+ var util__namespace = /*#__PURE__*/_interopNamespace(util);
26
+
27
+ /*
28
+ * Copyright The OpenTelemetry Authors
29
+ *
30
+ * Licensed under the Apache License, Version 2.0 (the "License");
31
+ * you may not use this file except in compliance with the License.
32
+ * You may obtain a copy of the License at
33
+ *
34
+ * https://www.apache.org/licenses/LICENSE-2.0
35
+ *
36
+ * Unless required by applicable law or agreed to in writing, software
37
+ * distributed under the License is distributed on an "AS IS" BASIS,
38
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39
+ * See the License for the specific language governing permissions and
40
+ * limitations under the License.
41
+ */
42
+ const execAsync = util__namespace.promisify(child_process__namespace.exec);
43
+
44
+ exports.execAsync = execAsync;
@@ -0,0 +1,21 @@
1
+ import * as child_process from 'child_process';
2
+ import * as util from 'util';
3
+
4
+ /*
5
+ * Copyright The OpenTelemetry Authors
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * https://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ const execAsync = util.promisify(child_process.exec);
20
+
21
+ export { execAsync as e };
@@ -0,0 +1,40 @@
1
+ import { promises } from 'fs';
2
+ import { e as execAsync } from './execAsync-DmTy47v9.js';
3
+ import { diag } from '@opentelemetry/api';
4
+ import 'child_process';
5
+ import 'util';
6
+
7
+ /*
8
+ * Copyright The OpenTelemetry Authors
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * https://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ async function getMachineId() {
23
+ try {
24
+ const result = await promises.readFile('/etc/hostid', { encoding: 'utf8' });
25
+ return result.trim();
26
+ }
27
+ catch (e) {
28
+ diag.debug(`error reading machine id: ${e}`);
29
+ }
30
+ try {
31
+ const result = await execAsync('kenv -q smbios.system.uuid');
32
+ return result.stdout.trim();
33
+ }
34
+ catch (e) {
35
+ diag.debug(`error reading machine id: ${e}`);
36
+ }
37
+ return undefined;
38
+ }
39
+
40
+ export { getMachineId };
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var execAsync = require('./execAsync-CZu27rRM.cjs');
5
+ var require$$0 = require('@opentelemetry/api');
6
+ require('child_process');
7
+ require('util');
8
+
9
+ /*
10
+ * Copyright The OpenTelemetry Authors
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * https://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ async function getMachineId() {
25
+ try {
26
+ const result = await fs.promises.readFile('/etc/hostid', { encoding: 'utf8' });
27
+ return result.trim();
28
+ }
29
+ catch (e) {
30
+ require$$0.diag.debug(`error reading machine id: ${e}`);
31
+ }
32
+ try {
33
+ const result = await execAsync.execAsync('kenv -q smbios.system.uuid');
34
+ return result.stdout.trim();
35
+ }
36
+ catch (e) {
37
+ require$$0.diag.debug(`error reading machine id: ${e}`);
38
+ }
39
+ return undefined;
40
+ }
41
+
42
+ exports.getMachineId = getMachineId;
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var execAsync = require('./execAsync-CZu27rRM.cjs');
4
+ var require$$0 = require('@opentelemetry/api');
5
+ require('child_process');
6
+ require('util');
7
+
8
+ /*
9
+ * Copyright The OpenTelemetry Authors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * https://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+ async function getMachineId() {
24
+ try {
25
+ const result = await execAsync.execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"');
26
+ const idLine = result.stdout
27
+ .split('\n')
28
+ .find(line => line.includes('IOPlatformUUID'));
29
+ if (!idLine) {
30
+ return undefined;
31
+ }
32
+ const parts = idLine.split('" = "');
33
+ if (parts.length === 2) {
34
+ return parts[1].slice(0, -1);
35
+ }
36
+ }
37
+ catch (e) {
38
+ require$$0.diag.debug(`error reading machine id: ${e}`);
39
+ }
40
+ return undefined;
41
+ }
42
+
43
+ exports.getMachineId = getMachineId;
@@ -0,0 +1,41 @@
1
+ import { e as execAsync } from './execAsync-DmTy47v9.js';
2
+ import { diag } from '@opentelemetry/api';
3
+ import 'child_process';
4
+ import 'util';
5
+
6
+ /*
7
+ * Copyright The OpenTelemetry Authors
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * https://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ async function getMachineId() {
22
+ try {
23
+ const result = await execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"');
24
+ const idLine = result.stdout
25
+ .split('\n')
26
+ .find(line => line.includes('IOPlatformUUID'));
27
+ if (!idLine) {
28
+ return undefined;
29
+ }
30
+ const parts = idLine.split('" = "');
31
+ if (parts.length === 2) {
32
+ return parts[1].slice(0, -1);
33
+ }
34
+ }
35
+ catch (e) {
36
+ diag.debug(`error reading machine id: ${e}`);
37
+ }
38
+ return undefined;
39
+ }
40
+
41
+ export { getMachineId };
@@ -0,0 +1,33 @@
1
+ import { promises } from 'fs';
2
+ import { diag } from '@opentelemetry/api';
3
+
4
+ /*
5
+ * Copyright The OpenTelemetry Authors
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * https://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ async function getMachineId() {
20
+ const paths = ['/etc/machine-id', '/var/lib/dbus/machine-id'];
21
+ for (const path of paths) {
22
+ try {
23
+ const result = await promises.readFile(path, { encoding: 'utf8' });
24
+ return result.trim();
25
+ }
26
+ catch (e) {
27
+ diag.debug(`error reading machine id: ${e}`);
28
+ }
29
+ }
30
+ return undefined;
31
+ }
32
+
33
+ export { getMachineId };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var require$$0 = require('@opentelemetry/api');
5
+
6
+ /*
7
+ * Copyright The OpenTelemetry Authors
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * https://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ async function getMachineId() {
22
+ const paths = ['/etc/machine-id', '/var/lib/dbus/machine-id'];
23
+ for (const path of paths) {
24
+ try {
25
+ const result = await fs.promises.readFile(path, { encoding: 'utf8' });
26
+ return result.trim();
27
+ }
28
+ catch (e) {
29
+ require$$0.diag.debug(`error reading machine id: ${e}`);
30
+ }
31
+ }
32
+ return undefined;
33
+ }
34
+
35
+ exports.getMachineId = getMachineId;
@@ -0,0 +1,23 @@
1
+ import { diag } from '@opentelemetry/api';
2
+
3
+ /*
4
+ * Copyright The OpenTelemetry Authors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * https://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ async function getMachineId() {
19
+ diag.debug('could not read machine-id: unsupported platform');
20
+ return undefined;
21
+ }
22
+
23
+ export { getMachineId };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var require$$0 = require('@opentelemetry/api');
4
+
5
+ /*
6
+ * Copyright The OpenTelemetry Authors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * https://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ async function getMachineId() {
21
+ require$$0.diag.debug('could not read machine-id: unsupported platform');
22
+ return undefined;
23
+ }
24
+
25
+ exports.getMachineId = getMachineId;
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ var process = require('process');
4
+ var execAsync = require('./execAsync-CZu27rRM.cjs');
5
+ var require$$0 = require('@opentelemetry/api');
6
+ require('child_process');
7
+ require('util');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var process__namespace = /*#__PURE__*/_interopNamespace(process);
28
+
29
+ /*
30
+ * Copyright The OpenTelemetry Authors
31
+ *
32
+ * Licensed under the Apache License, Version 2.0 (the "License");
33
+ * you may not use this file except in compliance with the License.
34
+ * You may obtain a copy of the License at
35
+ *
36
+ * https://www.apache.org/licenses/LICENSE-2.0
37
+ *
38
+ * Unless required by applicable law or agreed to in writing, software
39
+ * distributed under the License is distributed on an "AS IS" BASIS,
40
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41
+ * See the License for the specific language governing permissions and
42
+ * limitations under the License.
43
+ */
44
+ async function getMachineId() {
45
+ const args = 'QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid';
46
+ let command = '%windir%\\System32\\REG.exe';
47
+ if (process__namespace.arch === 'ia32' && 'PROCESSOR_ARCHITEW6432' in process__namespace.env) {
48
+ command = '%windir%\\sysnative\\cmd.exe /c ' + command;
49
+ }
50
+ try {
51
+ const result = await execAsync.execAsync(`${command} ${args}`);
52
+ const parts = result.stdout.split('REG_SZ');
53
+ if (parts.length === 2) {
54
+ return parts[1].trim();
55
+ }
56
+ }
57
+ catch (e) {
58
+ require$$0.diag.debug(`error reading machine id: ${e}`);
59
+ }
60
+ return undefined;
61
+ }
62
+
63
+ exports.getMachineId = getMachineId;
@@ -0,0 +1,41 @@
1
+ import * as process from 'process';
2
+ import { e as execAsync } from './execAsync-DmTy47v9.js';
3
+ import { diag } from '@opentelemetry/api';
4
+ import 'child_process';
5
+ import 'util';
6
+
7
+ /*
8
+ * Copyright The OpenTelemetry Authors
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * https://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ async function getMachineId() {
23
+ const args = 'QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid';
24
+ let command = '%windir%\\System32\\REG.exe';
25
+ if (process.arch === 'ia32' && 'PROCESSOR_ARCHITEW6432' in process.env) {
26
+ command = '%windir%\\sysnative\\cmd.exe /c ' + command;
27
+ }
28
+ try {
29
+ const result = await execAsync(`${command} ${args}`);
30
+ const parts = result.stdout.split('REG_SZ');
31
+ if (parts.length === 2) {
32
+ return parts[1].trim();
33
+ }
34
+ }
35
+ catch (e) {
36
+ diag.debug(`error reading machine id: ${e}`);
37
+ }
38
+ return undefined;
39
+ }
40
+
41
+ export { getMachineId };