@envelop/opentelemetry 3.4.0 → 3.4.1-alpha-88024a80.0

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 CHANGED
@@ -15,8 +15,8 @@ yarn add @envelop/opentelemetry
15
15
  By default, this plugin prints the collected telemetry to the console:
16
16
 
17
17
  ```ts
18
- import { envelop } from '@envelop/core';
19
- import { useOpenTelemetry } from '@envelop/opentelemetry';
18
+ import { envelop } from '@envelop/core'
19
+ import { useOpenTelemetry } from '@envelop/opentelemetry'
20
20
 
21
21
  const getEnveloped = envelop({
22
22
  plugins: [
@@ -24,27 +24,27 @@ const getEnveloped = envelop({
24
24
  useOpenTelemetry({
25
25
  resolvers: true, // Tracks resolvers calls, and tracks resolvers thrown errors
26
26
  variables: true, // Includes the operation variables values as part of the metadata collected
27
- result: true, // Includes execution result object as part of the metadata collected
28
- }),
29
- ],
30
- });
27
+ result: true // Includes execution result object as part of the metadata collected
28
+ })
29
+ ]
30
+ })
31
31
  ```
32
32
 
33
33
  If you wish to use custom tracer/exporter, create it and pass it. This example integrates Jaeger tracer:
34
34
 
35
35
  ```ts
36
- import { envelop } from '@envelop/core';
37
- import { useOpenTelemetry } from '@envelop/opentelemetry';
38
- import { JaegerExporter } from '@opentelemetry/exporter-jaeger';
39
- import { SimpleSpanProcessor, BasicTracerProvider } from '@opentelemetry/tracing';
36
+ import { envelop } from '@envelop/core'
37
+ import { useOpenTelemetry } from '@envelop/opentelemetry'
38
+ import { JaegerExporter } from '@opentelemetry/exporter-jaeger'
39
+ import { SimpleSpanProcessor, BasicTracerProvider } from '@opentelemetry/tracing'
40
40
 
41
41
  const exporter = new JaegerExporter({
42
- serviceName: 'my-service-name',
43
- });
42
+ serviceName: 'my-service-name'
43
+ })
44
44
 
45
- const provider = new BasicTracerProvider();
46
- provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
47
- provider.register();
45
+ const provider = new BasicTracerProvider()
46
+ provider.addSpanProcessor(new SimpleSpanProcessor(exporter))
47
+ provider.register()
48
48
 
49
49
  const getEnveloped = envelop({
50
50
  plugins: [
@@ -53,10 +53,10 @@ const getEnveloped = envelop({
53
53
  {
54
54
  resolvers: true, // Tracks resolvers calls, and tracks resolvers thrown errors
55
55
  variables: true, // Includes the operation variables values as part of the metadata collected
56
- result: true, // Includes execution result object as part of the metadata collected
56
+ result: true // Includes execution result object as part of the metadata collected
57
57
  },
58
58
  provider
59
- ),
60
- ],
61
- });
59
+ )
60
+ ]
61
+ })
62
62
  ```
package/cjs/index.js CHANGED
@@ -66,7 +66,9 @@ const useOpenTelemetry = (options, tracingProvider, spanKind = api_1.SpanKind.SE
66
66
  ...spanAdditionalAttributes,
67
67
  [AttributeName.EXECUTION_OPERATION_NAME]: (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined,
68
68
  [AttributeName.EXECUTION_OPERATION_DOCUMENT]: (0, graphql_1.print)(args.document),
69
- ...(options.variables ? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify((_b = args.variableValues) !== null && _b !== void 0 ? _b : {}) } : {}),
69
+ ...(options.variables
70
+ ? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify((_b = args.variableValues) !== null && _b !== void 0 ? _b : {}) }
71
+ : {}),
70
72
  },
71
73
  });
72
74
  const resultCbs = {
package/esm/index.js CHANGED
@@ -62,7 +62,9 @@ export const useOpenTelemetry = (options, tracingProvider, spanKind = SpanKind.S
62
62
  ...spanAdditionalAttributes,
63
63
  [AttributeName.EXECUTION_OPERATION_NAME]: (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined,
64
64
  [AttributeName.EXECUTION_OPERATION_DOCUMENT]: print(args.document),
65
- ...(options.variables ? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify((_b = args.variableValues) !== null && _b !== void 0 ? _b : {}) } : {}),
65
+ ...(options.variables
66
+ ? { [AttributeName.EXECUTION_VARIABLES]: JSON.stringify((_b = args.variableValues) !== null && _b !== void 0 ? _b : {}) }
67
+ : {}),
66
68
  },
67
69
  });
68
70
  const resultCbs = {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/opentelemetry",
3
- "version": "3.4.0",
3
+ "version": "3.4.1-alpha-88024a80.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "^2.4.0",
6
+ "@envelop/core": "2.4.1-alpha-88024a80.0",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {