@graphql-hive/plugin-opentelemetry 1.3.0-alpha-890e2341fd5496d95ff75411a0fd8c717d6639ed → 1.3.0-alpha-64ccb74c470e010e18f890a3fd4afc34094275a7
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 +24 -7
- package/dist/attributes-BjUFTXMN.d.ts +16 -0
- package/dist/index.cjs +15 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/{plugin-CqZ6vopT.cjs → plugin-BRkOARbT.cjs} +199 -61
- package/dist/{plugin-Bp3r09vK.js → plugin-DXgE1GBh.js} +163 -39
- package/dist/setup.cjs +19 -23
- package/dist/setup.d.cts +2 -2
- package/dist/setup.d.ts +2 -2
- package/dist/setup.js +6 -16
- package/package.json +4 -13
- package/dist/attributes.cjs +0 -69
- package/dist/attributes.d.cts +0 -12
- package/dist/attributes.d.ts +0 -12
- package/dist/attributes.js +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @graphql-hive/plugin-opentelemetry
|
|
2
2
|
|
|
3
|
-
## 1.3.0-alpha-
|
|
3
|
+
## 1.3.0-alpha-64ccb74c470e010e18f890a3fd4afc34094275a7
|
|
4
4
|
### Minor Changes
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,16 +9,33 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
- [#
|
|
13
|
-
specific attributes. This was already exposed by the default entrypoint, but it now also has its own one.
|
|
12
|
+
- [#1636](https://github.com/graphql-hive/gateway/pull/1636) [`bdb8517`](https://github.com/graphql-hive/gateway/commit/bdb8517788aa416d7de441d90f849b181c2d11d8) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Expose GraphQLError as OpenTelemetry Events.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Errors contains in the result of a graphql operation are now reported as standalone OpenTelemetry
|
|
15
|
+
Events (name `graphql.error`) instead of OpenTelemetry Exceptions.
|
|
16
|
+
|
|
17
|
+
This is aligned with the guidance of the Graphql OpenTelemetry working group.
|
|
18
|
+
|
|
19
|
+
It allows to add more graphql specific attributes to errors reported in a response:
|
|
20
|
+
|
|
21
|
+
- `message`: The error message
|
|
22
|
+
- `path`: The path in the operation document from which the error originated
|
|
23
|
+
- `locations`: The list of related locations in the document source
|
|
24
|
+
- `coordinate`: The schema coordinate of the resolver which is the source of the error
|
|
25
|
+
|
|
26
|
+
This brings the experimental support of the `coordinate` error attribute in the Yoga Runtime. For
|
|
27
|
+
security reason, this attribute is purposefully not serialized, to avoid leaking schema information
|
|
28
|
+
to clients.
|
|
17
29
|
|
|
18
30
|
### Patch Changes
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
- [#1636](https://github.com/graphql-hive/gateway/pull/1636) [`a71b9f0`](https://github.com/graphql-hive/gateway/commit/a71b9f0a80e0d3c30b40593d8f79547f349a34bd) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
|
35
|
+
|
|
36
|
+
- Added dependency [`@graphql-tools/executor@^1.4.9` ↗︎](https://www.npmjs.com/package/@graphql-tools/executor/v/1.4.9) (to `dependencies`)
|
|
37
|
+
- Updated dependencies [[`31fe4be`](https://github.com/graphql-hive/gateway/commit/31fe4be41532db18a66b30eeb9272a6e536d8a89), [`15b9e50`](https://github.com/graphql-hive/gateway/commit/15b9e5037fa74f8c1a8e662e196268a88642c27d), [`abd350b`](https://github.com/graphql-hive/gateway/commit/abd350b913c8938cf173a4a5e25b3ba6c04016fc), [`bdb8517`](https://github.com/graphql-hive/gateway/commit/bdb8517788aa416d7de441d90f849b181c2d11d8), [`a50d93a`](https://github.com/graphql-hive/gateway/commit/a50d93a0bc8f3c67de7449ad9102d3f3b60ea96a)]:
|
|
38
|
+
- @graphql-hive/gateway-runtime@2.5.0-alpha-64ccb74c470e010e18f890a3fd4afc34094275a7
|
|
22
39
|
|
|
23
40
|
## 1.2.5
|
|
24
41
|
### Patch Changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const SEMATTRS_GRAPHQL_DOCUMENT = "graphql.document";
|
|
2
|
+
declare const SEMATTRS_GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
|
|
3
|
+
declare const SEMATTRS_GRAPHQL_OPERATION_NAME = "graphql.operation.name";
|
|
4
|
+
declare const SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = "hive.graphql.operation.hash";
|
|
5
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = "hive.graphql.error.count";
|
|
6
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = "hive.graphql.error.codes";
|
|
7
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES = "hive.graphql.error.coordinates";
|
|
8
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_CODE = "hive.graphql.error.code";
|
|
9
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE = "hive.graphql.error.coordinate";
|
|
10
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_PATH = "hive.graphql.error.path";
|
|
11
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE = "hive.graphql.error.message";
|
|
12
|
+
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS = "hive.graphql.error.locations";
|
|
13
|
+
declare const SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = "hive.gateway.upstream.subgraph.name";
|
|
14
|
+
declare const SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = "hive.gateway.operation.subgraph.names";
|
|
15
|
+
|
|
16
|
+
export { SEMATTRS_GRAPHQL_DOCUMENT as S, SEMATTRS_GRAPHQL_OPERATION_TYPE as a, SEMATTRS_GRAPHQL_OPERATION_NAME as b, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH as c, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT as d, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES as e, SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES as f, SEMATTRS_HIVE_GRAPHQL_ERROR_CODE as g, SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE as h, SEMATTRS_HIVE_GRAPHQL_ERROR_PATH as i, SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE as j, SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS as k, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME as l, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES as m };
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var plugin = require('./plugin-
|
|
3
|
+
var plugin = require('./plugin-BRkOARbT.cjs');
|
|
4
4
|
var api = require('@opentelemetry/api');
|
|
5
|
-
var attributes = require('./attributes.cjs');
|
|
6
5
|
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
7
6
|
require('@graphql-hive/gateway-runtime');
|
|
8
7
|
require('@graphql-mesh/utils');
|
|
@@ -15,19 +14,25 @@ require('graphql');
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
17
|
+
exports.SEMATTRS_GRAPHQL_DOCUMENT = plugin.SEMATTRS_GRAPHQL_DOCUMENT;
|
|
18
|
+
exports.SEMATTRS_GRAPHQL_OPERATION_NAME = plugin.SEMATTRS_GRAPHQL_OPERATION_NAME;
|
|
19
|
+
exports.SEMATTRS_GRAPHQL_OPERATION_TYPE = plugin.SEMATTRS_GRAPHQL_OPERATION_TYPE;
|
|
20
|
+
exports.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = plugin.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES;
|
|
21
|
+
exports.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = plugin.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME;
|
|
22
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODE = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_CODE;
|
|
23
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES;
|
|
24
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT;
|
|
25
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS;
|
|
26
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE;
|
|
27
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_PATH = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_PATH;
|
|
28
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE;
|
|
29
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES;
|
|
30
|
+
exports.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = plugin.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH;
|
|
18
31
|
exports.useOpenTelemetry = plugin.useOpenTelemetry;
|
|
19
32
|
Object.defineProperty(exports, "OpenTelemetryDiagLogLevel", {
|
|
20
33
|
enumerable: true,
|
|
21
34
|
get: function () { return api.DiagLogLevel; }
|
|
22
35
|
});
|
|
23
|
-
exports.SEMATTRS_GRAPHQL_DOCUMENT = attributes.SEMATTRS_GRAPHQL_DOCUMENT;
|
|
24
|
-
exports.SEMATTRS_GRAPHQL_OPERATION_NAME = attributes.SEMATTRS_GRAPHQL_OPERATION_NAME;
|
|
25
|
-
exports.SEMATTRS_GRAPHQL_OPERATION_TYPE = attributes.SEMATTRS_GRAPHQL_OPERATION_TYPE;
|
|
26
|
-
exports.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = attributes.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES;
|
|
27
|
-
exports.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = attributes.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME;
|
|
28
|
-
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = attributes.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES;
|
|
29
|
-
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = attributes.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT;
|
|
30
|
-
exports.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = attributes.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH;
|
|
31
36
|
Object.defineProperty(exports, "ATTR_SERVICE_NAME", {
|
|
32
37
|
enumerable: true,
|
|
33
38
|
get: function () { return semanticConventions.ATTR_SERVICE_NAME; }
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { O as OpenTelemetryContextExtension, a as OpenTelemetryGatewayPluginOptions, b as OpenTelemetryPlugin, c as OpenTelemetryPluginUtils, u as useOpenTelemetry } from './plugin-BBy_tfA5.js';
|
|
2
2
|
export { DiagLogLevel as OpenTelemetryDiagLogLevel } from '@opentelemetry/api';
|
|
3
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes.
|
|
3
|
+
export { S as SEMATTRS_GRAPHQL_DOCUMENT, b as SEMATTRS_GRAPHQL_OPERATION_NAME, a as SEMATTRS_GRAPHQL_OPERATION_TYPE, m as SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, l as SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, g as SEMATTRS_HIVE_GRAPHQL_ERROR_CODE, e as SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, d as SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, k as SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS, j as SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE, i as SEMATTRS_HIVE_GRAPHQL_ERROR_PATH, h as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE, f as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES, c as SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes-BjUFTXMN.js';
|
|
4
4
|
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
5
5
|
import '@graphql-hive/gateway-runtime';
|
|
6
6
|
import '@graphql-tools/utils';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { O as OpenTelemetryContextExtension, a as OpenTelemetryGatewayPluginOptions, b as OpenTelemetryPlugin, c as OpenTelemetryPluginUtils, u as useOpenTelemetry } from './plugin-BBy_tfA5.js';
|
|
2
2
|
export { DiagLogLevel as OpenTelemetryDiagLogLevel } from '@opentelemetry/api';
|
|
3
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes.js';
|
|
3
|
+
export { S as SEMATTRS_GRAPHQL_DOCUMENT, b as SEMATTRS_GRAPHQL_OPERATION_NAME, a as SEMATTRS_GRAPHQL_OPERATION_TYPE, m as SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, l as SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, g as SEMATTRS_HIVE_GRAPHQL_ERROR_CODE, e as SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, d as SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, k as SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS, j as SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE, i as SEMATTRS_HIVE_GRAPHQL_ERROR_PATH, h as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE, f as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES, c as SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes-BjUFTXMN.js';
|
|
4
4
|
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
5
5
|
import '@graphql-hive/gateway-runtime';
|
|
6
6
|
import '@graphql-tools/utils';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { u as useOpenTelemetry } from './plugin-
|
|
1
|
+
export { S as SEMATTRS_GRAPHQL_DOCUMENT, b as SEMATTRS_GRAPHQL_OPERATION_NAME, a as SEMATTRS_GRAPHQL_OPERATION_TYPE, m as SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, l as SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, g as SEMATTRS_HIVE_GRAPHQL_ERROR_CODE, e as SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, d as SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, k as SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS, j as SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE, i as SEMATTRS_HIVE_GRAPHQL_ERROR_PATH, h as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE, f as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES, c as SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH, u as useOpenTelemetry } from './plugin-DXgE1GBh.js';
|
|
2
2
|
export { DiagLogLevel as OpenTelemetryDiagLogLevel } from '@opentelemetry/api';
|
|
3
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes.js';
|
|
4
3
|
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
5
4
|
import '@graphql-hive/gateway-runtime';
|
|
6
5
|
import '@graphql-mesh/utils';
|
|
@@ -3,14 +3,21 @@
|
|
|
3
3
|
var gatewayRuntime = require('@graphql-hive/gateway-runtime');
|
|
4
4
|
var utils$1 = require('@graphql-mesh/utils');
|
|
5
5
|
var utils = require('@graphql-tools/utils');
|
|
6
|
-
var
|
|
6
|
+
var require$$2 = require('@whatwg-node/promise-helpers');
|
|
7
7
|
var api$1 = require('./api.cjs');
|
|
8
8
|
var api = require('@opentelemetry/api');
|
|
9
9
|
var core = require('@graphql-hive/core');
|
|
10
10
|
var transportCommon = require('@graphql-mesh/transport-common');
|
|
11
11
|
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
12
12
|
var graphql = require('graphql');
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
function useErrorCoordinate() {
|
|
15
|
+
return {
|
|
16
|
+
onExecute({ args }) {
|
|
17
|
+
args.schemaCoordinateInErrors = true;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
14
21
|
|
|
15
22
|
class OtelContextStack {
|
|
16
23
|
#root;
|
|
@@ -119,6 +126,21 @@ function getRetryInfo(executionRequest) {
|
|
|
119
126
|
return executionRequest[RETRY_SYMBOL];
|
|
120
127
|
}
|
|
121
128
|
|
|
129
|
+
const SEMATTRS_GRAPHQL_DOCUMENT = "graphql.document";
|
|
130
|
+
const SEMATTRS_GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
|
|
131
|
+
const SEMATTRS_GRAPHQL_OPERATION_NAME = "graphql.operation.name";
|
|
132
|
+
const SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = "hive.graphql.operation.hash";
|
|
133
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = "hive.graphql.error.count";
|
|
134
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = "hive.graphql.error.codes";
|
|
135
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES = "hive.graphql.error.coordinates";
|
|
136
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_CODE = "hive.graphql.error.code";
|
|
137
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE = "hive.graphql.error.coordinate";
|
|
138
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_PATH = "hive.graphql.error.path";
|
|
139
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE = "hive.graphql.error.message";
|
|
140
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS = "hive.graphql.error.locations";
|
|
141
|
+
const SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = "hive.gateway.upstream.subgraph.name";
|
|
142
|
+
const SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = "hive.gateway.operation.subgraph.names";
|
|
143
|
+
|
|
122
144
|
function createHttpSpan(input) {
|
|
123
145
|
const { url, request, tracer } = input;
|
|
124
146
|
const span = tracer.startSpan(
|
|
@@ -172,9 +194,9 @@ function setParamsAttributes(input) {
|
|
|
172
194
|
if (!span) {
|
|
173
195
|
return;
|
|
174
196
|
}
|
|
175
|
-
span.setAttribute(
|
|
197
|
+
span.setAttribute(SEMATTRS_GRAPHQL_DOCUMENT, params.query ?? "<undefined>");
|
|
176
198
|
if (params.operationName) {
|
|
177
|
-
span.setAttribute(
|
|
199
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_NAME, params.operationName);
|
|
178
200
|
}
|
|
179
201
|
}
|
|
180
202
|
const typeInfos = /* @__PURE__ */ new WeakMap();
|
|
@@ -196,13 +218,13 @@ function setDocumentAttributesOnOperationSpan(input) {
|
|
|
196
218
|
const { ctx, document } = input;
|
|
197
219
|
const span = api.trace.getSpan(ctx);
|
|
198
220
|
if (span) {
|
|
199
|
-
span.setAttribute(
|
|
221
|
+
span.setAttribute(SEMATTRS_GRAPHQL_DOCUMENT, transportCommon.defaultPrintFn(document));
|
|
200
222
|
const operation = getOperationFromDocument(document, input.operationName);
|
|
201
223
|
if (operation) {
|
|
202
|
-
span.setAttribute(
|
|
224
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_TYPE, operation.operation);
|
|
203
225
|
const operationName = operation.name?.value;
|
|
204
226
|
if (operationName) {
|
|
205
|
-
span.setAttribute(
|
|
227
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_NAME, operationName);
|
|
206
228
|
span.updateName(`graphql.operation ${operationName}`);
|
|
207
229
|
}
|
|
208
230
|
}
|
|
@@ -232,18 +254,38 @@ function setGraphQLParseAttributes(input) {
|
|
|
232
254
|
return;
|
|
233
255
|
}
|
|
234
256
|
if (input.query) {
|
|
235
|
-
span.setAttribute(
|
|
257
|
+
span.setAttribute(SEMATTRS_GRAPHQL_DOCUMENT, input.query);
|
|
236
258
|
}
|
|
237
259
|
if (input.result instanceof Error) {
|
|
238
|
-
|
|
260
|
+
if (isGraphQLError(input.result)) {
|
|
261
|
+
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, 1);
|
|
262
|
+
span.setStatus({
|
|
263
|
+
code: api.SpanStatusCode.ERROR,
|
|
264
|
+
message: "GraphQL Parse Error"
|
|
265
|
+
});
|
|
266
|
+
const operationSpan = api.trace.getSpan(input.operationCtx);
|
|
267
|
+
if (operationSpan) {
|
|
268
|
+
recordGraphqlErrors(
|
|
269
|
+
operationSpan,
|
|
270
|
+
[input.result],
|
|
271
|
+
"GraphQL Parse Error"
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
span.recordException(input.result);
|
|
276
|
+
span.setStatus({
|
|
277
|
+
code: api.SpanStatusCode.ERROR,
|
|
278
|
+
message: input.result.message
|
|
279
|
+
});
|
|
280
|
+
}
|
|
239
281
|
} else {
|
|
240
282
|
const document = input.result;
|
|
241
283
|
const operation = getOperationFromDocument(document, input.operationName);
|
|
242
284
|
if (operation) {
|
|
243
|
-
span.setAttribute(
|
|
285
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_TYPE, operation.operation);
|
|
244
286
|
const operationName = operation.name?.value;
|
|
245
287
|
if (operationName) {
|
|
246
|
-
span.setAttribute(
|
|
288
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_NAME, operationName);
|
|
247
289
|
}
|
|
248
290
|
}
|
|
249
291
|
}
|
|
@@ -265,30 +307,43 @@ function setGraphQLValidateAttributes(input) {
|
|
|
265
307
|
const operation = getOperationFromDocument(document, input.operationName);
|
|
266
308
|
if (operation) {
|
|
267
309
|
const operationName = operation.name?.value;
|
|
268
|
-
span.setAttribute(
|
|
310
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_TYPE, operation.operation);
|
|
269
311
|
if (operationName) {
|
|
270
|
-
span.setAttribute(
|
|
312
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_NAME, operationName);
|
|
271
313
|
}
|
|
272
314
|
}
|
|
273
315
|
const errors = Array.isArray(result) ? result : [];
|
|
274
316
|
if (result instanceof Error) {
|
|
275
317
|
errors.push(result);
|
|
276
318
|
}
|
|
277
|
-
if (errors.length
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
319
|
+
if (errors.length === 0) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const graphqlErrors = [];
|
|
323
|
+
const exceptions = [];
|
|
324
|
+
for (const error of errors) {
|
|
325
|
+
(isGraphQLError(error) ? graphqlErrors : exceptions).push(error);
|
|
326
|
+
}
|
|
327
|
+
if (graphqlErrors.length > 0) {
|
|
328
|
+
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, result.length);
|
|
329
|
+
const operationSpan = api.trace.getSpan(input.operationCtx);
|
|
330
|
+
if (operationSpan) {
|
|
331
|
+
recordGraphqlErrors(
|
|
332
|
+
operationSpan,
|
|
333
|
+
graphqlErrors,
|
|
334
|
+
"GraphQL Validation Error"
|
|
335
|
+
);
|
|
289
336
|
}
|
|
290
|
-
span.setAttribute(attributes.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, codes);
|
|
291
337
|
}
|
|
338
|
+
if (exceptions.length > 0) {
|
|
339
|
+
for (const exception of exceptions) {
|
|
340
|
+
span.recordException(exception);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
span.setStatus({
|
|
344
|
+
code: api.SpanStatusCode.ERROR,
|
|
345
|
+
message: "GraphQL Validation Error"
|
|
346
|
+
});
|
|
292
347
|
}
|
|
293
348
|
function createGraphQLExecuteSpan(input) {
|
|
294
349
|
const span = input.tracer.startSpan(
|
|
@@ -309,7 +364,7 @@ function setGraphQLExecutionAttributes(input) {
|
|
|
309
364
|
if (operationSpan) {
|
|
310
365
|
const hash = hashOperationFn?.({ ...args });
|
|
311
366
|
if (hash) {
|
|
312
|
-
operationSpan.setAttribute(
|
|
367
|
+
operationSpan.setAttribute(SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH, hash);
|
|
313
368
|
}
|
|
314
369
|
}
|
|
315
370
|
const span = api.trace.getSpan(ctx);
|
|
@@ -320,40 +375,37 @@ function setGraphQLExecutionAttributes(input) {
|
|
|
320
375
|
args.document,
|
|
321
376
|
args.operationName
|
|
322
377
|
);
|
|
323
|
-
span.setAttribute(
|
|
378
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_TYPE, operation.operation);
|
|
324
379
|
const operationName = operation.name?.value;
|
|
325
380
|
if (operationName) {
|
|
326
|
-
span.setAttribute(
|
|
381
|
+
span.setAttribute(SEMATTRS_GRAPHQL_OPERATION_NAME, operationName);
|
|
327
382
|
}
|
|
328
383
|
}
|
|
329
384
|
function setGraphQLExecutionResultAttributes(input) {
|
|
330
|
-
const { ctx, result } = input;
|
|
385
|
+
const { ctx, operationCtx, result } = input;
|
|
331
386
|
const span = api.trace.getSpan(ctx);
|
|
332
|
-
if (
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
);
|
|
387
|
+
if (span) {
|
|
388
|
+
if (input.subgraphNames?.length) {
|
|
389
|
+
span.setAttribute(
|
|
390
|
+
SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES,
|
|
391
|
+
input.subgraphNames
|
|
392
|
+
);
|
|
393
|
+
}
|
|
340
394
|
}
|
|
395
|
+
const operationSpan = api.trace.getSpan(operationCtx);
|
|
341
396
|
if (!utils.isAsyncIterable(result) && // FIXME: Handle async iterable too
|
|
342
397
|
result.errors && result.errors.length > 0) {
|
|
343
|
-
span
|
|
344
|
-
span
|
|
398
|
+
span?.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, result.errors.length);
|
|
399
|
+
span?.setStatus({
|
|
345
400
|
code: api.SpanStatusCode.ERROR,
|
|
346
|
-
message:
|
|
401
|
+
message: "GraphQL Execution Error"
|
|
347
402
|
});
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
if (codes.length > 0) {
|
|
356
|
-
span.setAttribute(attributes.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, codes);
|
|
403
|
+
if (operationSpan) {
|
|
404
|
+
recordGraphqlErrors(
|
|
405
|
+
operationSpan,
|
|
406
|
+
result.errors,
|
|
407
|
+
"GraphQL Execution Error"
|
|
408
|
+
);
|
|
357
409
|
}
|
|
358
410
|
}
|
|
359
411
|
}
|
|
@@ -366,12 +418,12 @@ function createSubgraphExecuteSpan(input) {
|
|
|
366
418
|
`subgraph.execute (${input.subgraphName})`,
|
|
367
419
|
{
|
|
368
420
|
attributes: {
|
|
369
|
-
[
|
|
370
|
-
[
|
|
421
|
+
[SEMATTRS_GRAPHQL_OPERATION_NAME]: operation.name?.value,
|
|
422
|
+
[SEMATTRS_GRAPHQL_DOCUMENT]: transportCommon.defaultPrintFn(
|
|
371
423
|
input.executionRequest.document
|
|
372
424
|
),
|
|
373
|
-
[
|
|
374
|
-
[
|
|
425
|
+
[SEMATTRS_GRAPHQL_OPERATION_TYPE]: operation.operation,
|
|
426
|
+
[SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME]: input.subgraphName
|
|
375
427
|
},
|
|
376
428
|
kind: api.SpanKind.CLIENT
|
|
377
429
|
},
|
|
@@ -498,6 +550,70 @@ const getOperationFromDocument = (document, operationName) => {
|
|
|
498
550
|
operationNameMap.set(operationName ?? null, operation);
|
|
499
551
|
return operation;
|
|
500
552
|
};
|
|
553
|
+
function recordGraphqlErrors(span, errors, message) {
|
|
554
|
+
const codes = [];
|
|
555
|
+
const schemaCoordinates = [];
|
|
556
|
+
span.setStatus({
|
|
557
|
+
code: api.SpanStatusCode.ERROR,
|
|
558
|
+
message: message ?? "GraphQL Error"
|
|
559
|
+
});
|
|
560
|
+
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, errors.length);
|
|
561
|
+
for (const error of errors) {
|
|
562
|
+
const attributes = attributesFromGraphqlError(error);
|
|
563
|
+
if (attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_CODE]) {
|
|
564
|
+
codes.push(attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_CODE]);
|
|
565
|
+
}
|
|
566
|
+
if (attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE]) {
|
|
567
|
+
schemaCoordinates.push(
|
|
568
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE]
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
span.addEvent("graphql.error", attributes);
|
|
572
|
+
}
|
|
573
|
+
if (codes.length > 0) {
|
|
574
|
+
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, codes);
|
|
575
|
+
}
|
|
576
|
+
if (schemaCoordinates.length > 0) {
|
|
577
|
+
span.setAttribute(
|
|
578
|
+
SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES,
|
|
579
|
+
schemaCoordinates
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
function attributesFromGraphqlError(error) {
|
|
584
|
+
const attributes = {
|
|
585
|
+
[SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE]: error.message
|
|
586
|
+
};
|
|
587
|
+
if (error.path) {
|
|
588
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_PATH] = error.path.map(
|
|
589
|
+
(p) => p.toString()
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
if (error.locations) {
|
|
593
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS] = error.locations.map(
|
|
594
|
+
({ line, column }) => `${line}:${column}`
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
if (error.extensions) {
|
|
598
|
+
const code = error.extensions?.["code"];
|
|
599
|
+
if (code) {
|
|
600
|
+
const codeStr = `${code}`;
|
|
601
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_CODE] = codeStr;
|
|
602
|
+
}
|
|
603
|
+
const schemaCoordinate = utils.getSchemaCoordinate(error);
|
|
604
|
+
if (schemaCoordinate) {
|
|
605
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE] = schemaCoordinate;
|
|
606
|
+
}
|
|
607
|
+
const originalError = error.extensions["originalError"];
|
|
608
|
+
if (originalError?.stack) {
|
|
609
|
+
attributes[semanticConventions.ATTR_EXCEPTION_STACKTRACE] = originalError.stack;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return attributes;
|
|
613
|
+
}
|
|
614
|
+
function isGraphQLError(error) {
|
|
615
|
+
return !error.name || error.name === "GraphQLError";
|
|
616
|
+
}
|
|
501
617
|
|
|
502
618
|
function getEnvStr(key, opts = {}) {
|
|
503
619
|
const globalThat = opts.globalThis ?? globalThis;
|
|
@@ -632,7 +748,7 @@ function useOpenTelemetry(options) {
|
|
|
632
748
|
},
|
|
633
749
|
instrumentation: {
|
|
634
750
|
request({ state: { forRequest }, request }, wrapped) {
|
|
635
|
-
return
|
|
751
|
+
return require$$2.unfakePromise(
|
|
636
752
|
preparation$.then(() => {
|
|
637
753
|
if (!traces || !shouldTrace(traces.spans?.http, { request, ignoredRequests })) {
|
|
638
754
|
return wrapped();
|
|
@@ -663,7 +779,7 @@ function useOpenTelemetry(options) {
|
|
|
663
779
|
if (!traces || !isParentEnabled(parentState) || !shouldTrace(traces.spans?.graphql, { context: gqlCtx })) {
|
|
664
780
|
return wrapped();
|
|
665
781
|
}
|
|
666
|
-
return
|
|
782
|
+
return require$$2.unfakePromise(
|
|
667
783
|
preparation$.then(() => {
|
|
668
784
|
const ctx = getContext(parentState);
|
|
669
785
|
forOperation.otel = new OtelContextStack(
|
|
@@ -718,7 +834,9 @@ function useOpenTelemetry(options) {
|
|
|
718
834
|
try {
|
|
719
835
|
wrapped();
|
|
720
836
|
} catch (err) {
|
|
721
|
-
|
|
837
|
+
if (err instanceof Error && !isGraphQLError(err)) {
|
|
838
|
+
registerException(forOperation.otel.current, err);
|
|
839
|
+
}
|
|
722
840
|
throw err;
|
|
723
841
|
} finally {
|
|
724
842
|
api.trace.getSpan(forOperation.otel.current)?.end();
|
|
@@ -757,7 +875,7 @@ function useOpenTelemetry(options) {
|
|
|
757
875
|
if (useContextManager) {
|
|
758
876
|
wrapped = api.context.bind(forOperation.otel.current, wrapped);
|
|
759
877
|
}
|
|
760
|
-
return
|
|
878
|
+
return require$$2.unfakePromise(
|
|
761
879
|
utils.fakePromise().then(wrapped).catch((err) => {
|
|
762
880
|
registerException(forOperation.otel.current, err);
|
|
763
881
|
throw err;
|
|
@@ -794,7 +912,7 @@ function useOpenTelemetry(options) {
|
|
|
794
912
|
if (useContextManager) {
|
|
795
913
|
wrapped = api.context.bind(forSubgraphExecution.otel.current, wrapped);
|
|
796
914
|
}
|
|
797
|
-
return
|
|
915
|
+
return require$$2.unfakePromise(
|
|
798
916
|
utils.fakePromise().then(wrapped).catch((err) => {
|
|
799
917
|
registerException(forSubgraphExecution.otel.current, err);
|
|
800
918
|
throw err;
|
|
@@ -808,7 +926,7 @@ function useOpenTelemetry(options) {
|
|
|
808
926
|
if (gatewayRuntime.isRetryExecutionRequest(executionRequest)) {
|
|
809
927
|
state = getState(gatewayRuntime.getRetryInfo(executionRequest));
|
|
810
928
|
}
|
|
811
|
-
return
|
|
929
|
+
return require$$2.unfakePromise(
|
|
812
930
|
preparation$.then(() => {
|
|
813
931
|
if (!traces || !isParentEnabled(state) || !shouldTrace(traces.spans?.upstreamFetch, { executionRequest })) {
|
|
814
932
|
return wrapped();
|
|
@@ -833,7 +951,7 @@ function useOpenTelemetry(options) {
|
|
|
833
951
|
);
|
|
834
952
|
},
|
|
835
953
|
schema(_, wrapped) {
|
|
836
|
-
return
|
|
954
|
+
return require$$2.unfakePromise(
|
|
837
955
|
preparation$.then(() => {
|
|
838
956
|
if (!traces || !shouldTrace(traces.spans?.schema, null)) {
|
|
839
957
|
return wrapped();
|
|
@@ -851,6 +969,9 @@ function useOpenTelemetry(options) {
|
|
|
851
969
|
);
|
|
852
970
|
}
|
|
853
971
|
},
|
|
972
|
+
onPluginInit({ addPlugin }) {
|
|
973
|
+
addPlugin(useErrorCoordinate());
|
|
974
|
+
},
|
|
854
975
|
onYogaInit({ yoga }) {
|
|
855
976
|
pluginLogger ??= new gatewayRuntime.Logger({
|
|
856
977
|
writers: [
|
|
@@ -943,6 +1064,7 @@ function useOpenTelemetry(options) {
|
|
|
943
1064
|
return ({ result }) => {
|
|
944
1065
|
setGraphQLParseAttributes({
|
|
945
1066
|
ctx: getContext(state),
|
|
1067
|
+
operationCtx: state.forOperation.otel.root,
|
|
946
1068
|
operationName: gqlCtx.params.operationName,
|
|
947
1069
|
query: gqlCtx.params.query?.trim(),
|
|
948
1070
|
result
|
|
@@ -963,6 +1085,7 @@ function useOpenTelemetry(options) {
|
|
|
963
1085
|
return ({ result }) => {
|
|
964
1086
|
setGraphQLValidateAttributes({
|
|
965
1087
|
ctx: getContext(state),
|
|
1088
|
+
operationCtx: state.forOperation.otel.root,
|
|
966
1089
|
result,
|
|
967
1090
|
document: params.documentAST,
|
|
968
1091
|
operationName: gqlCtx.params.operationName
|
|
@@ -986,6 +1109,7 @@ function useOpenTelemetry(options) {
|
|
|
986
1109
|
setGraphQLExecutionResultAttributes({
|
|
987
1110
|
ctx,
|
|
988
1111
|
result,
|
|
1112
|
+
operationCtx: state.forOperation.otel.root,
|
|
989
1113
|
subgraphNames: state.forOperation.subgraphNames
|
|
990
1114
|
});
|
|
991
1115
|
}
|
|
@@ -1093,6 +1217,20 @@ function resolveTracesConfig(options, useContextManager, log) {
|
|
|
1093
1217
|
return traces;
|
|
1094
1218
|
}
|
|
1095
1219
|
|
|
1220
|
+
exports.SEMATTRS_GRAPHQL_DOCUMENT = SEMATTRS_GRAPHQL_DOCUMENT;
|
|
1221
|
+
exports.SEMATTRS_GRAPHQL_OPERATION_NAME = SEMATTRS_GRAPHQL_OPERATION_NAME;
|
|
1222
|
+
exports.SEMATTRS_GRAPHQL_OPERATION_TYPE = SEMATTRS_GRAPHQL_OPERATION_TYPE;
|
|
1223
|
+
exports.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES;
|
|
1224
|
+
exports.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME;
|
|
1225
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODE = SEMATTRS_HIVE_GRAPHQL_ERROR_CODE;
|
|
1226
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = SEMATTRS_HIVE_GRAPHQL_ERROR_CODES;
|
|
1227
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT;
|
|
1228
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS = SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS;
|
|
1229
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE = SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE;
|
|
1230
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_PATH = SEMATTRS_HIVE_GRAPHQL_ERROR_PATH;
|
|
1231
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE = SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE;
|
|
1232
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES = SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES;
|
|
1233
|
+
exports.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH;
|
|
1096
1234
|
exports.diagLogLevelFromEnv = diagLogLevelFromEnv;
|
|
1097
1235
|
exports.getEnvBool = getEnvBool;
|
|
1098
1236
|
exports.getEnvStr = getEnvStr;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { isRetryExecutionRequest as isRetryExecutionRequest$1, getRetryInfo as getRetryInfo$1, Logger } from '@graphql-hive/gateway-runtime';
|
|
2
2
|
import { getHeadersObj } from '@graphql-mesh/utils';
|
|
3
|
-
import { isAsyncIterable, getOperationASTFromDocument, fakePromise } from '@graphql-tools/utils';
|
|
3
|
+
import { isAsyncIterable, getOperationASTFromDocument, getSchemaCoordinate, fakePromise } from '@graphql-tools/utils';
|
|
4
4
|
import { unfakePromise } from '@whatwg-node/promise-helpers';
|
|
5
5
|
import { hive } from './api.js';
|
|
6
6
|
import { trace, SpanStatusCode, context, ROOT_CONTEXT, SpanKind, DiagLogLevel, diag, propagation } from '@opentelemetry/api';
|
|
7
7
|
import { hashOperation } from '@graphql-hive/core';
|
|
8
8
|
import { defaultPrintFn } from '@graphql-mesh/transport-common';
|
|
9
|
-
import { SEMATTRS_EXCEPTION_STACKTRACE, SEMATTRS_EXCEPTION_MESSAGE, SEMATTRS_EXCEPTION_TYPE, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_URL, SEMATTRS_NET_HOST_NAME, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_HTTP_CLIENT_IP } from '@opentelemetry/semantic-conventions';
|
|
9
|
+
import { SEMATTRS_EXCEPTION_STACKTRACE, SEMATTRS_EXCEPTION_MESSAGE, SEMATTRS_EXCEPTION_TYPE, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_URL, SEMATTRS_NET_HOST_NAME, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_HTTP_CLIENT_IP, ATTR_EXCEPTION_STACKTRACE } from '@opentelemetry/semantic-conventions';
|
|
10
10
|
import { printSchema, TypeInfo } from 'graphql';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
function useErrorCoordinate() {
|
|
13
|
+
return {
|
|
14
|
+
onExecute({ args }) {
|
|
15
|
+
args.schemaCoordinateInErrors = true;
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
12
19
|
|
|
13
20
|
class OtelContextStack {
|
|
14
21
|
#root;
|
|
@@ -117,6 +124,21 @@ function getRetryInfo(executionRequest) {
|
|
|
117
124
|
return executionRequest[RETRY_SYMBOL];
|
|
118
125
|
}
|
|
119
126
|
|
|
127
|
+
const SEMATTRS_GRAPHQL_DOCUMENT = "graphql.document";
|
|
128
|
+
const SEMATTRS_GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
|
|
129
|
+
const SEMATTRS_GRAPHQL_OPERATION_NAME = "graphql.operation.name";
|
|
130
|
+
const SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = "hive.graphql.operation.hash";
|
|
131
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = "hive.graphql.error.count";
|
|
132
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = "hive.graphql.error.codes";
|
|
133
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES = "hive.graphql.error.coordinates";
|
|
134
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_CODE = "hive.graphql.error.code";
|
|
135
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE = "hive.graphql.error.coordinate";
|
|
136
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_PATH = "hive.graphql.error.path";
|
|
137
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE = "hive.graphql.error.message";
|
|
138
|
+
const SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS = "hive.graphql.error.locations";
|
|
139
|
+
const SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = "hive.gateway.upstream.subgraph.name";
|
|
140
|
+
const SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = "hive.gateway.operation.subgraph.names";
|
|
141
|
+
|
|
120
142
|
function createHttpSpan(input) {
|
|
121
143
|
const { url, request, tracer } = input;
|
|
122
144
|
const span = tracer.startSpan(
|
|
@@ -233,7 +255,27 @@ function setGraphQLParseAttributes(input) {
|
|
|
233
255
|
span.setAttribute(SEMATTRS_GRAPHQL_DOCUMENT, input.query);
|
|
234
256
|
}
|
|
235
257
|
if (input.result instanceof Error) {
|
|
236
|
-
|
|
258
|
+
if (isGraphQLError(input.result)) {
|
|
259
|
+
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, 1);
|
|
260
|
+
span.setStatus({
|
|
261
|
+
code: SpanStatusCode.ERROR,
|
|
262
|
+
message: "GraphQL Parse Error"
|
|
263
|
+
});
|
|
264
|
+
const operationSpan = trace.getSpan(input.operationCtx);
|
|
265
|
+
if (operationSpan) {
|
|
266
|
+
recordGraphqlErrors(
|
|
267
|
+
operationSpan,
|
|
268
|
+
[input.result],
|
|
269
|
+
"GraphQL Parse Error"
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
span.recordException(input.result);
|
|
274
|
+
span.setStatus({
|
|
275
|
+
code: SpanStatusCode.ERROR,
|
|
276
|
+
message: input.result.message
|
|
277
|
+
});
|
|
278
|
+
}
|
|
237
279
|
} else {
|
|
238
280
|
const document = input.result;
|
|
239
281
|
const operation = getOperationFromDocument(document, input.operationName);
|
|
@@ -272,21 +314,34 @@ function setGraphQLValidateAttributes(input) {
|
|
|
272
314
|
if (result instanceof Error) {
|
|
273
315
|
errors.push(result);
|
|
274
316
|
}
|
|
275
|
-
if (errors.length
|
|
317
|
+
if (errors.length === 0) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const graphqlErrors = [];
|
|
321
|
+
const exceptions = [];
|
|
322
|
+
for (const error of errors) {
|
|
323
|
+
(isGraphQLError(error) ? graphqlErrors : exceptions).push(error);
|
|
324
|
+
}
|
|
325
|
+
if (graphqlErrors.length > 0) {
|
|
276
326
|
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, result.length);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
327
|
+
const operationSpan = trace.getSpan(input.operationCtx);
|
|
328
|
+
if (operationSpan) {
|
|
329
|
+
recordGraphqlErrors(
|
|
330
|
+
operationSpan,
|
|
331
|
+
graphqlErrors,
|
|
332
|
+
"GraphQL Validation Error"
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (exceptions.length > 0) {
|
|
337
|
+
for (const exception of exceptions) {
|
|
338
|
+
span.recordException(exception);
|
|
287
339
|
}
|
|
288
|
-
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, codes);
|
|
289
340
|
}
|
|
341
|
+
span.setStatus({
|
|
342
|
+
code: SpanStatusCode.ERROR,
|
|
343
|
+
message: "GraphQL Validation Error"
|
|
344
|
+
});
|
|
290
345
|
}
|
|
291
346
|
function createGraphQLExecuteSpan(input) {
|
|
292
347
|
const span = input.tracer.startSpan(
|
|
@@ -325,33 +380,30 @@ function setGraphQLExecutionAttributes(input) {
|
|
|
325
380
|
}
|
|
326
381
|
}
|
|
327
382
|
function setGraphQLExecutionResultAttributes(input) {
|
|
328
|
-
const { ctx, result } = input;
|
|
383
|
+
const { ctx, operationCtx, result } = input;
|
|
329
384
|
const span = trace.getSpan(ctx);
|
|
330
|
-
if (
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
);
|
|
385
|
+
if (span) {
|
|
386
|
+
if (input.subgraphNames?.length) {
|
|
387
|
+
span.setAttribute(
|
|
388
|
+
SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES,
|
|
389
|
+
input.subgraphNames
|
|
390
|
+
);
|
|
391
|
+
}
|
|
338
392
|
}
|
|
393
|
+
const operationSpan = trace.getSpan(operationCtx);
|
|
339
394
|
if (!isAsyncIterable(result) && // FIXME: Handle async iterable too
|
|
340
395
|
result.errors && result.errors.length > 0) {
|
|
341
|
-
span
|
|
342
|
-
span
|
|
396
|
+
span?.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, result.errors.length);
|
|
397
|
+
span?.setStatus({
|
|
343
398
|
code: SpanStatusCode.ERROR,
|
|
344
|
-
message:
|
|
399
|
+
message: "GraphQL Execution Error"
|
|
345
400
|
});
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
if (codes.length > 0) {
|
|
354
|
-
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, codes);
|
|
401
|
+
if (operationSpan) {
|
|
402
|
+
recordGraphqlErrors(
|
|
403
|
+
operationSpan,
|
|
404
|
+
result.errors,
|
|
405
|
+
"GraphQL Execution Error"
|
|
406
|
+
);
|
|
355
407
|
}
|
|
356
408
|
}
|
|
357
409
|
}
|
|
@@ -496,6 +548,70 @@ const getOperationFromDocument = (document, operationName) => {
|
|
|
496
548
|
operationNameMap.set(operationName ?? null, operation);
|
|
497
549
|
return operation;
|
|
498
550
|
};
|
|
551
|
+
function recordGraphqlErrors(span, errors, message) {
|
|
552
|
+
const codes = [];
|
|
553
|
+
const schemaCoordinates = [];
|
|
554
|
+
span.setStatus({
|
|
555
|
+
code: SpanStatusCode.ERROR,
|
|
556
|
+
message: message ?? "GraphQL Error"
|
|
557
|
+
});
|
|
558
|
+
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, errors.length);
|
|
559
|
+
for (const error of errors) {
|
|
560
|
+
const attributes = attributesFromGraphqlError(error);
|
|
561
|
+
if (attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_CODE]) {
|
|
562
|
+
codes.push(attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_CODE]);
|
|
563
|
+
}
|
|
564
|
+
if (attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE]) {
|
|
565
|
+
schemaCoordinates.push(
|
|
566
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE]
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
span.addEvent("graphql.error", attributes);
|
|
570
|
+
}
|
|
571
|
+
if (codes.length > 0) {
|
|
572
|
+
span.setAttribute(SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, codes);
|
|
573
|
+
}
|
|
574
|
+
if (schemaCoordinates.length > 0) {
|
|
575
|
+
span.setAttribute(
|
|
576
|
+
SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES,
|
|
577
|
+
schemaCoordinates
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
function attributesFromGraphqlError(error) {
|
|
582
|
+
const attributes = {
|
|
583
|
+
[SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE]: error.message
|
|
584
|
+
};
|
|
585
|
+
if (error.path) {
|
|
586
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_PATH] = error.path.map(
|
|
587
|
+
(p) => p.toString()
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
if (error.locations) {
|
|
591
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS] = error.locations.map(
|
|
592
|
+
({ line, column }) => `${line}:${column}`
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
if (error.extensions) {
|
|
596
|
+
const code = error.extensions?.["code"];
|
|
597
|
+
if (code) {
|
|
598
|
+
const codeStr = `${code}`;
|
|
599
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_CODE] = codeStr;
|
|
600
|
+
}
|
|
601
|
+
const schemaCoordinate = getSchemaCoordinate(error);
|
|
602
|
+
if (schemaCoordinate) {
|
|
603
|
+
attributes[SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE] = schemaCoordinate;
|
|
604
|
+
}
|
|
605
|
+
const originalError = error.extensions["originalError"];
|
|
606
|
+
if (originalError?.stack) {
|
|
607
|
+
attributes[ATTR_EXCEPTION_STACKTRACE] = originalError.stack;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return attributes;
|
|
611
|
+
}
|
|
612
|
+
function isGraphQLError(error) {
|
|
613
|
+
return !error.name || error.name === "GraphQLError";
|
|
614
|
+
}
|
|
499
615
|
|
|
500
616
|
function getEnvStr(key, opts = {}) {
|
|
501
617
|
const globalThat = opts.globalThis ?? globalThis;
|
|
@@ -716,7 +832,9 @@ function useOpenTelemetry(options) {
|
|
|
716
832
|
try {
|
|
717
833
|
wrapped();
|
|
718
834
|
} catch (err) {
|
|
719
|
-
|
|
835
|
+
if (err instanceof Error && !isGraphQLError(err)) {
|
|
836
|
+
registerException(forOperation.otel.current, err);
|
|
837
|
+
}
|
|
720
838
|
throw err;
|
|
721
839
|
} finally {
|
|
722
840
|
trace.getSpan(forOperation.otel.current)?.end();
|
|
@@ -849,6 +967,9 @@ function useOpenTelemetry(options) {
|
|
|
849
967
|
);
|
|
850
968
|
}
|
|
851
969
|
},
|
|
970
|
+
onPluginInit({ addPlugin }) {
|
|
971
|
+
addPlugin(useErrorCoordinate());
|
|
972
|
+
},
|
|
852
973
|
onYogaInit({ yoga }) {
|
|
853
974
|
pluginLogger ??= new Logger({
|
|
854
975
|
writers: [
|
|
@@ -941,6 +1062,7 @@ function useOpenTelemetry(options) {
|
|
|
941
1062
|
return ({ result }) => {
|
|
942
1063
|
setGraphQLParseAttributes({
|
|
943
1064
|
ctx: getContext(state),
|
|
1065
|
+
operationCtx: state.forOperation.otel.root,
|
|
944
1066
|
operationName: gqlCtx.params.operationName,
|
|
945
1067
|
query: gqlCtx.params.query?.trim(),
|
|
946
1068
|
result
|
|
@@ -961,6 +1083,7 @@ function useOpenTelemetry(options) {
|
|
|
961
1083
|
return ({ result }) => {
|
|
962
1084
|
setGraphQLValidateAttributes({
|
|
963
1085
|
ctx: getContext(state),
|
|
1086
|
+
operationCtx: state.forOperation.otel.root,
|
|
964
1087
|
result,
|
|
965
1088
|
document: params.documentAST,
|
|
966
1089
|
operationName: gqlCtx.params.operationName
|
|
@@ -984,6 +1107,7 @@ function useOpenTelemetry(options) {
|
|
|
984
1107
|
setGraphQLExecutionResultAttributes({
|
|
985
1108
|
ctx,
|
|
986
1109
|
result,
|
|
1110
|
+
operationCtx: state.forOperation.otel.root,
|
|
987
1111
|
subgraphNames: state.forOperation.subgraphNames
|
|
988
1112
|
});
|
|
989
1113
|
}
|
|
@@ -1091,4 +1215,4 @@ function resolveTracesConfig(options, useContextManager, log) {
|
|
|
1091
1215
|
return traces;
|
|
1092
1216
|
}
|
|
1093
1217
|
|
|
1094
|
-
export {
|
|
1218
|
+
export { SEMATTRS_GRAPHQL_DOCUMENT as S, SEMATTRS_GRAPHQL_OPERATION_TYPE as a, SEMATTRS_GRAPHQL_OPERATION_NAME as b, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH as c, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT as d, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES as e, SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES as f, SEMATTRS_HIVE_GRAPHQL_ERROR_CODE as g, SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE as h, SEMATTRS_HIVE_GRAPHQL_ERROR_PATH as i, SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE as j, SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS as k, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME as l, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES as m, getEnvBool as n, otelCtxForRequestId as o, diagLogLevelFromEnv as p, getEnvStr as q, useOpenTelemetry as u };
|
package/dist/setup.cjs
CHANGED
|
@@ -6,9 +6,8 @@ var core = require('@opentelemetry/core');
|
|
|
6
6
|
var resources = require('@opentelemetry/resources');
|
|
7
7
|
var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
8
8
|
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
9
|
-
var plugin = require('./plugin-
|
|
9
|
+
var plugin = require('./plugin-BRkOARbT.cjs');
|
|
10
10
|
var exporterTraceOtlpHttp = require('@opentelemetry/exporter-trace-otlp-http');
|
|
11
|
-
var attributes = require('./attributes.cjs');
|
|
12
11
|
var apiLogs = require('@opentelemetry/api-logs');
|
|
13
12
|
var sdkLogs = require('@opentelemetry/sdk-logs');
|
|
14
13
|
require('@graphql-hive/gateway-runtime');
|
|
@@ -105,15 +104,11 @@ class HiveTracingSpanProcessor {
|
|
|
105
104
|
if (operationSpan === span) {
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
108
|
-
if (SPANS_WITH_ERRORS.includes(span.name)) {
|
|
109
|
-
copyAttribute(span, operationSpan, attributes.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES);
|
|
110
|
-
copyAttribute(span, operationSpan, attributes.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT);
|
|
111
|
-
}
|
|
112
107
|
if (span.name === "graphql.execute") {
|
|
113
108
|
copyAttribute(
|
|
114
109
|
span,
|
|
115
110
|
operationSpan,
|
|
116
|
-
|
|
111
|
+
plugin.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES
|
|
117
112
|
);
|
|
118
113
|
}
|
|
119
114
|
const subgraphExecution = traceState.subgraphExecutions.get(spanId);
|
|
@@ -146,11 +141,6 @@ function isOperationSpan(span) {
|
|
|
146
141
|
const followingChar = span.name.at(17);
|
|
147
142
|
return !followingChar || followingChar === " ";
|
|
148
143
|
}
|
|
149
|
-
const SPANS_WITH_ERRORS = [
|
|
150
|
-
"graphql.parse",
|
|
151
|
-
"graphql.validate",
|
|
152
|
-
"graphql.execute"
|
|
153
|
-
];
|
|
154
144
|
|
|
155
145
|
class OpenTelemetryLogWriter {
|
|
156
146
|
logger;
|
|
@@ -225,10 +215,10 @@ function getContextForRequest(attributes) {
|
|
|
225
215
|
return plugin.otelCtxForRequestId.get(attributes.requestId) ?? api.ROOT_CONTEXT;
|
|
226
216
|
}
|
|
227
217
|
|
|
228
|
-
globalThis.__OTEL_PLUGIN_VERSION__ = '1.3.0-alpha-
|
|
218
|
+
globalThis.__OTEL_PLUGIN_VERSION__ = '1.3.0-alpha-64ccb74c470e010e18f890a3fd4afc34094275a7';
|
|
229
219
|
let initialized = false;
|
|
230
220
|
function openTelemetrySetup(options) {
|
|
231
|
-
const log = options.log || new logger.Logger();
|
|
221
|
+
const log = !options.log || typeof options.log === "string" ? new logger.Logger({ level: options.log }) : options.log;
|
|
232
222
|
if (initialized) {
|
|
233
223
|
log.error(
|
|
234
224
|
`${initialized.name} integration has already been initialized by ${initialized.source}`
|
|
@@ -321,7 +311,7 @@ function openTelemetrySetup(options) {
|
|
|
321
311
|
log.info(logAttributes, logMessage);
|
|
322
312
|
}
|
|
323
313
|
function hiveTracingSetup(options) {
|
|
324
|
-
const log = options.log || new logger.Logger();
|
|
314
|
+
const log = !options.log || typeof options.log === "string" ? new logger.Logger({ level: options.log }) : options.log;
|
|
325
315
|
options.target ??= plugin.getEnvStr("HIVE_TARGET");
|
|
326
316
|
if (!options.target) {
|
|
327
317
|
throw new Error(
|
|
@@ -457,14 +447,20 @@ Object.defineProperty(exports, "SEMATTRS_NET_HOST_NAME", {
|
|
|
457
447
|
enumerable: true,
|
|
458
448
|
get: function () { return semanticConventions.SEMATTRS_NET_HOST_NAME; }
|
|
459
449
|
});
|
|
460
|
-
exports.SEMATTRS_GRAPHQL_DOCUMENT =
|
|
461
|
-
exports.SEMATTRS_GRAPHQL_OPERATION_NAME =
|
|
462
|
-
exports.SEMATTRS_GRAPHQL_OPERATION_TYPE =
|
|
463
|
-
exports.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES =
|
|
464
|
-
exports.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME =
|
|
465
|
-
exports.
|
|
466
|
-
exports.
|
|
467
|
-
exports.
|
|
450
|
+
exports.SEMATTRS_GRAPHQL_DOCUMENT = plugin.SEMATTRS_GRAPHQL_DOCUMENT;
|
|
451
|
+
exports.SEMATTRS_GRAPHQL_OPERATION_NAME = plugin.SEMATTRS_GRAPHQL_OPERATION_NAME;
|
|
452
|
+
exports.SEMATTRS_GRAPHQL_OPERATION_TYPE = plugin.SEMATTRS_GRAPHQL_OPERATION_TYPE;
|
|
453
|
+
exports.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = plugin.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES;
|
|
454
|
+
exports.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = plugin.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME;
|
|
455
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODE = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_CODE;
|
|
456
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES;
|
|
457
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT;
|
|
458
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS;
|
|
459
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE;
|
|
460
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_PATH = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_PATH;
|
|
461
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE;
|
|
462
|
+
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES = plugin.SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES;
|
|
463
|
+
exports.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = plugin.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH;
|
|
468
464
|
exports.HIVE_LOG_LEVEL_NUMBERS = HIVE_LOG_LEVEL_NUMBERS;
|
|
469
465
|
exports.HiveTracingSpanProcessor = HiveTracingSpanProcessor;
|
|
470
466
|
exports.OpenTelemetryLogWriter = OpenTelemetryLogWriter;
|
package/dist/setup.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { LogWriter, LogLevel, Attributes, Logger as Logger$1 } from '@graphql-hi
|
|
|
2
2
|
import { Context, TracerProvider, ContextManager, TextMapPropagator } from '@opentelemetry/api';
|
|
3
3
|
import { Resource } from '@opentelemetry/resources';
|
|
4
4
|
import { BufferConfig, SpanProcessor, Span, SpanLimits, SpanExporter, Sampler, GeneralLimits } from '@opentelemetry/sdk-trace-base';
|
|
5
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes.
|
|
5
|
+
export { S as SEMATTRS_GRAPHQL_DOCUMENT, b as SEMATTRS_GRAPHQL_OPERATION_NAME, a as SEMATTRS_GRAPHQL_OPERATION_TYPE, m as SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, l as SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, g as SEMATTRS_HIVE_GRAPHQL_ERROR_CODE, e as SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, d as SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, k as SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS, j as SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE, i as SEMATTRS_HIVE_GRAPHQL_ERROR_PATH, h as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE, f as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES, c as SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes-BjUFTXMN.js';
|
|
6
6
|
import { Logger, SeverityNumber } from '@opentelemetry/api-logs';
|
|
7
7
|
import { LoggerProvider, LogRecordLimits, LogRecordProcessor, LogRecordExporter } from '@opentelemetry/sdk-logs';
|
|
8
8
|
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
@@ -152,7 +152,7 @@ type BaseOptions = {
|
|
|
152
152
|
* The Logger to be used by this utility.
|
|
153
153
|
* A child of this logger will be used for OTEL diag API, unless `configureDiagLogger` is false
|
|
154
154
|
*/
|
|
155
|
-
log?: Logger$1;
|
|
155
|
+
log?: Logger$1 | false | LogLevel;
|
|
156
156
|
/**
|
|
157
157
|
* Configure Opentelemetry `diag` API to use Gateway's logger.
|
|
158
158
|
*
|
package/dist/setup.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LogWriter, LogLevel, Attributes, Logger as Logger$1 } from '@graphql-hi
|
|
|
2
2
|
import { Context, TracerProvider, ContextManager, TextMapPropagator } from '@opentelemetry/api';
|
|
3
3
|
import { Resource } from '@opentelemetry/resources';
|
|
4
4
|
import { BufferConfig, SpanProcessor, Span, SpanLimits, SpanExporter, Sampler, GeneralLimits } from '@opentelemetry/sdk-trace-base';
|
|
5
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes.js';
|
|
5
|
+
export { S as SEMATTRS_GRAPHQL_DOCUMENT, b as SEMATTRS_GRAPHQL_OPERATION_NAME, a as SEMATTRS_GRAPHQL_OPERATION_TYPE, m as SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, l as SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, g as SEMATTRS_HIVE_GRAPHQL_ERROR_CODE, e as SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, d as SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, k as SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS, j as SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE, i as SEMATTRS_HIVE_GRAPHQL_ERROR_PATH, h as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE, f as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES, c as SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes-BjUFTXMN.js';
|
|
6
6
|
import { Logger, SeverityNumber } from '@opentelemetry/api-logs';
|
|
7
7
|
import { LoggerProvider, LogRecordLimits, LogRecordProcessor, LogRecordExporter } from '@opentelemetry/sdk-logs';
|
|
8
8
|
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
@@ -152,7 +152,7 @@ type BaseOptions = {
|
|
|
152
152
|
* The Logger to be used by this utility.
|
|
153
153
|
* A child of this logger will be used for OTEL diag API, unless `configureDiagLogger` is false
|
|
154
154
|
*/
|
|
155
|
-
log?: Logger$1;
|
|
155
|
+
log?: Logger$1 | false | LogLevel;
|
|
156
156
|
/**
|
|
157
157
|
* Configure Opentelemetry `diag` API to use Gateway's logger.
|
|
158
158
|
*
|
package/dist/setup.js
CHANGED
|
@@ -5,10 +5,9 @@ import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
|
5
5
|
import { BatchSpanProcessor, SimpleSpanProcessor, ConsoleSpanExporter, BasicTracerProvider, ParentBasedSampler, AlwaysOnSampler, TraceIdRatioBasedSampler } from '@opentelemetry/sdk-trace-base';
|
|
6
6
|
import { SEMATTRS_HTTP_METHOD, ATTR_SERVICE_VERSION, ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
7
7
|
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
8
|
-
import { o as otelCtxForRequestId,
|
|
8
|
+
import { m as SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, o as otelCtxForRequestId, n as getEnvBool, p as diagLogLevelFromEnv, q as getEnvStr } from './plugin-DXgE1GBh.js';
|
|
9
|
+
export { S as SEMATTRS_GRAPHQL_DOCUMENT, b as SEMATTRS_GRAPHQL_OPERATION_NAME, a as SEMATTRS_GRAPHQL_OPERATION_TYPE, l as SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, g as SEMATTRS_HIVE_GRAPHQL_ERROR_CODE, e as SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, d as SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, k as SEMATTRS_HIVE_GRAPHQL_ERROR_LOCATIONS, j as SEMATTRS_HIVE_GRAPHQL_ERROR_MESSAGE, i as SEMATTRS_HIVE_GRAPHQL_ERROR_PATH, h as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATE, f as SEMATTRS_HIVE_GRAPHQL_ERROR_SCHEMA_COORDINATES, c as SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './plugin-DXgE1GBh.js';
|
|
9
10
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
10
|
-
import { SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES } from './attributes.js';
|
|
11
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH } from './attributes.js';
|
|
12
11
|
import { SeverityNumber, logs } from '@opentelemetry/api-logs';
|
|
13
12
|
import { BatchLogRecordProcessor, SimpleLogRecordProcessor, ConsoleLogRecordExporter, LoggerProvider } from '@opentelemetry/sdk-logs';
|
|
14
13
|
import '@graphql-hive/gateway-runtime';
|
|
@@ -105,10 +104,6 @@ class HiveTracingSpanProcessor {
|
|
|
105
104
|
if (operationSpan === span) {
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
108
|
-
if (SPANS_WITH_ERRORS.includes(span.name)) {
|
|
109
|
-
copyAttribute(span, operationSpan, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES);
|
|
110
|
-
copyAttribute(span, operationSpan, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT);
|
|
111
|
-
}
|
|
112
107
|
if (span.name === "graphql.execute") {
|
|
113
108
|
copyAttribute(
|
|
114
109
|
span,
|
|
@@ -146,11 +141,6 @@ function isOperationSpan(span) {
|
|
|
146
141
|
const followingChar = span.name.at(17);
|
|
147
142
|
return !followingChar || followingChar === " ";
|
|
148
143
|
}
|
|
149
|
-
const SPANS_WITH_ERRORS = [
|
|
150
|
-
"graphql.parse",
|
|
151
|
-
"graphql.validate",
|
|
152
|
-
"graphql.execute"
|
|
153
|
-
];
|
|
154
144
|
|
|
155
145
|
class OpenTelemetryLogWriter {
|
|
156
146
|
logger;
|
|
@@ -225,10 +215,10 @@ function getContextForRequest(attributes) {
|
|
|
225
215
|
return otelCtxForRequestId.get(attributes.requestId) ?? ROOT_CONTEXT;
|
|
226
216
|
}
|
|
227
217
|
|
|
228
|
-
globalThis.__OTEL_PLUGIN_VERSION__ = '1.3.0-alpha-
|
|
218
|
+
globalThis.__OTEL_PLUGIN_VERSION__ = '1.3.0-alpha-64ccb74c470e010e18f890a3fd4afc34094275a7';
|
|
229
219
|
let initialized = false;
|
|
230
220
|
function openTelemetrySetup(options) {
|
|
231
|
-
const log = options.log || new Logger();
|
|
221
|
+
const log = !options.log || typeof options.log === "string" ? new Logger({ level: options.log }) : options.log;
|
|
232
222
|
if (initialized) {
|
|
233
223
|
log.error(
|
|
234
224
|
`${initialized.name} integration has already been initialized by ${initialized.source}`
|
|
@@ -321,7 +311,7 @@ function openTelemetrySetup(options) {
|
|
|
321
311
|
log.info(logAttributes, logMessage);
|
|
322
312
|
}
|
|
323
313
|
function hiveTracingSetup(options) {
|
|
324
|
-
const log = options.log || new Logger();
|
|
314
|
+
const log = !options.log || typeof options.log === "string" ? new Logger({ level: options.log }) : options.log;
|
|
325
315
|
options.target ??= getEnvStr("HIVE_TARGET");
|
|
326
316
|
if (!options.target) {
|
|
327
317
|
throw new Error(
|
|
@@ -409,4 +399,4 @@ function disable() {
|
|
|
409
399
|
initialized = false;
|
|
410
400
|
}
|
|
411
401
|
|
|
412
|
-
export { HIVE_LOG_LEVEL_NUMBERS, HiveTracingSpanProcessor, OpenTelemetryLogWriter, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES,
|
|
402
|
+
export { HIVE_LOG_LEVEL_NUMBERS, HiveTracingSpanProcessor, OpenTelemetryLogWriter, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, disable, getContextForRequest, hiveTracingSetup, openTelemetrySetup };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-hive/plugin-opentelemetry",
|
|
3
|
-
"version": "1.3.0-alpha-
|
|
3
|
+
"version": "1.3.0-alpha-64ccb74c470e010e18f890a3fd4afc34094275a7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,16 +49,6 @@
|
|
|
49
49
|
"default": "./dist/api.js"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"./attributes": {
|
|
53
|
-
"require": {
|
|
54
|
-
"types": "./dist/attributes.d.cts",
|
|
55
|
-
"default": "./dist/attributes.cjs"
|
|
56
|
-
},
|
|
57
|
-
"import": {
|
|
58
|
-
"types": "./dist/attributes.d.ts",
|
|
59
|
-
"default": "./dist/attributes.js"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
52
|
"./package.json": "./package.json"
|
|
63
53
|
},
|
|
64
54
|
"files": [
|
|
@@ -73,12 +63,13 @@
|
|
|
73
63
|
},
|
|
74
64
|
"dependencies": {
|
|
75
65
|
"@graphql-hive/core": "^0.18.0",
|
|
76
|
-
"@graphql-hive/gateway-runtime": "2.5.0-alpha-
|
|
66
|
+
"@graphql-hive/gateway-runtime": "2.5.0-alpha-64ccb74c470e010e18f890a3fd4afc34094275a7",
|
|
77
67
|
"@graphql-hive/logger": "^1.0.9",
|
|
78
68
|
"@graphql-mesh/cross-helpers": "^0.4.10",
|
|
79
69
|
"@graphql-mesh/transport-common": "^1.0.12",
|
|
80
70
|
"@graphql-mesh/types": "^0.104.16",
|
|
81
71
|
"@graphql-mesh/utils": "^0.104.16",
|
|
72
|
+
"@graphql-tools/executor": "^1.4.9",
|
|
82
73
|
"@graphql-tools/utils": "^10.10.3",
|
|
83
74
|
"@opentelemetry/api": "^1.9.0",
|
|
84
75
|
"@opentelemetry/api-logs": "^0.208.0",
|
|
@@ -99,7 +90,7 @@
|
|
|
99
90
|
"devDependencies": {
|
|
100
91
|
"@whatwg-node/server": "^0.10.17",
|
|
101
92
|
"graphql": "^16.12.0",
|
|
102
|
-
"graphql-yoga": "^5.
|
|
93
|
+
"graphql-yoga": "^5.17.0",
|
|
103
94
|
"pkgroll": "2.21.4",
|
|
104
95
|
"rimraf": "^6.1.0",
|
|
105
96
|
"rollup": "^4.53.2",
|
package/dist/attributes.cjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
4
|
-
|
|
5
|
-
const SEMATTRS_GRAPHQL_DOCUMENT = "graphql.document";
|
|
6
|
-
const SEMATTRS_GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
|
|
7
|
-
const SEMATTRS_GRAPHQL_OPERATION_NAME = "graphql.operation.name";
|
|
8
|
-
const SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = "hive.graphql.operation.hash";
|
|
9
|
-
const SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = "hive.graphql.error.count";
|
|
10
|
-
const SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = "hive.graphql.error.codes";
|
|
11
|
-
const SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = "hive.gateway.upstream.subgraph.name";
|
|
12
|
-
const SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = "hive.gateway.operation.subgraph.names";
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(exports, "ATTR_SERVICE_NAME", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return semanticConventions.ATTR_SERVICE_NAME; }
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "ATTR_SERVICE_VERSION", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return semanticConventions.ATTR_SERVICE_VERSION; }
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_CLIENT_IP", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_CLIENT_IP; }
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_HOST", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_HOST; }
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_METHOD", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_METHOD; }
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_ROUTE", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_ROUTE; }
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_SCHEME", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_SCHEME; }
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_SERVER_NAME", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_SERVER_NAME; }
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_STATUS_CODE", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_STATUS_CODE; }
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_URL", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_URL; }
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "SEMATTRS_HTTP_USER_AGENT", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () { return semanticConventions.SEMATTRS_HTTP_USER_AGENT; }
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(exports, "SEMATTRS_NET_HOST_NAME", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: function () { return semanticConventions.SEMATTRS_NET_HOST_NAME; }
|
|
61
|
-
});
|
|
62
|
-
exports.SEMATTRS_GRAPHQL_DOCUMENT = SEMATTRS_GRAPHQL_DOCUMENT;
|
|
63
|
-
exports.SEMATTRS_GRAPHQL_OPERATION_NAME = SEMATTRS_GRAPHQL_OPERATION_NAME;
|
|
64
|
-
exports.SEMATTRS_GRAPHQL_OPERATION_TYPE = SEMATTRS_GRAPHQL_OPERATION_TYPE;
|
|
65
|
-
exports.SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES;
|
|
66
|
-
exports.SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME;
|
|
67
|
-
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = SEMATTRS_HIVE_GRAPHQL_ERROR_CODES;
|
|
68
|
-
exports.SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT;
|
|
69
|
-
exports.SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH;
|
package/dist/attributes.d.cts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
2
|
-
|
|
3
|
-
declare const SEMATTRS_GRAPHQL_DOCUMENT = "graphql.document";
|
|
4
|
-
declare const SEMATTRS_GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
|
|
5
|
-
declare const SEMATTRS_GRAPHQL_OPERATION_NAME = "graphql.operation.name";
|
|
6
|
-
declare const SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = "hive.graphql.operation.hash";
|
|
7
|
-
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = "hive.graphql.error.count";
|
|
8
|
-
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = "hive.graphql.error.codes";
|
|
9
|
-
declare const SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = "hive.gateway.upstream.subgraph.name";
|
|
10
|
-
declare const SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = "hive.gateway.operation.subgraph.names";
|
|
11
|
-
|
|
12
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH };
|
package/dist/attributes.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
2
|
-
|
|
3
|
-
declare const SEMATTRS_GRAPHQL_DOCUMENT = "graphql.document";
|
|
4
|
-
declare const SEMATTRS_GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
|
|
5
|
-
declare const SEMATTRS_GRAPHQL_OPERATION_NAME = "graphql.operation.name";
|
|
6
|
-
declare const SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = "hive.graphql.operation.hash";
|
|
7
|
-
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = "hive.graphql.error.count";
|
|
8
|
-
declare const SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = "hive.graphql.error.codes";
|
|
9
|
-
declare const SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = "hive.gateway.upstream.subgraph.name";
|
|
10
|
-
declare const SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = "hive.gateway.operation.subgraph.names";
|
|
11
|
-
|
|
12
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH };
|
package/dist/attributes.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
|
|
2
|
-
|
|
3
|
-
const SEMATTRS_GRAPHQL_DOCUMENT = "graphql.document";
|
|
4
|
-
const SEMATTRS_GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
|
|
5
|
-
const SEMATTRS_GRAPHQL_OPERATION_NAME = "graphql.operation.name";
|
|
6
|
-
const SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH = "hive.graphql.operation.hash";
|
|
7
|
-
const SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT = "hive.graphql.error.count";
|
|
8
|
-
const SEMATTRS_HIVE_GRAPHQL_ERROR_CODES = "hive.graphql.error.codes";
|
|
9
|
-
const SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME = "hive.gateway.upstream.subgraph.name";
|
|
10
|
-
const SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES = "hive.gateway.operation.subgraph.names";
|
|
11
|
-
|
|
12
|
-
export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH };
|