@envelop/statsd 2.4.0-alpha-26c4ae2.0 → 2.4.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 +46 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ ## `@envelop/statsd`
2
+
3
+ This plugin tracks the complete execution flow, and reports metrics using StatsD (based on `hot-shots`).
4
+
5
+ Compatible with:
6
+
7
+ - Datadog's DogStatsD server
8
+ - InfluxDB's Telegraf StatsD server
9
+ - Etsy's StatsD serve
10
+
11
+ Available metrics:
12
+
13
+ - `graphql.operations.count` - the number of performed operations (including failures)
14
+ - `graphql.operations.error_count` - the number of failed operations
15
+ - `graphql.operations.latency` - a histogram of response times (in milliseconds)
16
+
17
+ > You can also customize the `graphql` prefix and add custom tags to the metrics.
18
+
19
+ ## Getting Started
20
+
21
+ ```
22
+ yarn add hot-shots @envelop/stats
23
+ ```
24
+
25
+ ## Usage Example
26
+
27
+ ```ts
28
+ import { envelop } from '@envelop/core';
29
+ import { useStatsD } from '@envelop/statsd';
30
+
31
+ const client = new StatsD({
32
+ port: 8020,
33
+ globalTags: { env: process.env.NODE_ENV },
34
+ });
35
+
36
+ const getEnveloped = envelop({
37
+ plugins: [
38
+ // ... other plugins ...
39
+ useStatsD({
40
+ client,
41
+ prefix: 'gql', // results in `gql.operations.count` instead of `graphql.operations.count`,
42
+ skipIntrospection: true, // if you wish to disable introspection logging
43
+ }),
44
+ ],
45
+ });
46
+ ```
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/statsd",
3
- "version": "2.4.0-alpha-26c4ae2.0",
3
+ "version": "2.4.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "2.4.0-alpha-26c4ae2.0",
6
+ "@envelop/core": "^2.4.0",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
8
8
  "hot-shots": "^8.0.0 || ^9.0.0"
9
9
  },