@graphql-yoga/plugin-prometheus 3.1.3-rc-20240119163500-4ff09069 → 4.0.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/cjs/index.js CHANGED
@@ -18,19 +18,13 @@ function usePrometheus(options) {
18
18
  return options.labels[label];
19
19
  }
20
20
  if (options.http) {
21
- const labelNames = ['url', 'method', 'statusCode', 'statusText'];
21
+ const labelNames = ['method', 'statusCode'];
22
22
  if (labelExists('operationName')) {
23
23
  labelNames.push('operationName');
24
24
  }
25
25
  if (labelExists('operationType')) {
26
26
  labelNames.push('operationType');
27
27
  }
28
- if (options.httpRequestHeaders) {
29
- labelNames.push('requestHeaders');
30
- }
31
- if (options.httpResponseHeaders) {
32
- labelNames.push('responseHeaders');
33
- }
34
28
  httpHistogram =
35
29
  typeof options.http === 'object'
36
30
  ? options.http
@@ -43,11 +37,8 @@ function usePrometheus(options) {
43
37
  }),
44
38
  fillLabelsFn(params, { request, response }) {
45
39
  const labels = {
46
- operationName: params.operationName || 'Anonymous',
47
- url: request.url,
48
40
  method: request.method,
49
41
  statusCode: response.status,
50
- statusText: response.statusText,
51
42
  };
52
43
  if (labelExists('operationType') && params.operationType) {
53
44
  labels.operationType = params.operationType;
@@ -55,12 +46,6 @@ function usePrometheus(options) {
55
46
  if (labelExists('operationName')) {
56
47
  labels.operationName = params.operationName || 'Anonymous';
57
48
  }
58
- if (options.httpRequestHeaders) {
59
- labels.requestHeaders = JSON.stringify(Object.fromEntries(request.headers.entries()));
60
- }
61
- if (options.httpResponseHeaders) {
62
- labels.responseHeaders = JSON.stringify(Object.fromEntries(response.headers.entries()));
63
- }
64
49
  return labels;
65
50
  },
66
51
  });
package/esm/index.js CHANGED
@@ -13,19 +13,13 @@ export function usePrometheus(options) {
13
13
  return options.labels[label];
14
14
  }
15
15
  if (options.http) {
16
- const labelNames = ['url', 'method', 'statusCode', 'statusText'];
16
+ const labelNames = ['method', 'statusCode'];
17
17
  if (labelExists('operationName')) {
18
18
  labelNames.push('operationName');
19
19
  }
20
20
  if (labelExists('operationType')) {
21
21
  labelNames.push('operationType');
22
22
  }
23
- if (options.httpRequestHeaders) {
24
- labelNames.push('requestHeaders');
25
- }
26
- if (options.httpResponseHeaders) {
27
- labelNames.push('responseHeaders');
28
- }
29
23
  httpHistogram =
30
24
  typeof options.http === 'object'
31
25
  ? options.http
@@ -38,11 +32,8 @@ export function usePrometheus(options) {
38
32
  }),
39
33
  fillLabelsFn(params, { request, response }) {
40
34
  const labels = {
41
- operationName: params.operationName || 'Anonymous',
42
- url: request.url,
43
35
  method: request.method,
44
36
  statusCode: response.status,
45
- statusText: response.statusText,
46
37
  };
47
38
  if (labelExists('operationType') && params.operationType) {
48
39
  labels.operationType = params.operationType;
@@ -50,12 +41,6 @@ export function usePrometheus(options) {
50
41
  if (labelExists('operationName')) {
51
42
  labels.operationName = params.operationName || 'Anonymous';
52
43
  }
53
- if (options.httpRequestHeaders) {
54
- labels.requestHeaders = JSON.stringify(Object.fromEntries(request.headers.entries()));
55
- }
56
- if (options.httpResponseHeaders) {
57
- labels.responseHeaders = JSON.stringify(Object.fromEntries(response.headers.entries()));
58
- }
59
44
  return labels;
60
45
  },
61
46
  });
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-yoga/plugin-prometheus",
3
- "version": "3.1.3-rc-20240119163500-4ff09069",
3
+ "version": "4.0.0",
4
4
  "description": "Prometheus plugin for GraphQL Yoga.",
5
5
  "peerDependencies": {
6
6
  "graphql": "^15.2.0 || ^16.0.0",
7
- "graphql-yoga": "5.1.2-rc-20240119163500-4ff09069",
7
+ "graphql-yoga": "^5.1.1",
8
8
  "prom-client": "^15.0.0"
9
9
  },
10
10
  "dependencies": {
11
- "@envelop/prometheus": "^9.2.0"
11
+ "@envelop/prometheus": "^9.3.1"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
@@ -3,8 +3,6 @@ import { createCounter, createHistogram, createSummary, PrometheusTracingPluginC
3
3
  export { createCounter, createHistogram, createSummary, FillLabelsFnParams };
4
4
  export interface PrometheusTracingPluginConfig extends EnvelopPrometheusTracingPluginConfig {
5
5
  http?: boolean | ReturnType<typeof createHistogram>;
6
- httpRequestHeaders?: boolean;
7
- httpResponseHeaders?: boolean;
8
6
  /**
9
7
  * The endpoint to serve metrics exposed by this plugin.
10
8
  * Defaults to "/metrics".
@@ -3,8 +3,6 @@ import { createCounter, createHistogram, createSummary, PrometheusTracingPluginC
3
3
  export { createCounter, createHistogram, createSummary, FillLabelsFnParams };
4
4
  export interface PrometheusTracingPluginConfig extends EnvelopPrometheusTracingPluginConfig {
5
5
  http?: boolean | ReturnType<typeof createHistogram>;
6
- httpRequestHeaders?: boolean;
7
- httpResponseHeaders?: boolean;
8
6
  /**
9
7
  * The endpoint to serve metrics exposed by this plugin.
10
8
  * Defaults to "/metrics".