@envelop/prometheus 6.4.0 → 6.4.1-alpha-72027859.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.
Files changed (2) hide show
  1. package/README.md +23 -23
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -26,8 +26,8 @@ yarn add prom-client @envelop/prometheus
26
26
  ## Usage Example
27
27
 
28
28
  ```ts
29
- import { envelop } from '@envelop/core';
30
- import { usePrometheus } from '@envelop/prometheus';
29
+ import { envelop } from '@envelop/core'
30
+ import { usePrometheus } from '@envelop/prometheus'
31
31
 
32
32
  const getEnveloped = envelop({
33
33
  plugins: [
@@ -44,10 +44,10 @@ const getEnveloped = envelop({
44
44
  resolvers: true, // requires "execute" to be `true` as well
45
45
  resolversWhitelist: ['Mutation.*', 'Query.user'], // reports metrics als for these resolvers, leave `undefined` to report all fields
46
46
  deprecatedFields: true,
47
- registry: myRegistry, // If you are using a custom prom-client registry, please set it here
48
- }),
49
- ],
50
- });
47
+ registry: myRegistry // If you are using a custom prom-client registry, please set it here
48
+ })
49
+ ]
50
+ })
51
51
  ```
52
52
 
53
53
  > Note: Tracing resolvers using `resovlers: true` might have a performance impact on your GraphQL runtime. Please consider to test it locally first and then decide if it's needed.
@@ -57,19 +57,19 @@ const getEnveloped = envelop({
57
57
  You can customize the `prom-client` `Registry` object if you are using a custom one, by passing it along with the configuration object:
58
58
 
59
59
  ```ts
60
- import { Registry } from 'prom-client';
60
+ import { Registry } from 'prom-client'
61
61
 
62
- const myRegistry = new Registry();
62
+ const myRegistry = new Registry()
63
63
 
64
64
  const getEnveloped = envelop({
65
65
  plugins: [
66
66
  // ... other plugins ...
67
67
  usePrometheus({
68
68
  // ... config ...
69
- registry: myRegistry,
70
- }),
71
- ],
72
- });
69
+ registry: myRegistry
70
+ })
71
+ ]
72
+ })
73
73
  ```
74
74
 
75
75
  > Note: if you are using custom `prom-client` instances, you need to make sure to pass your registry there as well.
@@ -83,9 +83,9 @@ If you wish to disable introspection logging, you can use `skipIntrospection: tr
83
83
  Each tracing field supports custom `prom-client` objects, and custom `labels` a metadata, you can create a custom extraction function for every `Histogram` / `Summary` / `Counter`:
84
84
 
85
85
  ```ts
86
- import { Histogram } from 'prom-client';
87
- import { envelop } from '@envelop/core';
88
- import { createHistogram, usePrometheus } from '@envelop/prometheus';
86
+ import { Histogram } from 'prom-client'
87
+ import { envelop } from '@envelop/core'
88
+ import { createHistogram, usePrometheus } from '@envelop/prometheus'
89
89
 
90
90
  const getEnveloped = envelop({
91
91
  plugins: [
@@ -97,16 +97,16 @@ const getEnveloped = envelop({
97
97
  name: 'my_custom_name',
98
98
  help: 'HELP ME',
99
99
  labelNames: ['opText'] as const,
100
- registers: [registry], // make sure to add your custom registry, if you are not using the default one
100
+ registers: [registry] // make sure to add your custom registry, if you are not using the default one
101
101
  }),
102
102
  fillLabelsFn: params => {
103
103
  // if you wish to fill your `lables` with metadata, you can use the params in order to get access to things like DocumentNode, operationName, operationType, `error` (for error metrics) and `info` (for resolvers metrics)
104
104
  return {
105
- opText: print(params.document),
106
- };
107
- },
108
- }),
109
- }),
110
- ],
111
- });
105
+ opText: print(params.document)
106
+ }
107
+ }
108
+ })
109
+ })
110
+ ]
111
+ })
112
112
  ```
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/prometheus",
3
- "version": "6.4.0",
3
+ "version": "6.4.1-alpha-72027859.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "^2.4.0",
6
+ "@envelop/core": "2.4.1-alpha-72027859.0",
7
7
  "prom-client": "^13 || ^14.0.0",
8
8
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
9
9
  },