@graphql-hive/gateway 2.0.0-alpha-66a7d7361fb409f6a1c7a61316cc2ed56250a28b → 2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
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 +15 -19
- package/dist/bin.cjs +1 -2
- package/dist/bin.js +1 -2
- package/dist/{cli-CQdLYWjW.cjs → cli-BQ10GobO.cjs} +17 -184
- package/dist/{cli-C8SAeNPg.js → cli-CpJrCTMy.js} +18 -185
- package/dist/index.cjs +1 -2
- package/dist/index.d.cts +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/index.js +1 -2
- package/package.json +15 -17
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# @graphql-hive/gateway
|
2
2
|
|
3
|
-
## 2.0.0-alpha-
|
3
|
+
## 2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
4
4
|
|
5
5
|
### Major Changes
|
6
6
|
|
@@ -44,10 +44,6 @@
|
|
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
|
-
- [#1300](https://github.com/graphql-hive/gateway/pull/1300) [`1ba0cf4`](https://github.com/graphql-hive/gateway/commit/1ba0cf4a6359e41a6ab16f940d8733d3ad9d800b) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
48
|
-
- Added dependency [`@opentelemetry/context-async-hooks@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/context-async-hooks/v/2.0.1) (to `dependencies`)
|
49
|
-
- Added dependency [`@opentelemetry/sdk-trace-base@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-trace-base/v/2.0.1) (to `dependencies`)
|
50
|
-
|
51
47
|
- [#1318](https://github.com/graphql-hive/gateway/pull/1318) [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0) Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates:
|
52
48
|
- Updated dependency [`@graphql-yoga/render-graphiql@^5.15.1` ↗︎](https://www.npmjs.com/package/@graphql-yoga/render-graphiql/v/5.15.1) (from `^5.13.5`, in `dependencies`)
|
53
49
|
- Updated dependency [`graphql-yoga@^5.15.1` ↗︎](https://www.npmjs.com/package/graphql-yoga/v/5.15.1) (from `^5.13.5`, in `dependencies`)
|
@@ -74,20 +70,20 @@
|
|
74
70
|
- Added dependency [`@opentelemetry/sdk-metrics@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-metrics/v/2.0.1) (to `dependencies`)
|
75
71
|
- Removed dependency [`@graphql-mesh/plugin-mock@^0.105.6` ↗︎](https://www.npmjs.com/package/@graphql-mesh/plugin-mock/v/0.105.6) (from `dependencies`)
|
76
72
|
|
77
|
-
- Updated dependencies [[`95484c2`](https://github.com/graphql-hive/gateway/commit/95484c2ca0cea1cd732df4bfe8ce45032ec31d42), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`f12f2b7`](https://github.com/graphql-hive/gateway/commit/f12f2b78163fbef797a42b5999a0b5a8ef6b2c98), [`8b7db06`](https://github.com/graphql-hive/gateway/commit/8b7db06887f5dec52d380bfc123dbf495cbe04ef), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`9e4d81c`](https://github.com/graphql-hive/gateway/commit/9e4d81c2ad9e99d2195e3f2a021a30a9312cf980), [`f3caa12`](https://github.com/graphql-hive/gateway/commit/f3caa12a7ad50cdc03c82f2336f820e8ccbad55e), [`
|
78
|
-
- @graphql-hive/gateway-runtime@2.0.0-alpha-
|
79
|
-
- @graphql-hive/plugin-aws-sigv4@2.0.0-alpha-
|
80
|
-
- @graphql-mesh/plugin-jwt-auth@2.0.0-alpha-
|
81
|
-
- @graphql-mesh/plugin-opentelemetry@2.0.0-alpha-
|
82
|
-
- @graphql-mesh/plugin-prometheus@2.0.0-alpha-
|
83
|
-
- @graphql-mesh/transport-ws@2.0.0-alpha-
|
84
|
-
- @graphql-mesh/hmac-upstream-signature@2.0.0-alpha-
|
85
|
-
- @graphql-hive/plugin-deduplicate-request@2.0.0-alpha-
|
86
|
-
- @graphql-mesh/transport-http-callback@1.0.0-alpha-
|
87
|
-
- @graphql-mesh/transport-http@1.0.0-alpha-
|
88
|
-
- @graphql-hive/importer@2.0.0-alpha-
|
89
|
-
- @graphql-hive/pubsub@2.0.0-alpha-
|
90
|
-
- @graphql-hive/logger@1.0.1-alpha-
|
73
|
+
- Updated dependencies [[`95484c2`](https://github.com/graphql-hive/gateway/commit/95484c2ca0cea1cd732df4bfe8ce45032ec31d42), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`f12f2b7`](https://github.com/graphql-hive/gateway/commit/f12f2b78163fbef797a42b5999a0b5a8ef6b2c98), [`8b7db06`](https://github.com/graphql-hive/gateway/commit/8b7db06887f5dec52d380bfc123dbf495cbe04ef), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`9e4d81c`](https://github.com/graphql-hive/gateway/commit/9e4d81c2ad9e99d2195e3f2a021a30a9312cf980), [`f3caa12`](https://github.com/graphql-hive/gateway/commit/f3caa12a7ad50cdc03c82f2336f820e8ccbad55e), [`dfe6f58`](https://github.com/graphql-hive/gateway/commit/dfe6f58209afd27953676c5b51b8b9f07fc99671), [`ceb07a6`](https://github.com/graphql-hive/gateway/commit/ceb07a61f6f1c7ca345df2c23860950e5152288e), [`732c6f5`](https://github.com/graphql-hive/gateway/commit/732c6f5c82fdf6b730109fbc7c05c69da8ce6fb4), [`95484c2`](https://github.com/graphql-hive/gateway/commit/95484c2ca0cea1cd732df4bfe8ce45032ec31d42), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`8b7db06`](https://github.com/graphql-hive/gateway/commit/8b7db06887f5dec52d380bfc123dbf495cbe04ef), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`cd9b7ce`](https://github.com/graphql-hive/gateway/commit/cd9b7ce551ec702c00b33e6c1b2cf68f0a6c82a3), [`95484c2`](https://github.com/graphql-hive/gateway/commit/95484c2ca0cea1cd732df4bfe8ce45032ec31d42), [`2f0d8ad`](https://github.com/graphql-hive/gateway/commit/2f0d8ad6467b44aa072d2b5a0102ed255462c05a), [`f052709`](https://github.com/graphql-hive/gateway/commit/f0527092e4942b4c97cb3272266f93f3200fac98), [`9bee8e9`](https://github.com/graphql-hive/gateway/commit/9bee8e9ff165c43591c0b20637b6d1f2a2cb9cc2), [`9b230f3`](https://github.com/graphql-hive/gateway/commit/9b230f35b47afbf3b253e4c21720e836c5a2a8d1), [`10a5887`](https://github.com/graphql-hive/gateway/commit/10a58873acde8734f05dfda455fe7b366861676b), [`2a56e5f`](https://github.com/graphql-hive/gateway/commit/2a56e5fd5a07f6784e8c2d0ad767d8c55710ada4), [`2f0d8ad`](https://github.com/graphql-hive/gateway/commit/2f0d8ad6467b44aa072d2b5a0102ed255462c05a), [`ae37c4a`](https://github.com/graphql-hive/gateway/commit/ae37c4a4189e3ea20f2ce0d24e2509d2053eb244), [`732c6f5`](https://github.com/graphql-hive/gateway/commit/732c6f5c82fdf6b730109fbc7c05c69da8ce6fb4), [`95484c2`](https://github.com/graphql-hive/gateway/commit/95484c2ca0cea1cd732df4bfe8ce45032ec31d42), [`dbb4fd9`](https://github.com/graphql-hive/gateway/commit/dbb4fd9287ff872de5cc9f18546987bd71232df5)]:
|
74
|
+
- @graphql-hive/gateway-runtime@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
75
|
+
- @graphql-hive/plugin-aws-sigv4@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
76
|
+
- @graphql-mesh/plugin-jwt-auth@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
77
|
+
- @graphql-mesh/plugin-opentelemetry@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
78
|
+
- @graphql-mesh/plugin-prometheus@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
79
|
+
- @graphql-mesh/transport-ws@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
80
|
+
- @graphql-mesh/hmac-upstream-signature@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
81
|
+
- @graphql-hive/plugin-deduplicate-request@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
82
|
+
- @graphql-mesh/transport-http-callback@1.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
83
|
+
- @graphql-mesh/transport-http@1.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
84
|
+
- @graphql-hive/importer@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
85
|
+
- @graphql-hive/pubsub@2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
86
|
+
- @graphql-hive/logger@1.0.1-alpha-d672d11878c307e7a0fd28512903cb25f048a83f
|
91
87
|
|
92
88
|
## 1.15.4
|
93
89
|
|
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-BQ10GobO.cjs');
|
7
7
|
require('node:cluster');
|
8
8
|
require('node:os');
|
9
9
|
require('node:path');
|
@@ -18,7 +18,6 @@ require('node:fs');
|
|
18
18
|
require('node:http');
|
19
19
|
require('node:https');
|
20
20
|
require('@graphql-tools/utils');
|
21
|
-
require('@opentelemetry/sdk-trace-base');
|
22
21
|
require('@graphql-tools/code-file-loader');
|
23
22
|
require('@graphql-tools/graphql-file-loader');
|
24
23
|
require('@graphql-tools/load');
|
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-CpJrCTMy.js';
|
6
6
|
import 'node:cluster';
|
7
7
|
import 'node:os';
|
8
8
|
import 'node:path';
|
@@ -17,7 +17,6 @@ import 'node:fs';
|
|
17
17
|
import 'node:http';
|
18
18
|
import 'node:https';
|
19
19
|
import '@graphql-tools/utils';
|
20
|
-
import '@opentelemetry/sdk-trace-base';
|
21
20
|
import '@graphql-tools/code-file-loader';
|
22
21
|
import '@graphql-tools/graphql-file-loader';
|
23
22
|
import '@graphql-tools/load';
|
@@ -16,7 +16,6 @@ var node_fs = require('node:fs');
|
|
16
16
|
var node_http = require('node:http');
|
17
17
|
var node_https = require('node:https');
|
18
18
|
var utils$1 = require('@graphql-tools/utils');
|
19
|
-
var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
20
19
|
var codeFileLoader = require('@graphql-tools/code-file-loader');
|
21
20
|
var graphqlFileLoader = require('@graphql-tools/graphql-file-loader');
|
22
21
|
var load = require('@graphql-tools/load');
|
@@ -493,83 +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 traceEndpoint = cliOpts.hiveTraceEndpoint;
|
499
|
-
const target = cliOpts.hiveTarget;
|
500
|
-
const openTelemetry = cliOpts.openTelemetry;
|
501
|
-
const exporterType = cliOpts.openTelemetryExporterType ?? "otlp-http";
|
502
|
-
const log = ctx.log.child("[OpenTelemetry] ");
|
503
|
-
if (openTelemetry || accessToken) {
|
504
|
-
log.debug(
|
505
|
-
{ openTelemetry, exporterType, target, traceEndpoint },
|
506
|
-
"Initializing OpenTelemetry SDK"
|
507
|
-
);
|
508
|
-
return utils$1.fakePromise().then(async () => {
|
509
|
-
const { openTelemetrySetup, HiveTracingSpanProcessor, getEnvVar } = await import('@graphql-mesh/plugin-opentelemetry/setup');
|
510
|
-
const processors = [];
|
511
|
-
const logAttributes = {
|
512
|
-
traceEndpoints: [],
|
513
|
-
contextManager: false
|
514
|
-
};
|
515
|
-
let integrationName;
|
516
|
-
if (openTelemetry) {
|
517
|
-
const otelEndpoint = typeof openTelemetry === "string" ? openTelemetry : getEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", void 0);
|
518
|
-
log.debug({ exporterType, otelEndpoint }, "Setting up OTLP Exporter");
|
519
|
-
integrationName = "OpenTelemetry";
|
520
|
-
logAttributes.traceEndpoints.push({
|
521
|
-
url: otelEndpoint ?? null,
|
522
|
-
type: exporterType
|
523
|
-
});
|
524
|
-
log.debug({ type: exporterType }, "Loading OpenTelemetry exporter");
|
525
|
-
const { OTLPTraceExporter } = await import(`@opentelemetry/exporter-trace-${exporterType}`);
|
526
|
-
processors.push(
|
527
|
-
new sdkTraceBase.BatchSpanProcessor(new OTLPTraceExporter({ url: otelEndpoint }))
|
528
|
-
);
|
529
|
-
}
|
530
|
-
if (accessToken) {
|
531
|
-
log.debug({ target, traceEndpoint }, "Setting up Hive Tracing");
|
532
|
-
integrationName ??= "Hive Tracing";
|
533
|
-
if (!target) {
|
534
|
-
ctx.log.error(
|
535
|
-
'Hive tracing needs a target. Please provide it through "--hive-target <target>"'
|
536
|
-
);
|
537
|
-
process.exit(1);
|
538
|
-
}
|
539
|
-
logAttributes.traceEndpoints.push({
|
540
|
-
url: traceEndpoint,
|
541
|
-
type: "hive tracing",
|
542
|
-
target
|
543
|
-
});
|
544
|
-
processors.push(
|
545
|
-
new HiveTracingSpanProcessor({
|
546
|
-
accessToken,
|
547
|
-
target,
|
548
|
-
endpoint: traceEndpoint
|
549
|
-
})
|
550
|
-
);
|
551
|
-
}
|
552
|
-
log.debug("Trying to load AsyncLocalStorage based Context Manager");
|
553
|
-
const contextManager = await import('@opentelemetry/context-async-hooks').then((module) => {
|
554
|
-
logAttributes.contextManager = true;
|
555
|
-
return new module.AsyncLocalStorageContextManager();
|
556
|
-
}).catch(() => null);
|
557
|
-
openTelemetrySetup({
|
558
|
-
traces: { processors },
|
559
|
-
contextManager
|
560
|
-
});
|
561
|
-
log.info(logAttributes, `${integrationName} integration is enabled`);
|
562
|
-
return true;
|
563
|
-
});
|
564
|
-
}
|
565
|
-
return false;
|
566
|
-
}
|
567
|
-
|
568
495
|
function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
569
496
|
const confOpts = {
|
570
497
|
...loadedConfig.reporting?.type === "hive" ? {
|
571
498
|
hiveRegistryToken: loadedConfig.reporting.token,
|
572
|
-
|
499
|
+
hiveUsageTarget: loadedConfig.reporting.target,
|
573
500
|
hiveUsageAccessToken: loadedConfig.reporting.token
|
574
501
|
} : {},
|
575
502
|
...loadedConfig.reporting?.type === "graphos" ? {
|
@@ -577,45 +504,32 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
577
504
|
apolloKey: loadedConfig.reporting.apiKey
|
578
505
|
} : {}
|
579
506
|
};
|
580
|
-
const opts = {
|
581
|
-
...confOpts,
|
582
|
-
...cliOpts,
|
583
|
-
hiveTarget: (
|
584
|
-
// cli arguments always take precedence over config
|
585
|
-
confOpts.hiveTarget ?? cliOpts.hiveTarget ?? cliOpts.hiveUsageTarget
|
586
|
-
)
|
587
|
-
};
|
507
|
+
const opts = { ...confOpts, ...cliOpts };
|
588
508
|
if (cliOpts.hiveRegistryToken && cliOpts.hiveUsageAccessToken) {
|
589
509
|
ctx.log.error(
|
590
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.'
|
591
511
|
);
|
592
512
|
process.exit(1);
|
593
513
|
}
|
594
|
-
if (cliOpts.
|
595
|
-
ctx.log.error(
|
596
|
-
'Cannot use "--hive-usage-target" with "--hive-target". Please only use "--hive-target"'
|
597
|
-
);
|
598
|
-
process.exit(1);
|
599
|
-
}
|
600
|
-
if (cliOpts.hiveRegistryToken && opts.hiveTarget) {
|
514
|
+
if (cliOpts.hiveRegistryToken && opts.hiveUsageTarget) {
|
601
515
|
ctx.log.error(
|
602
516
|
'Cannot use "--hive-registry-token" with a target. Please use "--hive-usage-target" and "--hive-usage-access-token" or the config instead.'
|
603
517
|
);
|
604
518
|
process.exit(1);
|
605
519
|
}
|
606
|
-
if (opts.
|
520
|
+
if (opts.hiveUsageTarget && !opts.hiveUsageAccessToken) {
|
607
521
|
ctx.log.error(
|
608
|
-
'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.'
|
609
523
|
);
|
610
524
|
process.exit(1);
|
611
525
|
}
|
612
|
-
if (
|
526
|
+
if (opts.hiveUsageAccessToken && !opts.hiveUsageTarget) {
|
613
527
|
ctx.log.error(
|
614
|
-
'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.'
|
615
529
|
);
|
616
530
|
process.exit(1);
|
617
531
|
}
|
618
|
-
const hiveUsageAccessToken = opts.
|
532
|
+
const hiveUsageAccessToken = opts.hiveUsageAccessToken || opts.hiveRegistryToken;
|
619
533
|
if (hiveUsageAccessToken) {
|
620
534
|
if (opts.hiveUsageTarget) {
|
621
535
|
ctx.log.info("Configuring Hive usage reporting");
|
@@ -626,7 +540,7 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
626
540
|
...loadedConfig.reporting,
|
627
541
|
type: "hive",
|
628
542
|
token: hiveUsageAccessToken,
|
629
|
-
target: opts.
|
543
|
+
target: opts.hiveUsageTarget
|
630
544
|
};
|
631
545
|
}
|
632
546
|
if (opts.apolloKey) {
|
@@ -654,30 +568,17 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
654
568
|
"path to the GraphQL schema file or a url from where to pull the schema"
|
655
569
|
).action(async function proxy(endpoint) {
|
656
570
|
const {
|
657
|
-
opentelemetry,
|
658
|
-
opentelemetryExporterType,
|
659
571
|
hiveCdnEndpoint,
|
660
572
|
hiveCdnKey,
|
661
573
|
hiveRegistryToken,
|
662
|
-
hiveTarget,
|
663
574
|
hiveUsageTarget,
|
664
|
-
hiveAccessToken,
|
665
575
|
hiveUsageAccessToken,
|
666
|
-
hiveTraceAccessToken,
|
667
|
-
hiveTraceEndpoint,
|
668
576
|
maskedErrors,
|
669
577
|
hivePersistedDocumentsEndpoint,
|
670
578
|
hivePersistedDocumentsToken,
|
671
579
|
...opts
|
672
580
|
} = this.optsWithGlobals();
|
673
581
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} in proxy mode`);
|
674
|
-
const openTelemetryEnabledByCLI = await handleOpenTelemetryConfig(ctx, {
|
675
|
-
openTelemetry: opentelemetry,
|
676
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
677
|
-
hiveTarget,
|
678
|
-
hiveTraceAccessToken,
|
679
|
-
hiveTraceEndpoint
|
680
|
-
});
|
681
582
|
const loadedConfig = await loadConfig({
|
682
583
|
log: ctx.log,
|
683
584
|
configPath: opts.configPath,
|
@@ -731,11 +632,8 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
731
632
|
const registryConfig = {};
|
732
633
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
733
634
|
hiveRegistryToken,
|
734
|
-
hiveTarget,
|
735
635
|
hiveUsageTarget,
|
736
|
-
hiveAccessToken,
|
737
636
|
hiveUsageAccessToken,
|
738
|
-
hiveTraceAccessToken,
|
739
637
|
// proxy can only do reporting to hive registry
|
740
638
|
apolloGraphRef: void 0,
|
741
639
|
apolloKey: void 0
|
@@ -756,8 +654,7 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
756
654
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
757
655
|
{
|
758
656
|
...loadedConfig,
|
759
|
-
...opts
|
760
|
-
openTelemetry: openTelemetryEnabledByCLI ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
657
|
+
...opts
|
761
658
|
},
|
762
659
|
{
|
763
660
|
log: ctx.log,
|
@@ -832,28 +729,15 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
832
729
|
'path to the subgraph schema file or a url from where to pull the subgraph schema (default: "subgraph.graphql")'
|
833
730
|
).action(async function subgraph(schemaPathOrUrl) {
|
834
731
|
const {
|
835
|
-
opentelemetry,
|
836
|
-
opentelemetryExporterType,
|
837
732
|
maskedErrors,
|
838
733
|
hiveRegistryToken,
|
839
|
-
hiveTarget,
|
840
734
|
hiveUsageTarget,
|
841
|
-
hiveAccessToken,
|
842
735
|
hiveUsageAccessToken,
|
843
|
-
hiveTraceAccessToken,
|
844
|
-
hiveTraceEndpoint,
|
845
736
|
hivePersistedDocumentsEndpoint,
|
846
737
|
hivePersistedDocumentsToken,
|
847
738
|
...opts
|
848
739
|
} = this.optsWithGlobals();
|
849
740
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} as subgraph`);
|
850
|
-
const openTelemetryEnabledByCLI = await handleOpenTelemetryConfig(ctx, {
|
851
|
-
openTelemetry: opentelemetry,
|
852
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
853
|
-
hiveTarget,
|
854
|
-
hiveTraceAccessToken,
|
855
|
-
hiveTraceEndpoint
|
856
|
-
});
|
857
741
|
const loadedConfig = await loadConfig({
|
858
742
|
log: ctx.log,
|
859
743
|
configPath: opts.configPath,
|
@@ -869,11 +753,8 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
869
753
|
const registryConfig = {};
|
870
754
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
871
755
|
hiveRegistryToken,
|
872
|
-
hiveTarget,
|
873
756
|
hiveUsageTarget,
|
874
|
-
hiveAccessToken,
|
875
757
|
hiveUsageAccessToken,
|
876
|
-
hiveTraceAccessToken,
|
877
758
|
// subgraph can only do reporting to hive registry
|
878
759
|
apolloGraphRef: void 0,
|
879
760
|
apolloKey: void 0
|
@@ -894,8 +775,7 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
894
775
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
895
776
|
{
|
896
777
|
...loadedConfig,
|
897
|
-
...opts
|
898
|
-
openTelemetry: openTelemetryEnabledByCLI ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
778
|
+
...opts
|
899
779
|
},
|
900
780
|
{
|
901
781
|
log: ctx.log,
|
@@ -989,17 +869,11 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
989
869
|
).env("APOLLO_SCHEMA_CONFIG_DELIVERY_ENDPOINT")
|
990
870
|
).action(async function supergraph(schemaPathOrUrl) {
|
991
871
|
const {
|
992
|
-
opentelemetry,
|
993
|
-
opentelemetryExporterType,
|
994
872
|
hiveCdnEndpoint,
|
995
873
|
hiveCdnKey,
|
996
874
|
hiveRegistryToken,
|
997
875
|
hiveUsageTarget,
|
998
|
-
hiveTarget,
|
999
|
-
hiveAccessToken,
|
1000
876
|
hiveUsageAccessToken,
|
1001
|
-
hiveTraceAccessToken,
|
1002
|
-
hiveTraceEndpoint,
|
1003
877
|
maskedErrors,
|
1004
878
|
apolloGraphRef,
|
1005
879
|
apolloKey,
|
@@ -1011,13 +885,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1011
885
|
ctx.log.info(
|
1012
886
|
`Starting ${ctx.productName} ${ctx.version} with supergraph`
|
1013
887
|
);
|
1014
|
-
const openTelemetryEnabledByCLI = await handleOpenTelemetryConfig(ctx, {
|
1015
|
-
openTelemetry: opentelemetry,
|
1016
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
1017
|
-
hiveTarget,
|
1018
|
-
hiveTraceAccessToken,
|
1019
|
-
hiveTraceEndpoint
|
1020
|
-
});
|
1021
888
|
const loadedConfig = await loadConfig({
|
1022
889
|
log: ctx.log,
|
1023
890
|
configPath: opts.configPath,
|
@@ -1103,9 +970,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1103
970
|
}
|
1104
971
|
const registryConfig = {};
|
1105
972
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
1106
|
-
hiveTarget,
|
1107
|
-
hiveAccessToken,
|
1108
|
-
hiveTraceAccessToken,
|
1109
973
|
hiveRegistryToken,
|
1110
974
|
hiveUsageTarget,
|
1111
975
|
hiveUsageAccessToken,
|
@@ -1128,8 +992,7 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1128
992
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
1129
993
|
{
|
1130
994
|
...loadedConfig,
|
1131
|
-
...opts
|
1132
|
-
openTelemetry: openTelemetryEnabledByCLI ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
995
|
+
...opts
|
1133
996
|
},
|
1134
997
|
{
|
1135
998
|
log: ctx.log,
|
@@ -1379,57 +1242,27 @@ let cli = new extraTypings.Command().configureHelp({
|
|
1379
1242
|
// see here https://github.com/tj/commander.js/blob/970ecae402b253de691e6a9066fea22f38fe7431/lib/command.js#L655
|
1380
1243
|
// @ts-expect-error
|
1381
1244
|
null
|
1382
|
-
).addOption(
|
1383
|
-
new extraTypings.Option(
|
1384
|
-
"--opentelemetry [exporter-endpoint]",
|
1385
|
-
`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.`
|
1386
|
-
).env("OPENTELEMETRY")
|
1387
|
-
).addOption(
|
1388
|
-
new extraTypings.Option(
|
1389
|
-
"--opentelemetry-exporter-type <type>",
|
1390
|
-
`OpenTelemetry exporter type to use when setting up OpenTelemetry integration. Requires "--opentelemetry" to set the endpoint.`
|
1391
|
-
).choices(["otlp-http", "otlp-grpc"]).default("otlp-http").env("OPENTELEMETRY_EXPORTER_TYPE")
|
1392
1245
|
).addOption(
|
1393
1246
|
new extraTypings.Option(
|
1394
1247
|
"--hive-registry-token <token>",
|
1395
|
-
'[DEPRECATED: please use "--hive-target" and "--hive-access-token"] Hive registry token for usage metrics reporting'
|
1248
|
+
'[DEPRECATED: please use "--hive-usage-target" and "--hive-usage-access-token"] Hive registry token for usage metrics reporting'
|
1396
1249
|
).env("HIVE_REGISTRY_TOKEN")
|
1397
1250
|
).addOption(
|
1398
1251
|
new extraTypings.Option(
|
1399
1252
|
"--hive-usage-target <target>",
|
1400
|
-
|
1253
|
+
'Hive registry target to which the usage data should be reported to. requires the "--hive-usage-access-token <token>" option'
|
1401
1254
|
).env("HIVE_USAGE_TARGET")
|
1402
|
-
).addOption(
|
1403
|
-
new extraTypings.Option(
|
1404
|
-
"--hive-target <target>",
|
1405
|
-
'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'
|
1406
|
-
).env("HIVE_TARGET")
|
1407
|
-
).addOption(
|
1408
|
-
new extraTypings.Option(
|
1409
|
-
"--hive-access-token <token>",
|
1410
|
-
'Hive registry access token for usage metrics reporting and tracing. Enables both usage reporting and tracing. Requires the "--hive-target <target>" option'
|
1411
|
-
).env("HIVE_ACCESS_TOKEN")
|
1412
1255
|
).addOption(
|
1413
1256
|
new extraTypings.Option(
|
1414
1257
|
"--hive-usage-access-token <token>",
|
1415
|
-
|
1258
|
+
'Hive registry access token for usage metrics reporting. requires the "--hive-usage-target <target>" option'
|
1416
1259
|
).env("HIVE_USAGE_ACCESS_TOKEN")
|
1417
|
-
).addOption(
|
1418
|
-
new extraTypings.Option(
|
1419
|
-
"--hive-trace-access-token <token>",
|
1420
|
-
`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"`
|
1421
|
-
).env("HIVE_TRACE_ACCESS_TOKEN")
|
1422
|
-
).addOption(
|
1423
|
-
new extraTypings.Option(
|
1424
|
-
"--hive-trace-endpoint <endpoint>",
|
1425
|
-
`Hive registry tracing endpoint.`
|
1426
|
-
).env("HIVE_TRACE_ENDPOINT").default(`https://api.graphql-hive.com/otel/v1/traces`)
|
1427
1260
|
).option(
|
1428
1261
|
"--hive-persisted-documents-endpoint <endpoint>",
|
1429
|
-
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents.
|
1262
|
+
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents. requires the "--hive-persisted-documents-token <token>" option'
|
1430
1263
|
).option(
|
1431
1264
|
"--hive-persisted-documents-token <token>",
|
1432
|
-
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token.
|
1265
|
+
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token. requires the "--hive-persisted-documents-endpoint <endpoint>" option'
|
1433
1266
|
).addOption(
|
1434
1267
|
new extraTypings.Option(
|
1435
1268
|
"--hive-cdn-endpoint <endpoint>",
|
@@ -13,8 +13,7 @@ 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 {
|
17
|
-
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
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';
|
20
19
|
import { loadTypedefs } from '@graphql-tools/load';
|
@@ -486,83 +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 traceEndpoint = cliOpts.hiveTraceEndpoint;
|
492
|
-
const target = cliOpts.hiveTarget;
|
493
|
-
const openTelemetry = cliOpts.openTelemetry;
|
494
|
-
const exporterType = cliOpts.openTelemetryExporterType ?? "otlp-http";
|
495
|
-
const log = ctx.log.child("[OpenTelemetry] ");
|
496
|
-
if (openTelemetry || accessToken) {
|
497
|
-
log.debug(
|
498
|
-
{ openTelemetry, exporterType, target, traceEndpoint },
|
499
|
-
"Initializing OpenTelemetry SDK"
|
500
|
-
);
|
501
|
-
return fakePromise().then(async () => {
|
502
|
-
const { openTelemetrySetup, HiveTracingSpanProcessor, getEnvVar } = await import('@graphql-mesh/plugin-opentelemetry/setup');
|
503
|
-
const processors = [];
|
504
|
-
const logAttributes = {
|
505
|
-
traceEndpoints: [],
|
506
|
-
contextManager: false
|
507
|
-
};
|
508
|
-
let integrationName;
|
509
|
-
if (openTelemetry) {
|
510
|
-
const otelEndpoint = typeof openTelemetry === "string" ? openTelemetry : getEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", void 0);
|
511
|
-
log.debug({ exporterType, otelEndpoint }, "Setting up OTLP Exporter");
|
512
|
-
integrationName = "OpenTelemetry";
|
513
|
-
logAttributes.traceEndpoints.push({
|
514
|
-
url: otelEndpoint ?? null,
|
515
|
-
type: exporterType
|
516
|
-
});
|
517
|
-
log.debug({ type: exporterType }, "Loading OpenTelemetry exporter");
|
518
|
-
const { OTLPTraceExporter } = await import(`@opentelemetry/exporter-trace-${exporterType}`);
|
519
|
-
processors.push(
|
520
|
-
new BatchSpanProcessor(new OTLPTraceExporter({ url: otelEndpoint }))
|
521
|
-
);
|
522
|
-
}
|
523
|
-
if (accessToken) {
|
524
|
-
log.debug({ target, traceEndpoint }, "Setting up Hive Tracing");
|
525
|
-
integrationName ??= "Hive Tracing";
|
526
|
-
if (!target) {
|
527
|
-
ctx.log.error(
|
528
|
-
'Hive tracing needs a target. Please provide it through "--hive-target <target>"'
|
529
|
-
);
|
530
|
-
process.exit(1);
|
531
|
-
}
|
532
|
-
logAttributes.traceEndpoints.push({
|
533
|
-
url: traceEndpoint,
|
534
|
-
type: "hive tracing",
|
535
|
-
target
|
536
|
-
});
|
537
|
-
processors.push(
|
538
|
-
new HiveTracingSpanProcessor({
|
539
|
-
accessToken,
|
540
|
-
target,
|
541
|
-
endpoint: traceEndpoint
|
542
|
-
})
|
543
|
-
);
|
544
|
-
}
|
545
|
-
log.debug("Trying to load AsyncLocalStorage based Context Manager");
|
546
|
-
const contextManager = await import('@opentelemetry/context-async-hooks').then((module) => {
|
547
|
-
logAttributes.contextManager = true;
|
548
|
-
return new module.AsyncLocalStorageContextManager();
|
549
|
-
}).catch(() => null);
|
550
|
-
openTelemetrySetup({
|
551
|
-
traces: { processors },
|
552
|
-
contextManager
|
553
|
-
});
|
554
|
-
log.info(logAttributes, `${integrationName} integration is enabled`);
|
555
|
-
return true;
|
556
|
-
});
|
557
|
-
}
|
558
|
-
return false;
|
559
|
-
}
|
560
|
-
|
561
488
|
function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
562
489
|
const confOpts = {
|
563
490
|
...loadedConfig.reporting?.type === "hive" ? {
|
564
491
|
hiveRegistryToken: loadedConfig.reporting.token,
|
565
|
-
|
492
|
+
hiveUsageTarget: loadedConfig.reporting.target,
|
566
493
|
hiveUsageAccessToken: loadedConfig.reporting.token
|
567
494
|
} : {},
|
568
495
|
...loadedConfig.reporting?.type === "graphos" ? {
|
@@ -570,45 +497,32 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
570
497
|
apolloKey: loadedConfig.reporting.apiKey
|
571
498
|
} : {}
|
572
499
|
};
|
573
|
-
const opts = {
|
574
|
-
...confOpts,
|
575
|
-
...cliOpts,
|
576
|
-
hiveTarget: (
|
577
|
-
// cli arguments always take precedence over config
|
578
|
-
confOpts.hiveTarget ?? cliOpts.hiveTarget ?? cliOpts.hiveUsageTarget
|
579
|
-
)
|
580
|
-
};
|
500
|
+
const opts = { ...confOpts, ...cliOpts };
|
581
501
|
if (cliOpts.hiveRegistryToken && cliOpts.hiveUsageAccessToken) {
|
582
502
|
ctx.log.error(
|
583
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.'
|
584
504
|
);
|
585
505
|
process.exit(1);
|
586
506
|
}
|
587
|
-
if (cliOpts.
|
588
|
-
ctx.log.error(
|
589
|
-
'Cannot use "--hive-usage-target" with "--hive-target". Please only use "--hive-target"'
|
590
|
-
);
|
591
|
-
process.exit(1);
|
592
|
-
}
|
593
|
-
if (cliOpts.hiveRegistryToken && opts.hiveTarget) {
|
507
|
+
if (cliOpts.hiveRegistryToken && opts.hiveUsageTarget) {
|
594
508
|
ctx.log.error(
|
595
509
|
'Cannot use "--hive-registry-token" with a target. Please use "--hive-usage-target" and "--hive-usage-access-token" or the config instead.'
|
596
510
|
);
|
597
511
|
process.exit(1);
|
598
512
|
}
|
599
|
-
if (opts.
|
513
|
+
if (opts.hiveUsageTarget && !opts.hiveUsageAccessToken) {
|
600
514
|
ctx.log.error(
|
601
|
-
'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.'
|
602
516
|
);
|
603
517
|
process.exit(1);
|
604
518
|
}
|
605
|
-
if (
|
519
|
+
if (opts.hiveUsageAccessToken && !opts.hiveUsageTarget) {
|
606
520
|
ctx.log.error(
|
607
|
-
'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.'
|
608
522
|
);
|
609
523
|
process.exit(1);
|
610
524
|
}
|
611
|
-
const hiveUsageAccessToken = opts.
|
525
|
+
const hiveUsageAccessToken = opts.hiveUsageAccessToken || opts.hiveRegistryToken;
|
612
526
|
if (hiveUsageAccessToken) {
|
613
527
|
if (opts.hiveUsageTarget) {
|
614
528
|
ctx.log.info("Configuring Hive usage reporting");
|
@@ -619,7 +533,7 @@ function handleReportingConfig(ctx, loadedConfig, cliOpts) {
|
|
619
533
|
...loadedConfig.reporting,
|
620
534
|
type: "hive",
|
621
535
|
token: hiveUsageAccessToken,
|
622
|
-
target: opts.
|
536
|
+
target: opts.hiveUsageTarget
|
623
537
|
};
|
624
538
|
}
|
625
539
|
if (opts.apolloKey) {
|
@@ -647,30 +561,17 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
647
561
|
"path to the GraphQL schema file or a url from where to pull the schema"
|
648
562
|
).action(async function proxy(endpoint) {
|
649
563
|
const {
|
650
|
-
opentelemetry,
|
651
|
-
opentelemetryExporterType,
|
652
564
|
hiveCdnEndpoint,
|
653
565
|
hiveCdnKey,
|
654
566
|
hiveRegistryToken,
|
655
|
-
hiveTarget,
|
656
567
|
hiveUsageTarget,
|
657
|
-
hiveAccessToken,
|
658
568
|
hiveUsageAccessToken,
|
659
|
-
hiveTraceAccessToken,
|
660
|
-
hiveTraceEndpoint,
|
661
569
|
maskedErrors,
|
662
570
|
hivePersistedDocumentsEndpoint,
|
663
571
|
hivePersistedDocumentsToken,
|
664
572
|
...opts
|
665
573
|
} = this.optsWithGlobals();
|
666
574
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} in proxy mode`);
|
667
|
-
const openTelemetryEnabledByCLI = await handleOpenTelemetryConfig(ctx, {
|
668
|
-
openTelemetry: opentelemetry,
|
669
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
670
|
-
hiveTarget,
|
671
|
-
hiveTraceAccessToken,
|
672
|
-
hiveTraceEndpoint
|
673
|
-
});
|
674
575
|
const loadedConfig = await loadConfig({
|
675
576
|
log: ctx.log,
|
676
577
|
configPath: opts.configPath,
|
@@ -724,11 +625,8 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
724
625
|
const registryConfig = {};
|
725
626
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
726
627
|
hiveRegistryToken,
|
727
|
-
hiveTarget,
|
728
628
|
hiveUsageTarget,
|
729
|
-
hiveAccessToken,
|
730
629
|
hiveUsageAccessToken,
|
731
|
-
hiveTraceAccessToken,
|
732
630
|
// proxy can only do reporting to hive registry
|
733
631
|
apolloGraphRef: void 0,
|
734
632
|
apolloKey: void 0
|
@@ -749,8 +647,7 @@ const addCommand$2 = (ctx, cli) => cli.command("proxy").description(
|
|
749
647
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
750
648
|
{
|
751
649
|
...loadedConfig,
|
752
|
-
...opts
|
753
|
-
openTelemetry: openTelemetryEnabledByCLI ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
650
|
+
...opts
|
754
651
|
},
|
755
652
|
{
|
756
653
|
log: ctx.log,
|
@@ -825,28 +722,15 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
825
722
|
'path to the subgraph schema file or a url from where to pull the subgraph schema (default: "subgraph.graphql")'
|
826
723
|
).action(async function subgraph(schemaPathOrUrl) {
|
827
724
|
const {
|
828
|
-
opentelemetry,
|
829
|
-
opentelemetryExporterType,
|
830
725
|
maskedErrors,
|
831
726
|
hiveRegistryToken,
|
832
|
-
hiveTarget,
|
833
727
|
hiveUsageTarget,
|
834
|
-
hiveAccessToken,
|
835
728
|
hiveUsageAccessToken,
|
836
|
-
hiveTraceAccessToken,
|
837
|
-
hiveTraceEndpoint,
|
838
729
|
hivePersistedDocumentsEndpoint,
|
839
730
|
hivePersistedDocumentsToken,
|
840
731
|
...opts
|
841
732
|
} = this.optsWithGlobals();
|
842
733
|
ctx.log.info(`Starting ${ctx.productName} ${ctx.version} as subgraph`);
|
843
|
-
const openTelemetryEnabledByCLI = await handleOpenTelemetryConfig(ctx, {
|
844
|
-
openTelemetry: opentelemetry,
|
845
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
846
|
-
hiveTarget,
|
847
|
-
hiveTraceAccessToken,
|
848
|
-
hiveTraceEndpoint
|
849
|
-
});
|
850
734
|
const loadedConfig = await loadConfig({
|
851
735
|
log: ctx.log,
|
852
736
|
configPath: opts.configPath,
|
@@ -862,11 +746,8 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
862
746
|
const registryConfig = {};
|
863
747
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
864
748
|
hiveRegistryToken,
|
865
|
-
hiveTarget,
|
866
749
|
hiveUsageTarget,
|
867
|
-
hiveAccessToken,
|
868
750
|
hiveUsageAccessToken,
|
869
|
-
hiveTraceAccessToken,
|
870
751
|
// subgraph can only do reporting to hive registry
|
871
752
|
apolloGraphRef: void 0,
|
872
753
|
apolloKey: void 0
|
@@ -887,8 +768,7 @@ const addCommand$1 = (ctx, cli) => cli.command("subgraph").description(
|
|
887
768
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
888
769
|
{
|
889
770
|
...loadedConfig,
|
890
|
-
...opts
|
891
|
-
openTelemetry: openTelemetryEnabledByCLI ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
771
|
+
...opts
|
892
772
|
},
|
893
773
|
{
|
894
774
|
log: ctx.log,
|
@@ -982,17 +862,11 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
982
862
|
).env("APOLLO_SCHEMA_CONFIG_DELIVERY_ENDPOINT")
|
983
863
|
).action(async function supergraph(schemaPathOrUrl) {
|
984
864
|
const {
|
985
|
-
opentelemetry,
|
986
|
-
opentelemetryExporterType,
|
987
865
|
hiveCdnEndpoint,
|
988
866
|
hiveCdnKey,
|
989
867
|
hiveRegistryToken,
|
990
868
|
hiveUsageTarget,
|
991
|
-
hiveTarget,
|
992
|
-
hiveAccessToken,
|
993
869
|
hiveUsageAccessToken,
|
994
|
-
hiveTraceAccessToken,
|
995
|
-
hiveTraceEndpoint,
|
996
870
|
maskedErrors,
|
997
871
|
apolloGraphRef,
|
998
872
|
apolloKey,
|
@@ -1004,13 +878,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1004
878
|
ctx.log.info(
|
1005
879
|
`Starting ${ctx.productName} ${ctx.version} with supergraph`
|
1006
880
|
);
|
1007
|
-
const openTelemetryEnabledByCLI = await handleOpenTelemetryConfig(ctx, {
|
1008
|
-
openTelemetry: opentelemetry,
|
1009
|
-
openTelemetryExporterType: opentelemetryExporterType,
|
1010
|
-
hiveTarget,
|
1011
|
-
hiveTraceAccessToken,
|
1012
|
-
hiveTraceEndpoint
|
1013
|
-
});
|
1014
881
|
const loadedConfig = await loadConfig({
|
1015
882
|
log: ctx.log,
|
1016
883
|
configPath: opts.configPath,
|
@@ -1096,9 +963,6 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1096
963
|
}
|
1097
964
|
const registryConfig = {};
|
1098
965
|
const reporting = handleReportingConfig(ctx, loadedConfig, {
|
1099
|
-
hiveTarget,
|
1100
|
-
hiveAccessToken,
|
1101
|
-
hiveTraceAccessToken,
|
1102
966
|
hiveRegistryToken,
|
1103
967
|
hiveUsageTarget,
|
1104
968
|
hiveUsageAccessToken,
|
@@ -1121,8 +985,7 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1121
985
|
const builtinPlugins = await getBuiltinPluginsFromConfig(
|
1122
986
|
{
|
1123
987
|
...loadedConfig,
|
1124
|
-
...opts
|
1125
|
-
openTelemetry: openTelemetryEnabledByCLI ? { ...loadedConfig.openTelemetry, traces: true } : loadedConfig.openTelemetry
|
988
|
+
...opts
|
1126
989
|
},
|
1127
990
|
{
|
1128
991
|
log: ctx.log,
|
@@ -1372,57 +1235,27 @@ let cli = new Command().configureHelp({
|
|
1372
1235
|
// see here https://github.com/tj/commander.js/blob/970ecae402b253de691e6a9066fea22f38fe7431/lib/command.js#L655
|
1373
1236
|
// @ts-expect-error
|
1374
1237
|
null
|
1375
|
-
).addOption(
|
1376
|
-
new Option(
|
1377
|
-
"--opentelemetry [exporter-endpoint]",
|
1378
|
-
`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.`
|
1379
|
-
).env("OPENTELEMETRY")
|
1380
|
-
).addOption(
|
1381
|
-
new Option(
|
1382
|
-
"--opentelemetry-exporter-type <type>",
|
1383
|
-
`OpenTelemetry exporter type to use when setting up OpenTelemetry integration. Requires "--opentelemetry" to set the endpoint.`
|
1384
|
-
).choices(["otlp-http", "otlp-grpc"]).default("otlp-http").env("OPENTELEMETRY_EXPORTER_TYPE")
|
1385
1238
|
).addOption(
|
1386
1239
|
new Option(
|
1387
1240
|
"--hive-registry-token <token>",
|
1388
|
-
'[DEPRECATED: please use "--hive-target" and "--hive-access-token"] Hive registry token for usage metrics reporting'
|
1241
|
+
'[DEPRECATED: please use "--hive-usage-target" and "--hive-usage-access-token"] Hive registry token for usage metrics reporting'
|
1389
1242
|
).env("HIVE_REGISTRY_TOKEN")
|
1390
1243
|
).addOption(
|
1391
1244
|
new Option(
|
1392
1245
|
"--hive-usage-target <target>",
|
1393
|
-
|
1246
|
+
'Hive registry target to which the usage data should be reported to. requires the "--hive-usage-access-token <token>" option'
|
1394
1247
|
).env("HIVE_USAGE_TARGET")
|
1395
|
-
).addOption(
|
1396
|
-
new Option(
|
1397
|
-
"--hive-target <target>",
|
1398
|
-
'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'
|
1399
|
-
).env("HIVE_TARGET")
|
1400
|
-
).addOption(
|
1401
|
-
new Option(
|
1402
|
-
"--hive-access-token <token>",
|
1403
|
-
'Hive registry access token for usage metrics reporting and tracing. Enables both usage reporting and tracing. Requires the "--hive-target <target>" option'
|
1404
|
-
).env("HIVE_ACCESS_TOKEN")
|
1405
1248
|
).addOption(
|
1406
1249
|
new Option(
|
1407
1250
|
"--hive-usage-access-token <token>",
|
1408
|
-
|
1251
|
+
'Hive registry access token for usage metrics reporting. requires the "--hive-usage-target <target>" option'
|
1409
1252
|
).env("HIVE_USAGE_ACCESS_TOKEN")
|
1410
|
-
).addOption(
|
1411
|
-
new Option(
|
1412
|
-
"--hive-trace-access-token <token>",
|
1413
|
-
`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"`
|
1414
|
-
).env("HIVE_TRACE_ACCESS_TOKEN")
|
1415
|
-
).addOption(
|
1416
|
-
new Option(
|
1417
|
-
"--hive-trace-endpoint <endpoint>",
|
1418
|
-
`Hive registry tracing endpoint.`
|
1419
|
-
).env("HIVE_TRACE_ENDPOINT").default(`https://api.graphql-hive.com/otel/v1/traces`)
|
1420
1253
|
).option(
|
1421
1254
|
"--hive-persisted-documents-endpoint <endpoint>",
|
1422
|
-
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents.
|
1255
|
+
'[EXPERIMENTAL] Hive CDN endpoint for fetching the persisted documents. requires the "--hive-persisted-documents-token <token>" option'
|
1423
1256
|
).option(
|
1424
1257
|
"--hive-persisted-documents-token <token>",
|
1425
|
-
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token.
|
1258
|
+
'[EXPERIMENTAL] Hive persisted documents CDN endpoint token. requires the "--hive-persisted-documents-endpoint <endpoint>" option'
|
1426
1259
|
).addOption(
|
1427
1260
|
new Option(
|
1428
1261
|
"--hive-cdn-endpoint <endpoint>",
|
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-BQ10GobO.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');
|
@@ -31,7 +31,6 @@ require('node:fs');
|
|
31
31
|
require('node:http');
|
32
32
|
require('node:https');
|
33
33
|
require('@graphql-tools/utils');
|
34
|
-
require('@opentelemetry/sdk-trace-base');
|
35
34
|
require('@graphql-tools/code-file-loader');
|
36
35
|
require('@graphql-tools/graphql-file-loader');
|
37
36
|
require('@graphql-tools/load');
|
package/dist/index.d.cts
CHANGED
@@ -268,15 +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
|
-
hiveTraceEndpoint: string;
|
280
274
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
281
275
|
hivePersistedDocumentsToken?: string | undefined;
|
282
276
|
hiveCdnEndpoint?: string | undefined;
|
@@ -293,15 +287,9 @@ declare function run(userCtx: Partial<CLIContext>): Promise<Command<[], {
|
|
293
287
|
port?: number | undefined;
|
294
288
|
polling?: number | undefined;
|
295
289
|
maskedErrors: string | boolean | string[] | [];
|
296
|
-
opentelemetry?: string | true | undefined;
|
297
|
-
opentelemetryExporterType: "otlp-http" | "otlp-grpc";
|
298
290
|
hiveRegistryToken?: string | undefined;
|
299
291
|
hiveUsageTarget?: string | undefined;
|
300
|
-
hiveTarget?: string | undefined;
|
301
|
-
hiveAccessToken?: string | undefined;
|
302
292
|
hiveUsageAccessToken?: string | undefined;
|
303
|
-
hiveTraceAccessToken?: string | undefined;
|
304
|
-
hiveTraceEndpoint: string;
|
305
293
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
306
294
|
hivePersistedDocumentsToken?: string | undefined;
|
307
295
|
hiveCdnEndpoint?: string | undefined;
|
package/dist/index.d.ts
CHANGED
@@ -268,15 +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
|
-
hiveTraceEndpoint: string;
|
280
274
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
281
275
|
hivePersistedDocumentsToken?: string | undefined;
|
282
276
|
hiveCdnEndpoint?: string | undefined;
|
@@ -293,15 +287,9 @@ declare function run(userCtx: Partial<CLIContext>): Promise<Command<[], {
|
|
293
287
|
port?: number | undefined;
|
294
288
|
polling?: number | undefined;
|
295
289
|
maskedErrors: string | boolean | string[] | [];
|
296
|
-
opentelemetry?: string | true | undefined;
|
297
|
-
opentelemetryExporterType: "otlp-http" | "otlp-grpc";
|
298
290
|
hiveRegistryToken?: string | undefined;
|
299
291
|
hiveUsageTarget?: string | undefined;
|
300
|
-
hiveTarget?: string | undefined;
|
301
|
-
hiveAccessToken?: string | undefined;
|
302
292
|
hiveUsageAccessToken?: string | undefined;
|
303
|
-
hiveTraceAccessToken?: string | undefined;
|
304
|
-
hiveTraceEndpoint: string;
|
305
293
|
hivePersistedDocumentsEndpoint?: string | undefined;
|
306
294
|
hivePersistedDocumentsToken?: string | undefined;
|
307
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-CpJrCTMy.js';
|
2
2
|
export * from '@graphql-hive/logger';
|
3
3
|
export * from '@graphql-hive/gateway-runtime';
|
4
4
|
export { PubSub } from '@graphql-hive/pubsub';
|
@@ -30,7 +30,6 @@ import 'node:fs';
|
|
30
30
|
import 'node:http';
|
31
31
|
import 'node:https';
|
32
32
|
import '@graphql-tools/utils';
|
33
|
-
import '@opentelemetry/sdk-trace-base';
|
34
33
|
import '@graphql-tools/code-file-loader';
|
35
34
|
import '@graphql-tools/graphql-file-loader';
|
36
35
|
import '@graphql-tools/load';
|
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-d672d11878c307e7a0fd28512903cb25f048a83f",
|
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.1-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-d672d11878c307e7a0fd28512903cb25f048a83f",
|
57
|
+
"@graphql-hive/importer": "2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
58
|
+
"@graphql-hive/logger": "1.0.1-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
59
|
+
"@graphql-hive/plugin-aws-sigv4": "2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
60
|
+
"@graphql-hive/plugin-deduplicate-request": "2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
61
|
+
"@graphql-hive/pubsub": "2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
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-d672d11878c307e7a0fd28512903cb25f048a83f",
|
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-d672d11878c307e7a0fd28512903cb25f048a83f",
|
71
|
+
"@graphql-mesh/plugin-opentelemetry": "2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
72
|
+
"@graphql-mesh/plugin-prometheus": "2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
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-d672d11878c307e7a0fd28512903cb25f048a83f",
|
76
|
+
"@graphql-mesh/transport-http-callback": "1.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
77
|
+
"@graphql-mesh/transport-ws": "2.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
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.15.1",
|
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": "^17.2.0",
|
100
98
|
"graphql-ws": "^6.0.4",
|
@@ -103,7 +101,7 @@
|
|
103
101
|
"ws": "^8.18.3"
|
104
102
|
},
|
105
103
|
"devDependencies": {
|
106
|
-
"@graphql-mesh/transport-common": "1.0.0-alpha-
|
104
|
+
"@graphql-mesh/transport-common": "1.0.0-alpha-d672d11878c307e7a0fd28512903cb25f048a83f",
|
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",
|