@graphql-hive/gateway 2.0.0-alpha-d8f081c75cc018ba3320dc0152e13cd6ea9cce5b → 2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
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 +25 -28
- package/dist/bin.cjs +1 -2
- package/dist/bin.js +1 -2
- package/dist/{cli-NUmC8UiD.js → cli-CEBNmXIe.js} +18 -134
- package/dist/{cli-Dry_zVMS.cjs → cli-w6SSRswf.cjs} +18 -134
- package/dist/index.cjs +1 -2
- package/dist/index.d.cts +1 -11
- package/dist/index.d.ts +1 -11
- package/dist/index.js +1 -2
- package/package.json +15 -17
package/CHANGELOG.md
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
# @graphql-hive/gateway
|
2
2
|
|
3
|
-
## 2.0.0-alpha-
|
3
|
+
## 2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
4
4
|
|
5
5
|
### Major Changes
|
6
6
|
|
7
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
7
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`50d54e9`](https://github.com/graphql-hive/gateway/commit/50d54e960bc927c5d336772f5ed2d5a8b6703a30) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Drop Node 18 support
|
8
8
|
|
9
9
|
Least supported Node version is now v20.
|
10
10
|
|
11
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
11
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`9fd9cce`](https://github.com/graphql-hive/gateway/commit/9fd9ccea5c89c42a08a2ba472f5b2ff53985e855) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Introduce and use the new Hive Logger
|
12
12
|
|
13
13
|
- [Read more about it on the Hive Logger documentation here.](https://the-guild.dev/graphql/hive/docs/logger)
|
14
14
|
- If coming from Hive Gateway v1, [read the migration guide here.](https://the-guild.dev/graphql/hive/docs/migration-guides/gateway-v1-v2)
|
15
15
|
|
16
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
16
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`f6f5ec7`](https://github.com/graphql-hive/gateway/commit/f6f5ec7f1765fb46d28debb276190d639fecb24b) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Disable forking even if NODE_ENV=production
|
17
17
|
|
18
18
|
Forking workers for concurrent processing is a delicate process and if not done carefully can lead to performance degradations. It should be configured with careful consideration by advanced users.
|
19
19
|
|
20
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
20
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`924a609`](https://github.com/graphql-hive/gateway/commit/924a609069be0b18310985d846341e07f950ca1b) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Remove mocking plugin from Hive Gateway built-ins
|
21
21
|
|
22
22
|
There is no need to provide the `useMock` plugin alongside Hive Gateway built-ins. Not only is the mock plugin 2MB in size (minified), but installing and using it is very simple.
|
23
23
|
|
24
24
|
### Patch Changes
|
25
25
|
|
26
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
26
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`9fd9cce`](https://github.com/graphql-hive/gateway/commit/9fd9ccea5c89c42a08a2ba472f5b2ff53985e855) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
27
27
|
|
28
28
|
- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
|
29
29
|
|
30
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
30
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`e5af84b`](https://github.com/graphql-hive/gateway/commit/e5af84ba89721755816dc847062944854e6afce3) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
31
31
|
|
32
32
|
- Added dependency [`@opentelemetry/api@^1.9.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api/v/1.9.0) (to `dependencies`)
|
33
33
|
- Added dependency [`@opentelemetry/context-zone@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/context-zone/v/2.0.1) (to `dependencies`)
|
@@ -39,20 +39,16 @@
|
|
39
39
|
- Added dependency [`@opentelemetry/sampler-jaeger-remote@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/sampler-jaeger-remote/v/0.202.0) (to `dependencies`)
|
40
40
|
- Added dependency [`@opentelemetry/sdk-metrics@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-metrics/v/2.0.1) (to `dependencies`)
|
41
41
|
|
42
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
42
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`69cf600`](https://github.com/graphql-hive/gateway/commit/69cf60080a5dc862c0c1e6e66078523fb2c91ea8) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
43
43
|
|
44
44
|
- Added dependency [`@opentelemetry/api-logs@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api-logs/v/0.202.0) (to `dependencies`)
|
45
45
|
- Added dependency [`@opentelemetry/sdk-logs@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-logs/v/0.202.0) (to `dependencies`)
|
46
46
|
|
47
|
-
- [#
|
48
|
-
|
49
|
-
- Added dependency [`@opentelemetry/context-async-hooks@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/context-async-hooks/v/2.0.1) (to `dependencies`)
|
50
|
-
- Added dependency [`@opentelemetry/sdk-trace-base@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-trace-base/v/2.0.1) (to `dependencies`)
|
51
|
-
|
52
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`349e666`](https://github.com/graphql-hive/gateway/commit/349e666866543ef00eed198fb7a7801c75f92642) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
47
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`e65ee01`](https://github.com/graphql-hive/gateway/commit/e65ee01f953d26f809d21ac2137ba7c521f03b31) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
53
48
|
|
54
49
|
- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
|
55
50
|
- Added dependency [`@opentelemetry/api@^1.9.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api/v/1.9.0) (to `dependencies`)
|
51
|
+
- Added dependency [`@opentelemetry/api-logs@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api-logs/v/0.202.0) (to `dependencies`)
|
56
52
|
- Added dependency [`@opentelemetry/context-zone@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/context-zone/v/2.0.1) (to `dependencies`)
|
57
53
|
- Added dependency [`@opentelemetry/core@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/core/v/2.0.1) (to `dependencies`)
|
58
54
|
- Added dependency [`@opentelemetry/exporter-jaeger@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/exporter-jaeger/v/2.0.1) (to `dependencies`)
|
@@ -60,23 +56,24 @@
|
|
60
56
|
- Added dependency [`@opentelemetry/propagator-b3@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/propagator-b3/v/2.0.1) (to `dependencies`)
|
61
57
|
- Added dependency [`@opentelemetry/propagator-jaeger@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/propagator-jaeger/v/2.0.1) (to `dependencies`)
|
62
58
|
- Added dependency [`@opentelemetry/sampler-jaeger-remote@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/sampler-jaeger-remote/v/0.202.0) (to `dependencies`)
|
59
|
+
- Added dependency [`@opentelemetry/sdk-logs@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-logs/v/0.202.0) (to `dependencies`)
|
63
60
|
- Added dependency [`@opentelemetry/sdk-metrics@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-metrics/v/2.0.1) (to `dependencies`)
|
64
61
|
- Removed dependency [`@graphql-mesh/plugin-mock@^0.105.6` ↗︎](https://www.npmjs.com/package/@graphql-mesh/plugin-mock/v/0.105.6) (from `dependencies`)
|
65
62
|
|
66
|
-
- Updated dependencies [[`
|
67
|
-
- @graphql-hive/gateway-runtime@2.0.0-alpha-
|
68
|
-
- @graphql-mesh/plugin-opentelemetry@2.0.0-alpha-
|
69
|
-
- @graphql-mesh/plugin-prometheus@2.0.0-alpha-
|
70
|
-
- @graphql-mesh/hmac-upstream-signature@2.0.0-alpha-
|
71
|
-
- @graphql-hive/plugin-deduplicate-request@2.0.0-alpha-
|
72
|
-
- @graphql-mesh/transport-http-callback@1.0.0-alpha-
|
73
|
-
- @graphql-hive/plugin-aws-sigv4@2.0.0-alpha-
|
74
|
-
- @graphql-mesh/plugin-jwt-auth@2.0.0-alpha-
|
75
|
-
- @graphql-mesh/transport-http@1.0.0-alpha-
|
76
|
-
- @graphql-mesh/transport-ws@2.0.0-alpha-
|
77
|
-
- @graphql-hive/importer@2.0.0-alpha-
|
78
|
-
- @graphql-hive/logger@1.0.0-alpha-
|
79
|
-
- @graphql-hive/pubsub@2.0.0-alpha-
|
63
|
+
- Updated dependencies [[`9fd9cce`](https://github.com/graphql-hive/gateway/commit/9fd9ccea5c89c42a08a2ba472f5b2ff53985e855), [`e65ee01`](https://github.com/graphql-hive/gateway/commit/e65ee01f953d26f809d21ac2137ba7c521f03b31), [`e5af84b`](https://github.com/graphql-hive/gateway/commit/e5af84ba89721755816dc847062944854e6afce3), [`69cf600`](https://github.com/graphql-hive/gateway/commit/69cf60080a5dc862c0c1e6e66078523fb2c91ea8), [`7aeaa99`](https://github.com/graphql-hive/gateway/commit/7aeaa99bbf0d43713d2d1000ef705661a26801cc), [`b68a0b1`](https://github.com/graphql-hive/gateway/commit/b68a0b1cdc38472bfc81bfaf534ebed2f0fb752e), [`969ef77`](https://github.com/graphql-hive/gateway/commit/969ef77447038697a98cc2753e0e8b717a8b1ded), [`9fd9cce`](https://github.com/graphql-hive/gateway/commit/9fd9ccea5c89c42a08a2ba472f5b2ff53985e855), [`e65ee01`](https://github.com/graphql-hive/gateway/commit/e65ee01f953d26f809d21ac2137ba7c521f03b31), [`50d54e9`](https://github.com/graphql-hive/gateway/commit/50d54e960bc927c5d336772f5ed2d5a8b6703a30), [`9fd9cce`](https://github.com/graphql-hive/gateway/commit/9fd9ccea5c89c42a08a2ba472f5b2ff53985e855), [`9bfaad0`](https://github.com/graphql-hive/gateway/commit/9bfaad08a0f6e8cc5f95726639b8988d41851047), [`c04a420`](https://github.com/graphql-hive/gateway/commit/c04a420ac43a3cfb47f895ab93c4bc1e3d180539), [`9b230f3`](https://github.com/graphql-hive/gateway/commit/9b230f35b47afbf3b253e4c21720e836c5a2a8d1), [`ed75803`](https://github.com/graphql-hive/gateway/commit/ed758037f8fe6c9d388d6bde14e223ac9d6e2269), [`b5990bd`](https://github.com/graphql-hive/gateway/commit/b5990bd1b97c3679918436f9176372af9264c8f4), [`4cb19b1`](https://github.com/graphql-hive/gateway/commit/4cb19b182f618fdee75ce5d8207d983be997858d), [`969ef77`](https://github.com/graphql-hive/gateway/commit/969ef77447038697a98cc2753e0e8b717a8b1ded), [`9fd9cce`](https://github.com/graphql-hive/gateway/commit/9fd9ccea5c89c42a08a2ba472f5b2ff53985e855), [`d4e116d`](https://github.com/graphql-hive/gateway/commit/d4e116def25573013f520c85417b947607f4767d)]:
|
64
|
+
- @graphql-hive/gateway-runtime@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
65
|
+
- @graphql-mesh/plugin-opentelemetry@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
66
|
+
- @graphql-mesh/plugin-prometheus@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
67
|
+
- @graphql-mesh/hmac-upstream-signature@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
68
|
+
- @graphql-hive/plugin-deduplicate-request@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
69
|
+
- @graphql-mesh/transport-http-callback@1.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
70
|
+
- @graphql-hive/plugin-aws-sigv4@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
71
|
+
- @graphql-mesh/plugin-jwt-auth@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
72
|
+
- @graphql-mesh/transport-http@1.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
73
|
+
- @graphql-mesh/transport-ws@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
74
|
+
- @graphql-hive/importer@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
75
|
+
- @graphql-hive/logger@1.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
76
|
+
- @graphql-hive/pubsub@2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d
|
80
77
|
|
81
78
|
## 1.15.4
|
82
79
|
|
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-
|
6
|
+
var cli = require('./cli-w6SSRswf.cjs');
|
7
7
|
require('node:cluster');
|
8
8
|
require('node:os');
|
9
9
|
require('node:path');
|
@@ -17,7 +17,6 @@ require('node:url');
|
|
17
17
|
require('node:fs');
|
18
18
|
require('node:http');
|
19
19
|
require('node:https');
|
20
|
-
require('@opentelemetry/sdk-trace-base');
|
21
20
|
require('@graphql-tools/utils');
|
22
21
|
require('@graphql-tools/code-file-loader');
|
23
22
|
require('@graphql-tools/graphql-file-loader');
|
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-
|
5
|
+
import { e as enableModuleCachingIfPossible, h as handleNodeWarnings, r as run } from './cli-CEBNmXIe.js';
|
6
6
|
import 'node:cluster';
|
7
7
|
import 'node:os';
|
8
8
|
import 'node:path';
|
@@ -16,7 +16,6 @@ import 'node:url';
|
|
16
16
|
import 'node:fs';
|
17
17
|
import 'node:http';
|
18
18
|
import 'node:https';
|
19
|
-
import '@opentelemetry/sdk-trace-base';
|
20
19
|
import '@graphql-tools/utils';
|
21
20
|
import '@graphql-tools/code-file-loader';
|
22
21
|
import '@graphql-tools/graphql-file-loader';
|
@@ -13,7 +13,6 @@ import { pathToFileURL } from 'node:url';
|
|
13
13
|
import { promises } from 'node:fs';
|
14
14
|
import { createServer as createServer$1 } from 'node:http';
|
15
15
|
import { createServer } from 'node:https';
|
16
|
-
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
17
16
|
import { isValidPath, asArray } from '@graphql-tools/utils';
|
18
17
|
import { CodeFileLoader } from '@graphql-tools/code-file-loader';
|
19
18
|
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
@@ -486,46 +485,11 @@ function handleFork(log, config) {
|
|
486
485
|
return false;
|
487
486
|
}
|
488
487
|
|
489
|
-
async function handleOpenTelemetryConfig(ctx, cliOpts) {
|
490
|
-
const accessToken = cliOpts.hiveTraceAccessToken;
|
491
|
-
const target = cliOpts.hiveTarget;
|
492
|
-
const openTelemetry = cliOpts.openTelemetry;
|
493
|
-
const exporterType = cliOpts.openTelemetryExporterType ?? "otlp-http";
|
494
|
-
if (typeof openTelemetry === "string" || accessToken) {
|
495
|
-
const { openTelemetrySetup, HiveTracingSpanProcessor } = await import('@graphql-mesh/plugin-opentelemetry/setup');
|
496
|
-
const processors = [];
|
497
|
-
if (openTelemetry) {
|
498
|
-
const { OTLPTraceExporter } = await import(`@opentelemetry/exporter-trace-${exporterType}`);
|
499
|
-
processors.push(
|
500
|
-
new BatchSpanProcessor(new OTLPTraceExporter({ url: openTelemetry }))
|
501
|
-
);
|
502
|
-
}
|
503
|
-
if (accessToken) {
|
504
|
-
if (!target) {
|
505
|
-
ctx.log.error(
|
506
|
-
'Hive tracing needs a target. Please provide it through "--hive-target <target>"'
|
507
|
-
);
|
508
|
-
process.exit(1);
|
509
|
-
}
|
510
|
-
processors.push(
|
511
|
-
new HiveTracingSpanProcessor({
|
512
|
-
accessToken,
|
513
|
-
target
|
514
|
-
})
|
515
|
-
);
|
516
|
-
}
|
517
|
-
openTelemetrySetup({
|
518
|
-
traces: { processors },
|
519
|
-
contextManager: await import('@opentelemetry/context-async-hooks').then((module) => new module.AsyncLocalStorageContextManager()).catch(() => null)
|
520
|
-
});
|
521
|
-
}
|
522
|
-
}
|
523
|
-
|
524
488
|
function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
525
489
|
const confOpts = {
|
526
490
|
...loadedConfig.reporting?.type === "hive" ? {
|
527
491
|
hiveRegistryToken: loadedConfig.reporting.token,
|
528
|
-
|
492
|
+
hiveUsageTarget: loadedConfig.reporting.target,
|
529
493
|
hiveUsageAccessToken: loadedConfig.reporting.token
|
530
494
|
} : {},
|
531
495
|
...loadedConfig.reporting?.type === "graphos" ? {
|
@@ -533,42 +497,32 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
533
497
|
apolloKey: loadedConfig.reporting.apiKey
|
534
498
|
} : {}
|
535
499
|
};
|
536
|
-
const opts = {
|
537
|
-
...confOpts,
|
538
|
-
...cliOpts,
|
539
|
-
hiveTarget: cliOpts.hiveTarget ?? cliOpts.hiveUsageTarget ?? confOpts.hiveTarget
|
540
|
-
};
|
500
|
+
const opts = { ...confOpts, ...cliOpts };
|
541
501
|
if (cliOpts.hiveRegistryToken && cliOpts.hiveUsageAccessToken) {
|
542
502
|
ctx.log.error(
|
543
503
|
'Cannot use "--hive-registry-token" with "--hive-usage-access-token". Please use "--hive-usage-target" and "--hive-usage-access-token" or the config instead.'
|
544
504
|
);
|
545
505
|
process.exit(1);
|
546
506
|
}
|
547
|
-
if (cliOpts.
|
548
|
-
ctx.log.error(
|
549
|
-
'Cannot use "--hive-usage-target" with "--hive-target". Please only use "--hive-target"'
|
550
|
-
);
|
551
|
-
process.exit(1);
|
552
|
-
}
|
553
|
-
if (cliOpts.hiveRegistryToken && opts.hiveTarget) {
|
507
|
+
if (cliOpts.hiveRegistryToken && opts.hiveUsageTarget) {
|
554
508
|
ctx.log.error(
|
555
509
|
'Cannot use "--hive-registry-token" with a target. Please use "--hive-usage-target" and "--hive-usage-access-token" or the config instead.'
|
556
510
|
);
|
557
511
|
process.exit(1);
|
558
512
|
}
|
559
|
-
if (opts.
|
513
|
+
if (opts.hiveUsageTarget && !opts.hiveUsageAccessToken) {
|
560
514
|
ctx.log.error(
|
561
|
-
'Hive usage target needs an access token. Please provide it through
|
515
|
+
'Hive usage target needs an access token. Please provide it through the "--hive-usage-access-token <token>" option or the config.'
|
562
516
|
);
|
563
517
|
process.exit(1);
|
564
518
|
}
|
565
|
-
if (
|
519
|
+
if (opts.hiveUsageAccessToken && !opts.hiveUsageTarget) {
|
566
520
|
ctx.log.error(
|
567
|
-
'Hive access token needs a target. Please provide it through the "--hive-target <target>" option or the config.'
|
521
|
+
'Hive usage access token needs a target. Please provide it through the "--hive-usage-target <target>" option or the config.'
|
568
522
|
);
|
569
523
|
process.exit(1);
|
570
524
|
}
|
571
|
-
const hiveUsageAccessToken = opts.
|
525
|
+
const hiveUsageAccessToken = opts.hiveUsageAccessToken || opts.hiveRegistryToken;
|
572
526
|
if (hiveUsageAccessToken) {
|
573
527
|
if (opts.hiveUsageTarget) {
|
574
528
|
ctx.log.info("Configuring Hive usage reporting");
|
@@ -579,7 +533,7 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
579
533
|
...loadedConfig.reporting,
|
580
534
|
type: "hive",
|
581
535
|
token: hiveUsageAccessToken,
|
582
|
-
target: opts.
|
536
|
+
target: opts.hiveUsageTarget
|
583
537
|
};
|
584
538
|
}
|
585
539
|
if (opts.apolloKey) {
|
@@ -607,28 +561,17 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
607
561
|
"path to the GraphQL schema file or a url from where to pull the schema"
|
608
562
|
).action(async function proxy(endpoint) {
|
609
563
|
const {
|
610
|
-
opentelemetry,
|
611
|
-
opentelemetryExporterType,
|
612
564
|
hiveCdnEndpoint,
|
613
565
|
hiveCdnKey,
|
614
566
|
hiveRegistryToken,
|
615
|
-
hiveTarget,
|
616
567
|
hiveUsageTarget,
|
617
|
-
hiveAccessToken,
|
618
568
|
hiveUsageAccessToken,
|
619
|
-
hiveTraceAccessToken,
|
620
569
|
maskedErrors,
|
621
570
|
hivePersistedDocumentsEndpoint,
|
622
571
|
hivePersistedDocumentsToken,
|
623
572
|
...opts
|
624
573
|
} = this.optsWithGlobals();
|
625
574
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} in proxy mode`);
|
626
|
-
await handleOpenTelemetryConfig(ctx, {
|
627
|
-
openTelemetry: opentelemetry,
|
628
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
629
|
-
hiveTarget,
|
630
|
-
hiveTraceAccessToken
|
631
|
-
});
|
632
575
|
const loadedConfig = await loadConfig({
|
633
576
|
log: ctx.log,
|
634
577
|
configPath: opts.configPath,
|
@@ -682,11 +625,8 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
682
625
|
const registryConfig = {};
|
683
626
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
684
627
|
hiveRegistryToken,
|
685
|
-
hiveTarget,
|
686
628
|
hiveUsageTarget,
|
687
|
-
hiveAccessToken,
|
688
629
|
hiveUsageAccessToken,
|
689
|
-
hiveTraceAccessToken,
|
690
630
|
// proxy can only do reporting to hive registry
|
691
631
|
apolloGraphRef: void 0,
|
692
632
|
apolloKey: void 0
|
@@ -707,8 +647,7 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
707
647
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
708
648
|
{
|
709
649
|
...loadedConfig,
|
710
|
-
...opts
|
711
|
-
openTelemetry: opentelemetry ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
650
|
+
...opts
|
712
651
|
},
|
713
652
|
{
|
714
653
|
log: ctx.log,
|
@@ -781,26 +720,15 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
781
720
|
'path to the subgraph schema file or a url from where to pull the subgraph schema (default: "subgraph.graphql")'
|
782
721
|
).action(async function subgraph(schemaPathOrUrl) {
|
783
722
|
const {
|
784
|
-
opentelemetry,
|
785
|
-
opentelemetryExporterType,
|
786
723
|
maskedErrors,
|
787
724
|
hiveRegistryToken,
|
788
|
-
hiveTarget,
|
789
725
|
hiveUsageTarget,
|
790
|
-
hiveAccessToken,
|
791
726
|
hiveUsageAccessToken,
|
792
|
-
hiveTraceAccessToken,
|
793
727
|
hivePersistedDocumentsEndpoint,
|
794
728
|
hivePersistedDocumentsToken,
|
795
729
|
...opts
|
796
730
|
} = this.optsWithGlobals();
|
797
731
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} as subgraph`);
|
798
|
-
await handleOpenTelemetryConfig(ctx, {
|
799
|
-
openTelemetry: opentelemetry,
|
800
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
801
|
-
hiveTarget,
|
802
|
-
hiveTraceAccessToken
|
803
|
-
});
|
804
732
|
const loadedConfig = await loadConfig({
|
805
733
|
log: ctx.log,
|
806
734
|
configPath: opts.configPath,
|
@@ -816,11 +744,8 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
816
744
|
const registryConfig = {};
|
817
745
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
818
746
|
hiveRegistryToken,
|
819
|
-
hiveTarget,
|
820
747
|
hiveUsageTarget,
|
821
|
-
hiveAccessToken,
|
822
748
|
hiveUsageAccessToken,
|
823
|
-
hiveTraceAccessToken,
|
824
749
|
// subgraph can only do reporting to hive registry
|
825
750
|
apolloGraphRef: void 0,
|
826
751
|
apolloKey: void 0
|
@@ -841,8 +766,7 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
841
766
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
842
767
|
{
|
843
768
|
...loadedConfig,
|
844
|
-
...opts
|
845
|
-
openTelemetry: opentelemetry ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
769
|
+
...opts
|
846
770
|
},
|
847
771
|
{
|
848
772
|
log: ctx.log,
|
@@ -935,16 +859,11 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
935
859
|
).env("APOLLO_SCHEMA_CONFIG_DELIVERY_ENDPOINT")
|
936
860
|
).action(async function supergraph(schemaPathOrUrl) {
|
937
861
|
const {
|
938
|
-
opentelemetry,
|
939
|
-
opentelemetryExporterType,
|
940
862
|
hiveCdnEndpoint,
|
941
863
|
hiveCdnKey,
|
942
864
|
hiveRegistryToken,
|
943
865
|
hiveUsageTarget,
|
944
|
-
hiveTarget,
|
945
|
-
hiveAccessToken,
|
946
866
|
hiveUsageAccessToken,
|
947
|
-
hiveTraceAccessToken,
|
948
867
|
maskedErrors,
|
949
868
|
apolloGraphRef,
|
950
869
|
apolloKey,
|
@@ -956,12 +875,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
956
875
|
ctx.log.info(
|
957
876
|
`Starting ${ctx.productName} ${ctx.version} with supergraph`
|
958
877
|
);
|
959
|
-
await handleOpenTelemetryConfig(ctx, {
|
960
|
-
openTelemetry: opentelemetry,
|
961
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
962
|
-
hiveTarget,
|
963
|
-
hiveTraceAccessToken
|
964
|
-
});
|
965
878
|
const loadedConfig = await loadConfig({
|
966
879
|
log: ctx.log,
|
967
880
|
configPath: opts.configPath,
|
@@ -1047,9 +960,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1047
960
|
}
|
1048
961
|
const registryConfig = {};
|
1049
962
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
1050
|
-
hiveTarget,
|
1051
|
-
hiveAccessToken,
|
1052
|
-
hiveTraceAccessToken,
|
1053
963
|
hiveRegistryToken,
|
1054
964
|
hiveUsageTarget,
|
1055
965
|
hiveUsageAccessToken,
|
@@ -1072,8 +982,7 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1072
982
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
1073
983
|
{
|
1074
984
|
...loadedConfig,
|
1075
|
-
...opts
|
1076
|
-
openTelemetry: opentelemetry ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
985
|
+
...opts
|
1077
986
|
},
|
1078
987
|
{
|
1079
988
|
log: ctx.log,
|
@@ -1323,52 +1232,27 @@ let cli = new Command().configureHelp({
|
|
1323
1232
|
// see here https://github.com/tj/commander.js/blob/970ecae402b253de691e6a9066fea22f38fe7431/lib/command.js#L655
|
1324
1233
|
// @ts-expect-error
|
1325
1234
|
null
|
1326
|
-
).addOption(
|
1327
|
-
new Option(
|
1328
|
-
"--opentelemetry [exporter-endpoint]",
|
1329
|
-
`Enable OpenTelemetry integration with an exporter using this option's value as endpoint. By default, it uses OTLP HTTP, use "--opentelemetry-exporter-type" to change the default.`
|
1330
|
-
).env("OPENTELEMETRY")
|
1331
|
-
).addOption(
|
1332
|
-
new Option(
|
1333
|
-
"--opentelemetry-exporter-type <type>",
|
1334
|
-
`OpenTelemetry exporter type to use when setting up OpenTelemetry integration. Requires "--opentelemetry" to set the endpoint.`
|
1335
|
-
).choices(["otlp-http", "otlp-grpc"]).default("otlp-http").env("OPENTELEMETRY_EXPORTER_TYPE")
|
1336
1235
|
).addOption(
|
1337
1236
|
new Option(
|
1338
1237
|
"--hive-registry-token <token>",
|
1339
|
-
'[DEPRECATED: please use "--hive-target" and "--hive-access-token"] Hive registry token for usage metrics reporting'
|
1238
|
+
'[DEPRECATED: please use "--hive-usage-target" and "--hive-usage-access-token"] Hive registry token for usage metrics reporting'
|
1340
1239
|
).env("HIVE_REGISTRY_TOKEN")
|
1341
1240
|
).addOption(
|
1342
1241
|
new Option(
|
1343
1242
|
"--hive-usage-target <target>",
|
1344
|
-
|
1243
|
+
'Hive registry target to which the usage data should be reported to. requires the "--hive-usage-access-token <token>" option'
|
1345
1244
|
).env("HIVE_USAGE_TARGET")
|
1346
|
-
).addOption(
|
1347
|
-
new Option(
|
1348
|
-
"--hive-target <target>",
|
1349
|
-
'Hive registry target to which the usage and tracing data should be reported to. Requires either "--hive-access-token <token>", "--hive-usage-access-token <token>" or "--hive-trace-access-token" option'
|
1350
|
-
).env("HIVE_TARGET")
|
1351
|
-
).addOption(
|
1352
|
-
new Option(
|
1353
|
-
"--hive-access-token <token>",
|
1354
|
-
'Hive registry access token for usage metrics reporting and tracing. Enables both usage reporting and tracing. Requires the "--hive-target <target>" option'
|
1355
|
-
).env("HIVE_ACCESS_TOKEN")
|
1356
1245
|
).addOption(
|
1357
1246
|
new Option(
|
1358
1247
|
"--hive-usage-access-token <token>",
|
1359
|
-
|
1248
|
+
'Hive registry access token for usage metrics reporting. requires the "--hive-usage-target <target>" option'
|
1360
1249
|
).env("HIVE_USAGE_ACCESS_TOKEN")
|
1361
|
-
).addOption(
|
1362
|
-
new Option(
|
1363
|
-
"--hive-trace-access-token <token>",
|
1364
|
-
`Hive registry access token for tracing. Enables Hive tracing. Requires the "--hive-target <target>" option. It can't be used together with "--hive-access-token"`
|
1365
|
-
).env("HIVE_TRACE_ACCESS_TOKEN")
|
1366
1250
|
).option(
|
1367
1251
|
"--hive-persisted-documents-endpoint <endpoint>",
|
1368
|
-
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents.
|
1252
|
+
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents. requires the "--hive-persisted-documents-token <token>" option'
|
1369
1253
|
).option(
|
1370
1254
|
"--hive-persisted-documents-token <token>",
|
1371
|
-
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token.
|
1255
|
+
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token. requires the "--hive-persisted-documents-endpoint <endpoint>" option'
|
1372
1256
|
).addOption(
|
1373
1257
|
new Option(
|
1374
1258
|
"--hive-cdn-endpoint <endpoint>",
|
@@ -1399,7 +1283,7 @@ async function run(userCtx) {
|
|
1399
1283
|
const ctx = {
|
1400
1284
|
log: userCtx.log || new Logger(),
|
1401
1285
|
productName: "Hive Gateway",
|
1402
|
-
productDescription: "
|
1286
|
+
productDescription: "Unify and accelerate your data graph across diverse services with Hive Gateway, which seamlessly integrates with Apollo Federation.",
|
1403
1287
|
productPackageName: "@graphql-hive/gateway",
|
1404
1288
|
productLink: "https://the-guild.dev/graphql/hive/docs/gateway",
|
1405
1289
|
binName: "hive-gateway",
|
@@ -15,7 +15,6 @@ var node_url = require('node:url');
|
|
15
15
|
var node_fs = require('node:fs');
|
16
16
|
var node_http = require('node:http');
|
17
17
|
var node_https = require('node:https');
|
18
|
-
var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
19
18
|
var utils$1 = require('@graphql-tools/utils');
|
20
19
|
var codeFileLoader = require('@graphql-tools/code-file-loader');
|
21
20
|
var graphqlFileLoader = require('@graphql-tools/graphql-file-loader');
|
@@ -493,46 +492,11 @@ function handleFork(log, config) {
|
|
493
492
|
return false;
|
494
493
|
}
|
495
494
|
|
496
|
-
async function handleOpenTelemetryConfig(ctx, cliOpts) {
|
497
|
-
const accessToken = cliOpts.hiveTraceAccessToken;
|
498
|
-
const target = cliOpts.hiveTarget;
|
499
|
-
const openTelemetry = cliOpts.openTelemetry;
|
500
|
-
const exporterType = cliOpts.openTelemetryExporterType ?? "otlp-http";
|
501
|
-
if (typeof openTelemetry === "string" || accessToken) {
|
502
|
-
const { openTelemetrySetup, HiveTracingSpanProcessor } = await import('@graphql-mesh/plugin-opentelemetry/setup');
|
503
|
-
const processors = [];
|
504
|
-
if (openTelemetry) {
|
505
|
-
const { OTLPTraceExporter } = await import(`@opentelemetry/exporter-trace-${exporterType}`);
|
506
|
-
processors.push(
|
507
|
-
new sdkTraceBase.BatchSpanProcessor(new OTLPTraceExporter({ url: openTelemetry }))
|
508
|
-
);
|
509
|
-
}
|
510
|
-
if (accessToken) {
|
511
|
-
if (!target) {
|
512
|
-
ctx.log.error(
|
513
|
-
'Hive tracing needs a target. Please provide it through "--hive-target <target>"'
|
514
|
-
);
|
515
|
-
process.exit(1);
|
516
|
-
}
|
517
|
-
processors.push(
|
518
|
-
new HiveTracingSpanProcessor({
|
519
|
-
accessToken,
|
520
|
-
target
|
521
|
-
})
|
522
|
-
);
|
523
|
-
}
|
524
|
-
openTelemetrySetup({
|
525
|
-
traces: { processors },
|
526
|
-
contextManager: await import('@opentelemetry/context-async-hooks').then((module) => new module.AsyncLocalStorageContextManager()).catch(() => null)
|
527
|
-
});
|
528
|
-
}
|
529
|
-
}
|
530
|
-
|
531
495
|
function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
532
496
|
const confOpts = {
|
533
497
|
...loadedConfig.reporting?.type === "hive" ? {
|
534
498
|
hiveRegistryToken: loadedConfig.reporting.token,
|
535
|
-
|
499
|
+
hiveUsageTarget: loadedConfig.reporting.target,
|
536
500
|
hiveUsageAccessToken: loadedConfig.reporting.token
|
537
501
|
} : {},
|
538
502
|
...loadedConfig.reporting?.type === "graphos" ? {
|
@@ -540,42 +504,32 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
540
504
|
apolloKey: loadedConfig.reporting.apiKey
|
541
505
|
} : {}
|
542
506
|
};
|
543
|
-
const opts = {
|
544
|
-
...confOpts,
|
545
|
-
...cliOpts,
|
546
|
-
hiveTarget: cliOpts.hiveTarget ?? cliOpts.hiveUsageTarget ?? confOpts.hiveTarget
|
547
|
-
};
|
507
|
+
const opts = { ...confOpts, ...cliOpts };
|
548
508
|
if (cliOpts.hiveRegistryToken && cliOpts.hiveUsageAccessToken) {
|
549
509
|
ctx.log.error(
|
550
510
|
'Cannot use "--hive-registry-token" with "--hive-usage-access-token". Please use "--hive-usage-target" and "--hive-usage-access-token" or the config instead.'
|
551
511
|
);
|
552
512
|
process.exit(1);
|
553
513
|
}
|
554
|
-
if (cliOpts.
|
555
|
-
ctx.log.error(
|
556
|
-
'Cannot use "--hive-usage-target" with "--hive-target". Please only use "--hive-target"'
|
557
|
-
);
|
558
|
-
process.exit(1);
|
559
|
-
}
|
560
|
-
if (cliOpts.hiveRegistryToken && opts.hiveTarget) {
|
514
|
+
if (cliOpts.hiveRegistryToken && opts.hiveUsageTarget) {
|
561
515
|
ctx.log.error(
|
562
516
|
'Cannot use "--hive-registry-token" with a target. Please use "--hive-usage-target" and "--hive-usage-access-token" or the config instead.'
|
563
517
|
);
|
564
518
|
process.exit(1);
|
565
519
|
}
|
566
|
-
if (opts.
|
520
|
+
if (opts.hiveUsageTarget && !opts.hiveUsageAccessToken) {
|
567
521
|
ctx.log.error(
|
568
|
-
'Hive usage target needs an access token. Please provide it through
|
522
|
+
'Hive usage target needs an access token. Please provide it through the "--hive-usage-access-token <token>" option or the config.'
|
569
523
|
);
|
570
524
|
process.exit(1);
|
571
525
|
}
|
572
|
-
if (
|
526
|
+
if (opts.hiveUsageAccessToken && !opts.hiveUsageTarget) {
|
573
527
|
ctx.log.error(
|
574
|
-
'Hive access token needs a target. Please provide it through the "--hive-target <target>" option or the config.'
|
528
|
+
'Hive usage access token needs a target. Please provide it through the "--hive-usage-target <target>" option or the config.'
|
575
529
|
);
|
576
530
|
process.exit(1);
|
577
531
|
}
|
578
|
-
const hiveUsageAccessToken = opts.
|
532
|
+
const hiveUsageAccessToken = opts.hiveUsageAccessToken || opts.hiveRegistryToken;
|
579
533
|
if (hiveUsageAccessToken) {
|
580
534
|
if (opts.hiveUsageTarget) {
|
581
535
|
ctx.log.info("Configuring Hive usage reporting");
|
@@ -586,7 +540,7 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
586
540
|
...loadedConfig.reporting,
|
587
541
|
type: "hive",
|
588
542
|
token: hiveUsageAccessToken,
|
589
|
-
target: opts.
|
543
|
+
target: opts.hiveUsageTarget
|
590
544
|
};
|
591
545
|
}
|
592
546
|
if (opts.apolloKey) {
|
@@ -614,28 +568,17 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
614
568
|
"path to the GraphQL schema file or a url from where to pull the schema"
|
615
569
|
).action(async function proxy(endpoint) {
|
616
570
|
const {
|
617
|
-
opentelemetry,
|
618
|
-
opentelemetryExporterType,
|
619
571
|
hiveCdnEndpoint,
|
620
572
|
hiveCdnKey,
|
621
573
|
hiveRegistryToken,
|
622
|
-
hiveTarget,
|
623
574
|
hiveUsageTarget,
|
624
|
-
hiveAccessToken,
|
625
575
|
hiveUsageAccessToken,
|
626
|
-
hiveTraceAccessToken,
|
627
576
|
maskedErrors,
|
628
577
|
hivePersistedDocumentsEndpoint,
|
629
578
|
hivePersistedDocumentsToken,
|
630
579
|
...opts
|
631
580
|
} = this.optsWithGlobals();
|
632
581
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} in proxy mode`);
|
633
|
-
await handleOpenTelemetryConfig(ctx, {
|
634
|
-
openTelemetry: opentelemetry,
|
635
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
636
|
-
hiveTarget,
|
637
|
-
hiveTraceAccessToken
|
638
|
-
});
|
639
582
|
const loadedConfig = await loadConfig({
|
640
583
|
log: ctx.log,
|
641
584
|
configPath: opts.configPath,
|
@@ -689,11 +632,8 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
689
632
|
const registryConfig = {};
|
690
633
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
691
634
|
hiveRegistryToken,
|
692
|
-
hiveTarget,
|
693
635
|
hiveUsageTarget,
|
694
|
-
hiveAccessToken,
|
695
636
|
hiveUsageAccessToken,
|
696
|
-
hiveTraceAccessToken,
|
697
637
|
// proxy can only do reporting to hive registry
|
698
638
|
apolloGraphRef: void 0,
|
699
639
|
apolloKey: void 0
|
@@ -714,8 +654,7 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
714
654
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
715
655
|
{
|
716
656
|
...loadedConfig,
|
717
|
-
...opts
|
718
|
-
openTelemetry: opentelemetry ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
657
|
+
...opts
|
719
658
|
},
|
720
659
|
{
|
721
660
|
log: ctx.log,
|
@@ -788,26 +727,15 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
788
727
|
'path to the subgraph schema file or a url from where to pull the subgraph schema (default: "subgraph.graphql")'
|
789
728
|
).action(async function subgraph(schemaPathOrUrl) {
|
790
729
|
const {
|
791
|
-
opentelemetry,
|
792
|
-
opentelemetryExporterType,
|
793
730
|
maskedErrors,
|
794
731
|
hiveRegistryToken,
|
795
|
-
hiveTarget,
|
796
732
|
hiveUsageTarget,
|
797
|
-
hiveAccessToken,
|
798
733
|
hiveUsageAccessToken,
|
799
|
-
hiveTraceAccessToken,
|
800
734
|
hivePersistedDocumentsEndpoint,
|
801
735
|
hivePersistedDocumentsToken,
|
802
736
|
...opts
|
803
737
|
} = this.optsWithGlobals();
|
804
738
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} as subgraph`);
|
805
|
-
await handleOpenTelemetryConfig(ctx, {
|
806
|
-
openTelemetry: opentelemetry,
|
807
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
808
|
-
hiveTarget,
|
809
|
-
hiveTraceAccessToken
|
810
|
-
});
|
811
739
|
const loadedConfig = await loadConfig({
|
812
740
|
log: ctx.log,
|
813
741
|
configPath: opts.configPath,
|
@@ -823,11 +751,8 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
823
751
|
const registryConfig = {};
|
824
752
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
825
753
|
hiveRegistryToken,
|
826
|
-
hiveTarget,
|
827
754
|
hiveUsageTarget,
|
828
|
-
hiveAccessToken,
|
829
755
|
hiveUsageAccessToken,
|
830
|
-
hiveTraceAccessToken,
|
831
756
|
// subgraph can only do reporting to hive registry
|
832
757
|
apolloGraphRef: void 0,
|
833
758
|
apolloKey: void 0
|
@@ -848,8 +773,7 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
848
773
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
849
774
|
{
|
850
775
|
...loadedConfig,
|
851
|
-
...opts
|
852
|
-
openTelemetry: opentelemetry ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
776
|
+
...opts
|
853
777
|
},
|
854
778
|
{
|
855
779
|
log: ctx.log,
|
@@ -942,16 +866,11 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
942
866
|
).env("APOLLO_SCHEMA_CONFIG_DELIVERY_ENDPOINT")
|
943
867
|
).action(async function supergraph(schemaPathOrUrl) {
|
944
868
|
const {
|
945
|
-
opentelemetry,
|
946
|
-
opentelemetryExporterType,
|
947
869
|
hiveCdnEndpoint,
|
948
870
|
hiveCdnKey,
|
949
871
|
hiveRegistryToken,
|
950
872
|
hiveUsageTarget,
|
951
|
-
hiveTarget,
|
952
|
-
hiveAccessToken,
|
953
873
|
hiveUsageAccessToken,
|
954
|
-
hiveTraceAccessToken,
|
955
874
|
maskedErrors,
|
956
875
|
apolloGraphRef,
|
957
876
|
apolloKey,
|
@@ -963,12 +882,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
963
882
|
ctx.log.info(
|
964
883
|
`Starting ${ctx.productName} ${ctx.version} with supergraph`
|
965
884
|
);
|
966
|
-
await handleOpenTelemetryConfig(ctx, {
|
967
|
-
openTelemetry: opentelemetry,
|
968
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
969
|
-
hiveTarget,
|
970
|
-
hiveTraceAccessToken
|
971
|
-
});
|
972
885
|
const loadedConfig = await loadConfig({
|
973
886
|
log: ctx.log,
|
974
887
|
configPath: opts.configPath,
|
@@ -1054,9 +967,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1054
967
|
}
|
1055
968
|
const registryConfig = {};
|
1056
969
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
1057
|
-
hiveTarget,
|
1058
|
-
hiveAccessToken,
|
1059
|
-
hiveTraceAccessToken,
|
1060
970
|
hiveRegistryToken,
|
1061
971
|
hiveUsageTarget,
|
1062
972
|
hiveUsageAccessToken,
|
@@ -1079,8 +989,7 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1079
989
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
1080
990
|
{
|
1081
991
|
...loadedConfig,
|
1082
|
-
...opts
|
1083
|
-
openTelemetry: opentelemetry ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
992
|
+
...opts
|
1084
993
|
},
|
1085
994
|
{
|
1086
995
|
log: ctx.log,
|
@@ -1330,52 +1239,27 @@ let cli = new extraTypings.Command().configureHelp({
|
|
1330
1239
|
// see here https://github.com/tj/commander.js/blob/970ecae402b253de691e6a9066fea22f38fe7431/lib/command.js#L655
|
1331
1240
|
// @ts-expect-error
|
1332
1241
|
null
|
1333
|
-
).addOption(
|
1334
|
-
new extraTypings.Option(
|
1335
|
-
"--opentelemetry [exporter-endpoint]",
|
1336
|
-
`Enable OpenTelemetry integration with an exporter using this option's value as endpoint. By default, it uses OTLP HTTP, use "--opentelemetry-exporter-type" to change the default.`
|
1337
|
-
).env("OPENTELEMETRY")
|
1338
|
-
).addOption(
|
1339
|
-
new extraTypings.Option(
|
1340
|
-
"--opentelemetry-exporter-type <type>",
|
1341
|
-
`OpenTelemetry exporter type to use when setting up OpenTelemetry integration. Requires "--opentelemetry" to set the endpoint.`
|
1342
|
-
).choices(["otlp-http", "otlp-grpc"]).default("otlp-http").env("OPENTELEMETRY_EXPORTER_TYPE")
|
1343
1242
|
).addOption(
|
1344
1243
|
new extraTypings.Option(
|
1345
1244
|
"--hive-registry-token <token>",
|
1346
|
-
'[DEPRECATED: please use "--hive-target" and "--hive-access-token"] Hive registry token for usage metrics reporting'
|
1245
|
+
'[DEPRECATED: please use "--hive-usage-target" and "--hive-usage-access-token"] Hive registry token for usage metrics reporting'
|
1347
1246
|
).env("HIVE_REGISTRY_TOKEN")
|
1348
1247
|
).addOption(
|
1349
1248
|
new extraTypings.Option(
|
1350
1249
|
"--hive-usage-target <target>",
|
1351
|
-
|
1250
|
+
'Hive registry target to which the usage data should be reported to. requires the "--hive-usage-access-token <token>" option'
|
1352
1251
|
).env("HIVE_USAGE_TARGET")
|
1353
|
-
).addOption(
|
1354
|
-
new extraTypings.Option(
|
1355
|
-
"--hive-target <target>",
|
1356
|
-
'Hive registry target to which the usage and tracing data should be reported to. Requires either "--hive-access-token <token>", "--hive-usage-access-token <token>" or "--hive-trace-access-token" option'
|
1357
|
-
).env("HIVE_TARGET")
|
1358
|
-
).addOption(
|
1359
|
-
new extraTypings.Option(
|
1360
|
-
"--hive-access-token <token>",
|
1361
|
-
'Hive registry access token for usage metrics reporting and tracing. Enables both usage reporting and tracing. Requires the "--hive-target <target>" option'
|
1362
|
-
).env("HIVE_ACCESS_TOKEN")
|
1363
1252
|
).addOption(
|
1364
1253
|
new extraTypings.Option(
|
1365
1254
|
"--hive-usage-access-token <token>",
|
1366
|
-
|
1255
|
+
'Hive registry access token for usage metrics reporting. requires the "--hive-usage-target <target>" option'
|
1367
1256
|
).env("HIVE_USAGE_ACCESS_TOKEN")
|
1368
|
-
).addOption(
|
1369
|
-
new extraTypings.Option(
|
1370
|
-
"--hive-trace-access-token <token>",
|
1371
|
-
`Hive registry access token for tracing. Enables Hive tracing. Requires the "--hive-target <target>" option. It can't be used together with "--hive-access-token"`
|
1372
|
-
).env("HIVE_TRACE_ACCESS_TOKEN")
|
1373
1257
|
).option(
|
1374
1258
|
"--hive-persisted-documents-endpoint <endpoint>",
|
1375
|
-
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents.
|
1259
|
+
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents. requires the "--hive-persisted-documents-token <token>" option'
|
1376
1260
|
).option(
|
1377
1261
|
"--hive-persisted-documents-token <token>",
|
1378
|
-
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token.
|
1262
|
+
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token. requires the "--hive-persisted-documents-endpoint <endpoint>" option'
|
1379
1263
|
).addOption(
|
1380
1264
|
new extraTypings.Option(
|
1381
1265
|
"--hive-cdn-endpoint <endpoint>",
|
@@ -1406,7 +1290,7 @@ async function run(userCtx) {
|
|
1406
1290
|
const ctx = {
|
1407
1291
|
log: userCtx.log || new logger.Logger(),
|
1408
1292
|
productName: "Hive Gateway",
|
1409
|
-
productDescription: "
|
1293
|
+
productDescription: "Unify and accelerate your data graph across diverse services with Hive Gateway, which seamlessly integrates with Apollo Federation.",
|
1410
1294
|
productPackageName: "@graphql-hive/gateway",
|
1411
1295
|
productLink: "https://the-guild.dev/graphql/hive/docs/gateway",
|
1412
1296
|
binName: "hive-gateway",
|
package/dist/index.cjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var cli = require('./cli-
|
3
|
+
var cli = require('./cli-w6SSRswf.cjs');
|
4
4
|
var logger = require('@graphql-hive/logger');
|
5
5
|
var gatewayRuntime = require('@graphql-hive/gateway-runtime');
|
6
6
|
var pubsub = require('@graphql-hive/pubsub');
|
@@ -30,7 +30,6 @@ require('node:url');
|
|
30
30
|
require('node:fs');
|
31
31
|
require('node:http');
|
32
32
|
require('node:https');
|
33
|
-
require('@opentelemetry/sdk-trace-base');
|
34
33
|
require('@graphql-tools/utils');
|
35
34
|
require('@graphql-tools/code-file-loader');
|
36
35
|
require('@graphql-tools/graphql-file-loader');
|
package/dist/index.d.cts
CHANGED
@@ -228,7 +228,7 @@ interface CLIContext {
|
|
228
228
|
log: Logger;
|
229
229
|
/** @default 'Hive Gateway' */
|
230
230
|
productName: string;
|
231
|
-
/** @default '
|
231
|
+
/** @default 'Unify and accelerate your data graph across diverse services with Hive Gateway, which seamlessly integrates with Apollo Federation.' */
|
232
232
|
productDescription: string;
|
233
233
|
/** @default '@graphql-hive/gateway' */
|
234
234
|
productPackageName: string;
|
@@ -268,14 +268,9 @@ declare let cli: Command<[], {
|
|
268
268
|
port?: number | undefined;
|
269
269
|
polling?: number | undefined;
|
270
270
|
maskedErrors: string | boolean | string[] | [];
|
271
|
-
opentelemetry?: string | true | undefined;
|
272
|
-
opentelemetryExporterType: "otlp-http" | "otlp-grpc";
|
273
271
|
hiveRegistryToken?: string | undefined;
|
274
272
|
hiveUsageTarget?: string | undefined;
|
275
|
-
hiveTarget?: string | undefined;
|
276
|
-
hiveAccessToken?: string | undefined;
|
277
273
|
hiveUsageAccessToken?: string | undefined;
|
278
|
-
hiveTraceAccessToken?: string | undefined;
|
279
274
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
280
275
|
hivePersistedDocumentsToken?: string | undefined;
|
281
276
|
hiveCdnEndpoint?: string | undefined;
|
@@ -292,14 +287,9 @@ declare function run(userCtx: Partial<CLIContext>): Promise<Command<[], {
|
|
292
287
|
port?: number | undefined;
|
293
288
|
polling?: number | undefined;
|
294
289
|
maskedErrors: string | boolean | string[] | [];
|
295
|
-
opentelemetry?: string | true | undefined;
|
296
|
-
opentelemetryExporterType: "otlp-http" | "otlp-grpc";
|
297
290
|
hiveRegistryToken?: string | undefined;
|
298
291
|
hiveUsageTarget?: string | undefined;
|
299
|
-
hiveTarget?: string | undefined;
|
300
|
-
hiveAccessToken?: string | undefined;
|
301
292
|
hiveUsageAccessToken?: string | undefined;
|
302
|
-
hiveTraceAccessToken?: string | undefined;
|
303
293
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
304
294
|
hivePersistedDocumentsToken?: string | undefined;
|
305
295
|
hiveCdnEndpoint?: string | undefined;
|
package/dist/index.d.ts
CHANGED
@@ -228,7 +228,7 @@ interface CLIContext {
|
|
228
228
|
log: Logger;
|
229
229
|
/** @default 'Hive Gateway' */
|
230
230
|
productName: string;
|
231
|
-
/** @default '
|
231
|
+
/** @default 'Unify and accelerate your data graph across diverse services with Hive Gateway, which seamlessly integrates with Apollo Federation.' */
|
232
232
|
productDescription: string;
|
233
233
|
/** @default '@graphql-hive/gateway' */
|
234
234
|
productPackageName: string;
|
@@ -268,14 +268,9 @@ declare let cli: Command<[], {
|
|
268
268
|
port?: number | undefined;
|
269
269
|
polling?: number | undefined;
|
270
270
|
maskedErrors: string | boolean | string[] | [];
|
271
|
-
opentelemetry?: string | true | undefined;
|
272
|
-
opentelemetryExporterType: "otlp-http" | "otlp-grpc";
|
273
271
|
hiveRegistryToken?: string | undefined;
|
274
272
|
hiveUsageTarget?: string | undefined;
|
275
|
-
hiveTarget?: string | undefined;
|
276
|
-
hiveAccessToken?: string | undefined;
|
277
273
|
hiveUsageAccessToken?: string | undefined;
|
278
|
-
hiveTraceAccessToken?: string | undefined;
|
279
274
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
280
275
|
hivePersistedDocumentsToken?: string | undefined;
|
281
276
|
hiveCdnEndpoint?: string | undefined;
|
@@ -292,14 +287,9 @@ declare function run(userCtx: Partial<CLIContext>): Promise<Command<[], {
|
|
292
287
|
port?: number | undefined;
|
293
288
|
polling?: number | undefined;
|
294
289
|
maskedErrors: string | boolean | string[] | [];
|
295
|
-
opentelemetry?: string | true | undefined;
|
296
|
-
opentelemetryExporterType: "otlp-http" | "otlp-grpc";
|
297
290
|
hiveRegistryToken?: string | undefined;
|
298
291
|
hiveUsageTarget?: string | undefined;
|
299
|
-
hiveTarget?: string | undefined;
|
300
|
-
hiveAccessToken?: string | undefined;
|
301
292
|
hiveUsageAccessToken?: string | undefined;
|
302
|
-
hiveTraceAccessToken?: string | undefined;
|
303
293
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
304
294
|
hivePersistedDocumentsToken?: string | undefined;
|
305
295
|
hiveCdnEndpoint?: string | undefined;
|
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { b as defaultOptions, d as defineConfig, e as enableModuleCachingIfPossible, a as getBuiltinPluginsFromConfig, g as getCacheInstanceFromConfig, h as handleNodeWarnings, r as run } from './cli-
|
1
|
+
export { b as defaultOptions, d as defineConfig, e as enableModuleCachingIfPossible, a as getBuiltinPluginsFromConfig, g as getCacheInstanceFromConfig, h as handleNodeWarnings, r as run } from './cli-CEBNmXIe.js';
|
2
2
|
export * from '@graphql-hive/logger';
|
3
3
|
export * from '@graphql-hive/gateway-runtime';
|
4
4
|
export { PubSub } from '@graphql-hive/pubsub';
|
@@ -29,7 +29,6 @@ import 'node:url';
|
|
29
29
|
import 'node:fs';
|
30
30
|
import 'node:http';
|
31
31
|
import 'node:https';
|
32
|
-
import '@opentelemetry/sdk-trace-base';
|
33
32
|
import '@graphql-tools/utils';
|
34
33
|
import '@graphql-tools/code-file-loader';
|
35
34
|
import '@graphql-tools/graphql-file-loader';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-hive/gateway",
|
3
|
-
"version": "2.0.0-alpha-
|
3
|
+
"version": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
4
4
|
"type": "module",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -53,28 +53,28 @@
|
|
53
53
|
"@escape.tech/graphql-armor-block-field-suggestions": "^3.0.0",
|
54
54
|
"@escape.tech/graphql-armor-max-depth": "^2.4.0",
|
55
55
|
"@escape.tech/graphql-armor-max-tokens": "^2.5.0",
|
56
|
-
"@graphql-hive/gateway-runtime": "2.0.0-alpha-
|
57
|
-
"@graphql-hive/importer": "2.0.0-alpha-
|
58
|
-
"@graphql-hive/logger": "1.0.0-alpha-
|
59
|
-
"@graphql-hive/plugin-aws-sigv4": "2.0.0-alpha-
|
60
|
-
"@graphql-hive/plugin-deduplicate-request": "2.0.0-alpha-
|
61
|
-
"@graphql-hive/pubsub": "2.0.0-alpha-
|
56
|
+
"@graphql-hive/gateway-runtime": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
57
|
+
"@graphql-hive/importer": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
58
|
+
"@graphql-hive/logger": "1.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
59
|
+
"@graphql-hive/plugin-aws-sigv4": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
60
|
+
"@graphql-hive/plugin-deduplicate-request": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
61
|
+
"@graphql-hive/pubsub": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
62
62
|
"@graphql-mesh/cache-cfw-kv": "^0.105.5",
|
63
63
|
"@graphql-mesh/cache-localforage": "^0.105.6",
|
64
64
|
"@graphql-mesh/cache-redis": "^0.104.5",
|
65
65
|
"@graphql-mesh/cache-upstash-redis": "^0.1.5",
|
66
66
|
"@graphql-mesh/cross-helpers": "^0.4.10",
|
67
|
-
"@graphql-mesh/hmac-upstream-signature": "2.0.0-alpha-
|
67
|
+
"@graphql-mesh/hmac-upstream-signature": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
68
68
|
"@graphql-mesh/plugin-http-cache": "^0.105.6",
|
69
69
|
"@graphql-mesh/plugin-jit": "^0.2.5",
|
70
|
-
"@graphql-mesh/plugin-jwt-auth": "2.0.0-alpha-
|
71
|
-
"@graphql-mesh/plugin-opentelemetry": "2.0.0-alpha-
|
72
|
-
"@graphql-mesh/plugin-prometheus": "2.0.0-alpha-
|
70
|
+
"@graphql-mesh/plugin-jwt-auth": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
71
|
+
"@graphql-mesh/plugin-opentelemetry": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
72
|
+
"@graphql-mesh/plugin-prometheus": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
73
73
|
"@graphql-mesh/plugin-rate-limit": "^0.104.5",
|
74
74
|
"@graphql-mesh/plugin-snapshot": "^0.104.5",
|
75
|
-
"@graphql-mesh/transport-http": "1.0.0-alpha-
|
76
|
-
"@graphql-mesh/transport-http-callback": "1.0.0-alpha-
|
77
|
-
"@graphql-mesh/transport-ws": "2.0.0-alpha-
|
75
|
+
"@graphql-mesh/transport-http": "1.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
76
|
+
"@graphql-mesh/transport-http-callback": "1.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
77
|
+
"@graphql-mesh/transport-ws": "2.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
78
78
|
"@graphql-mesh/types": "^0.104.5",
|
79
79
|
"@graphql-mesh/utils": "^0.104.5",
|
80
80
|
"@graphql-tools/code-file-loader": "^8.1.15",
|
@@ -84,7 +84,6 @@
|
|
84
84
|
"@graphql-yoga/render-graphiql": "^5.13.5",
|
85
85
|
"@opentelemetry/api": "^1.9.0",
|
86
86
|
"@opentelemetry/api-logs": "^0.202.0",
|
87
|
-
"@opentelemetry/context-async-hooks": "^2.0.1",
|
88
87
|
"@opentelemetry/context-zone": "^2.0.1",
|
89
88
|
"@opentelemetry/core": "^2.0.1",
|
90
89
|
"@opentelemetry/exporter-jaeger": "^2.0.1",
|
@@ -94,7 +93,6 @@
|
|
94
93
|
"@opentelemetry/sampler-jaeger-remote": "^0.202.0",
|
95
94
|
"@opentelemetry/sdk-logs": "^0.202.0",
|
96
95
|
"@opentelemetry/sdk-metrics": "^2.0.1",
|
97
|
-
"@opentelemetry/sdk-trace-base": "^2.0.1",
|
98
96
|
"commander": "^13.1.0",
|
99
97
|
"dotenv": "^16.4.7",
|
100
98
|
"graphql-ws": "^6.0.4",
|
@@ -103,7 +101,7 @@
|
|
103
101
|
"ws": "^8.18.0"
|
104
102
|
},
|
105
103
|
"devDependencies": {
|
106
|
-
"@graphql-mesh/transport-common": "1.0.0-alpha-
|
104
|
+
"@graphql-mesh/transport-common": "1.0.0-alpha-4cb19b182f618fdee75ce5d8207d983be997858d",
|
107
105
|
"@graphql-mesh/transport-soap": "^0.10.6",
|
108
106
|
"@graphql-tools/executor": "^1.4.7",
|
109
107
|
"@rollup/plugin-commonjs": "^28.0.0",
|