@graphql-mesh/plugin-prometheus 2.1.4 → 2.1.5-alpha-4bf654b5cbe967e4d6964d1be1a2befb81e6b7f1
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/CHANGELOG.md +11 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +51 -45
- package/dist/index.d.ts +51 -45
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @graphql-mesh/plugin-prometheus
|
|
2
2
|
|
|
3
|
+
## 2.1.5-alpha-4bf654b5cbe967e4d6964d1be1a2befb81e6b7f1
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#1719](https://github.com/graphql-hive/gateway/pull/1719) [`a049e8d`](https://github.com/graphql-hive/gateway/commit/a049e8ded1c35df972999f3e233e4d4168081902) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Built-in Prometheus plugin inherits the logger from context
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
- [#1719](https://github.com/graphql-hive/gateway/pull/1719) [`4bf654b`](https://github.com/graphql-hive/gateway/commit/4bf654b5cbe967e4d6964d1be1a2befb81e6b7f1) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Metrics configuration accepts `true` which will enable only the defaults
|
|
13
|
+
|
|
3
14
|
## 2.1.4
|
|
4
15
|
### Patch Changes
|
|
5
16
|
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -15,48 +15,53 @@ interface TransportEntry<Options extends Record<string, any> = Record<string, an
|
|
|
15
15
|
options?: Options;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
18
|
+
type MetricsConfig = NonNullable<PrometheusTracingPluginConfig['metrics']> & {
|
|
19
|
+
/**
|
|
20
|
+
* Tracks the duration of outgoing HTTP requests.
|
|
21
|
+
* It reports the time spent on each request made using the `fetch` function provided by Mesh.
|
|
22
|
+
* It is reported as an histogram.
|
|
23
|
+
*
|
|
24
|
+
* You can pass multiple type of values:
|
|
25
|
+
* - boolean: Disable or Enable the metric with default configuration
|
|
26
|
+
* - string: Enable the metric with custom name
|
|
27
|
+
* - number[]: Enable the metric with custom buckets
|
|
28
|
+
* - string[]: Enable the metric on a list of phases
|
|
29
|
+
* - ReturnType<typeof createHistogram>: Enable the metric with custom configuration
|
|
30
|
+
*/
|
|
31
|
+
graphql_gateway_fetch_duration?: HistogramMetricOption<'fetch', string, FetchMetricsLabelParams>;
|
|
32
|
+
/**
|
|
33
|
+
* Tracks the duration of subgraph execution.
|
|
34
|
+
* It reports the time spent on each subgraph queries made to resolve incoming operations as an
|
|
35
|
+
* histogram.
|
|
36
|
+
*
|
|
37
|
+
* You can pass multiple type of values:
|
|
38
|
+
* - boolean: Disable or Enable the metric with default configuration
|
|
39
|
+
* - string: Enable the metric with custom name
|
|
40
|
+
* - number[]: Enable the metric with custom buckets
|
|
41
|
+
* - string[]: Enable the metric on a list of phases
|
|
42
|
+
* - ReturnType<typeof createHistogram>: Enable the metric with custom configuration
|
|
43
|
+
*/
|
|
44
|
+
graphql_gateway_subgraph_execute_duration?: HistogramMetricOption<'subgraphExecute', string, SubgraphMetricsLabelParams>;
|
|
45
|
+
/**
|
|
46
|
+
* This metric tracks the number of errors that occurred during the subgraph execution.
|
|
47
|
+
* It counts all errors found in the response returned by the subgraph execution.
|
|
48
|
+
* It is exposed as a counter
|
|
49
|
+
*
|
|
50
|
+
* You can pass multiple type of values:
|
|
51
|
+
* - boolean: Disable or Enable the metric with default configuration
|
|
52
|
+
* - string: Enable the metric with custom name
|
|
53
|
+
* - number[]: Enable the metric with custom buckets
|
|
54
|
+
* - string[]: Enable the metric on a list of phases
|
|
55
|
+
* - ReturnType<typeof createHistogram>: Enable the metric with custom configuration
|
|
56
|
+
*/
|
|
57
|
+
graphql_gateway_subgraph_execute_errors?: CounterMetricOption<'subgraphExecute', string, SubgraphMetricsLabelParams>;
|
|
58
|
+
};
|
|
59
|
+
type PrometheusPluginOptions = PrometheusTracingPluginConfig & {
|
|
60
|
+
/**
|
|
61
|
+
* The metrics to provide when reporting to Prometheus.
|
|
62
|
+
* When `true`, defaults will be used from {@link DEFAULT_METRICS_CONFIG}.
|
|
63
|
+
*/
|
|
64
|
+
metrics: true | MetricsConfig;
|
|
60
65
|
labels?: {
|
|
61
66
|
/**
|
|
62
67
|
* The name of the targeted subgraph.
|
|
@@ -79,9 +84,8 @@ type MeshMetricsConfig = {
|
|
|
79
84
|
* The logger instance used by the plugin to log messages.
|
|
80
85
|
* This should be the logger instance provided by Mesh in the plugins context.
|
|
81
86
|
*/
|
|
82
|
-
log
|
|
87
|
+
log?: Logger;
|
|
83
88
|
};
|
|
84
|
-
type PrometheusPluginOptions = PrometheusTracingPluginConfig & MeshMetricsConfig;
|
|
85
89
|
type YamlConfig = {
|
|
86
90
|
baseDir?: string;
|
|
87
91
|
importFn?: ImportFn;
|
|
@@ -97,6 +101,8 @@ type FetchMetricsLabelParams = {
|
|
|
97
101
|
options: MeshFetchRequestInit;
|
|
98
102
|
response: Response;
|
|
99
103
|
};
|
|
100
|
-
declare function useMeshPrometheus(pluginOptions: Omit<PrometheusPluginOptions, 'registry'> & YamlConfig
|
|
104
|
+
declare function useMeshPrometheus(pluginOptions: Omit<PrometheusPluginOptions, 'registry'> & YamlConfig & {
|
|
105
|
+
log: Logger;
|
|
106
|
+
}): MeshPlugin<any> & Plugin & GatewayPlugin;
|
|
101
107
|
|
|
102
108
|
export { type PrometheusPluginOptions, useMeshPrometheus as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,48 +15,53 @@ interface TransportEntry<Options extends Record<string, any> = Record<string, an
|
|
|
15
15
|
options?: Options;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
18
|
+
type MetricsConfig = NonNullable<PrometheusTracingPluginConfig['metrics']> & {
|
|
19
|
+
/**
|
|
20
|
+
* Tracks the duration of outgoing HTTP requests.
|
|
21
|
+
* It reports the time spent on each request made using the `fetch` function provided by Mesh.
|
|
22
|
+
* It is reported as an histogram.
|
|
23
|
+
*
|
|
24
|
+
* You can pass multiple type of values:
|
|
25
|
+
* - boolean: Disable or Enable the metric with default configuration
|
|
26
|
+
* - string: Enable the metric with custom name
|
|
27
|
+
* - number[]: Enable the metric with custom buckets
|
|
28
|
+
* - string[]: Enable the metric on a list of phases
|
|
29
|
+
* - ReturnType<typeof createHistogram>: Enable the metric with custom configuration
|
|
30
|
+
*/
|
|
31
|
+
graphql_gateway_fetch_duration?: HistogramMetricOption<'fetch', string, FetchMetricsLabelParams>;
|
|
32
|
+
/**
|
|
33
|
+
* Tracks the duration of subgraph execution.
|
|
34
|
+
* It reports the time spent on each subgraph queries made to resolve incoming operations as an
|
|
35
|
+
* histogram.
|
|
36
|
+
*
|
|
37
|
+
* You can pass multiple type of values:
|
|
38
|
+
* - boolean: Disable or Enable the metric with default configuration
|
|
39
|
+
* - string: Enable the metric with custom name
|
|
40
|
+
* - number[]: Enable the metric with custom buckets
|
|
41
|
+
* - string[]: Enable the metric on a list of phases
|
|
42
|
+
* - ReturnType<typeof createHistogram>: Enable the metric with custom configuration
|
|
43
|
+
*/
|
|
44
|
+
graphql_gateway_subgraph_execute_duration?: HistogramMetricOption<'subgraphExecute', string, SubgraphMetricsLabelParams>;
|
|
45
|
+
/**
|
|
46
|
+
* This metric tracks the number of errors that occurred during the subgraph execution.
|
|
47
|
+
* It counts all errors found in the response returned by the subgraph execution.
|
|
48
|
+
* It is exposed as a counter
|
|
49
|
+
*
|
|
50
|
+
* You can pass multiple type of values:
|
|
51
|
+
* - boolean: Disable or Enable the metric with default configuration
|
|
52
|
+
* - string: Enable the metric with custom name
|
|
53
|
+
* - number[]: Enable the metric with custom buckets
|
|
54
|
+
* - string[]: Enable the metric on a list of phases
|
|
55
|
+
* - ReturnType<typeof createHistogram>: Enable the metric with custom configuration
|
|
56
|
+
*/
|
|
57
|
+
graphql_gateway_subgraph_execute_errors?: CounterMetricOption<'subgraphExecute', string, SubgraphMetricsLabelParams>;
|
|
58
|
+
};
|
|
59
|
+
type PrometheusPluginOptions = PrometheusTracingPluginConfig & {
|
|
60
|
+
/**
|
|
61
|
+
* The metrics to provide when reporting to Prometheus.
|
|
62
|
+
* When `true`, defaults will be used from {@link DEFAULT_METRICS_CONFIG}.
|
|
63
|
+
*/
|
|
64
|
+
metrics: true | MetricsConfig;
|
|
60
65
|
labels?: {
|
|
61
66
|
/**
|
|
62
67
|
* The name of the targeted subgraph.
|
|
@@ -79,9 +84,8 @@ type MeshMetricsConfig = {
|
|
|
79
84
|
* The logger instance used by the plugin to log messages.
|
|
80
85
|
* This should be the logger instance provided by Mesh in the plugins context.
|
|
81
86
|
*/
|
|
82
|
-
log
|
|
87
|
+
log?: Logger;
|
|
83
88
|
};
|
|
84
|
-
type PrometheusPluginOptions = PrometheusTracingPluginConfig & MeshMetricsConfig;
|
|
85
89
|
type YamlConfig = {
|
|
86
90
|
baseDir?: string;
|
|
87
91
|
importFn?: ImportFn;
|
|
@@ -97,6 +101,8 @@ type FetchMetricsLabelParams = {
|
|
|
97
101
|
options: MeshFetchRequestInit;
|
|
98
102
|
response: Response;
|
|
99
103
|
};
|
|
100
|
-
declare function useMeshPrometheus(pluginOptions: Omit<PrometheusPluginOptions, 'registry'> & YamlConfig
|
|
104
|
+
declare function useMeshPrometheus(pluginOptions: Omit<PrometheusPluginOptions, 'registry'> & YamlConfig & {
|
|
105
|
+
log: Logger;
|
|
106
|
+
}): MeshPlugin<any> & Plugin & GatewayPlugin;
|
|
101
107
|
|
|
102
108
|
export { type PrometheusPluginOptions, useMeshPrometheus as default };
|
package/dist/index.js
CHANGED