@envelop/opentelemetry 3.6.0 → 3.6.1-alpha-20220901205925-b1fd44a9
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/README.md +10 -0
- package/cjs/index.js +2 -3
- package/esm/index.js +2 -3
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -15,10 +15,15 @@ yarn add @envelop/opentelemetry
|
|
|
15
15
|
By default, this plugin prints the collected telemetry to the console:
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
+
import { parse, validate, execute, subscribe } from 'graphql'
|
|
18
19
|
import { envelop } from '@envelop/core'
|
|
19
20
|
import { useOpenTelemetry } from '@envelop/opentelemetry'
|
|
20
21
|
|
|
21
22
|
const getEnveloped = envelop({
|
|
23
|
+
parse,
|
|
24
|
+
validate,
|
|
25
|
+
execute,
|
|
26
|
+
subscribe,
|
|
22
27
|
plugins: [
|
|
23
28
|
// ... other plugins ...
|
|
24
29
|
useOpenTelemetry({
|
|
@@ -33,6 +38,7 @@ const getEnveloped = envelop({
|
|
|
33
38
|
If you wish to use custom tracer/exporter, create it and pass it. This example integrates Jaeger tracer:
|
|
34
39
|
|
|
35
40
|
```ts
|
|
41
|
+
import { parse, validate, execute, subscribe } from 'graphql'
|
|
36
42
|
import { envelop } from '@envelop/core'
|
|
37
43
|
import { useOpenTelemetry } from '@envelop/opentelemetry'
|
|
38
44
|
import { JaegerExporter } from '@opentelemetry/exporter-jaeger'
|
|
@@ -47,6 +53,10 @@ provider.addSpanProcessor(new SimpleSpanProcessor(exporter))
|
|
|
47
53
|
provider.register()
|
|
48
54
|
|
|
49
55
|
const getEnveloped = envelop({
|
|
56
|
+
parse,
|
|
57
|
+
validate,
|
|
58
|
+
execute,
|
|
59
|
+
subscribe,
|
|
50
60
|
plugins: [
|
|
51
61
|
// ... other plugins ...
|
|
52
62
|
useOpenTelemetry(
|
package/cjs/index.js
CHANGED
|
@@ -59,15 +59,14 @@ const useOpenTelemetry = (options, tracingProvider, spanKind = api_1.SpanKind.SE
|
|
|
59
59
|
}
|
|
60
60
|
: undefined,
|
|
61
61
|
onExecute({ args, extendContext }) {
|
|
62
|
-
var _a, _b;
|
|
63
62
|
const executionSpan = tracer.startSpan(`${args.operationName || 'Anonymous Operation'}`, {
|
|
64
63
|
kind: spanKind,
|
|
65
64
|
attributes: {
|
|
66
65
|
...spanAdditionalAttributes,
|
|
67
|
-
[AttributeName.EXECUTION_OPERATION_NAME]:
|
|
66
|
+
[AttributeName.EXECUTION_OPERATION_NAME]: args.operationName ?? undefined,
|
|
68
67
|
[AttributeName.EXECUTION_OPERATION_DOCUMENT]: (0, graphql_1.print)(args.document),
|
|
69
68
|
...(options.variables
|
|
70
|
-
? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify(
|
|
69
|
+
? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify(args.variableValues ?? {}) }
|
|
71
70
|
: {}),
|
|
72
71
|
},
|
|
73
72
|
});
|
package/esm/index.js
CHANGED
|
@@ -55,15 +55,14 @@ export const useOpenTelemetry = (options, tracingProvider, spanKind = SpanKind.S
|
|
|
55
55
|
}
|
|
56
56
|
: undefined,
|
|
57
57
|
onExecute({ args, extendContext }) {
|
|
58
|
-
var _a, _b;
|
|
59
58
|
const executionSpan = tracer.startSpan(`${args.operationName || 'Anonymous Operation'}`, {
|
|
60
59
|
kind: spanKind,
|
|
61
60
|
attributes: {
|
|
62
61
|
...spanAdditionalAttributes,
|
|
63
|
-
[AttributeName.EXECUTION_OPERATION_NAME]:
|
|
62
|
+
[AttributeName.EXECUTION_OPERATION_NAME]: args.operationName ?? undefined,
|
|
64
63
|
[AttributeName.EXECUTION_OPERATION_DOCUMENT]: print(args.document),
|
|
65
64
|
...(options.variables
|
|
66
|
-
? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify(
|
|
65
|
+
? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify(args.variableValues ?? {}) }
|
|
67
66
|
: {}),
|
|
68
67
|
},
|
|
69
68
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/opentelemetry",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1-alpha-20220901205925-b1fd44a9",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "
|
|
7
|
-
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
6
|
+
"@envelop/core": "2.6.1-alpha-20220901205925-b1fd44a9"
|
|
8
7
|
},
|
|
9
8
|
"dependencies": {
|
|
10
9
|
"@opentelemetry/api": "^1.0.0",
|