@graphql-yoga/plugin-prometheus
6.7.1
Patch Changes
- Updated dependencies
[
fbf328c
]:- graphql-yoga@5.12.1
6.7.0
Patch Changes
- #3780
ea63828
Thanks @renovate ! - dependencies updates:- Updated dependency
@envelop/prometheus@^12.0.0
↗︎ (from^11.1.0
, independencies
)
- Updated dependency
- Updated dependencies
[
96498ee
,5150146
,5150146
]:- graphql-yoga@5.12.0
6.6.0
Patch Changes
6.5.9
Patch Changes
- Updated dependencies
[
1c055f5
]:- graphql-yoga@5.10.11
6.5.8
Patch Changes
- Updated dependencies []:
- graphql-yoga@5.10.10
6.5.7
Patch Changes
- #3651
690294a
Thanks @ardatan ! -request
is missing when GraphQL WS is used as expected, and as we don’t need HTTP/Yoga specific metrics, this should be skipped
6.5.6
Patch Changes
6.5.5
Patch Changes
- Updated dependencies
[
ed344ea
]:- graphql-yoga@5.10.8
6.5.4
Patch Changes
6.5.3
Patch Changes
- Updated dependencies
[
121ccba
]:- graphql-yoga@5.10.6
6.5.2
Patch Changes
6.5.1
Patch Changes
- #3520
944ecd5
Thanks @ardatan ! - dependencies updates:- Updated dependency
@envelop/prometheus@^11.1.0
↗︎ (from11.1.0
, independencies
)
- Updated dependency
- Updated dependencies
[
944ecd5
]:- graphql-yoga@5.10.4
6.5.0
Minor Changes
-
#3489
131dfa3
Thanks @EmrysMyrddin ! - Allow to explicitly control which events and timing should be observe.Each metric can now be configured to observe events and timings only for certain GraphQL pipeline phases, or depending on the request context.
Example: trace only execution and subscription errors
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql' import { envelop, useEngine } from '@envelop/core' import { usePrometheus } from '@envelop/prometheus' const TRACKED_OPERATION_NAMES = [ // make a list of operation that you want to monitor ] const getEnveloped = envelop({ plugins: [ useEngine({ parse, validate, specifiedRules, execute, subscribe }), usePrometheus({ metrics: { // Here, an array of phases can be provided to enable the metric only on certain phases. // In this example, only error happening during the execute and subscribe phases will tracked graphql_envelop_phase_error: ['execute', 'subscribe'] } }) ] })
Example: Monitor timing only of a set of operations by name
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql' import { envelop, useEngine } from '@envelop/core' import { usePrometheus } from '@envelop/prometheus' const TRACKED_OPERATION_NAMES = [ // make a list of operation that you want to monitor ] const getEnveloped = envelop({ plugins: [ useEngine({ parse, validate, specifiedRules, execute, subscribe }), usePrometheus({ metrics: { graphql_yoga_http_duration: createHistogram({ registry, histogram: { name: 'graphql_envelop_request_duration', help: 'Time spent on HTTP connection', labelNames: ['operationName'] }, fillLabelsFn: ({ operationName }, _rawContext) => ({ operationName }), phases: ['execute', 'subscribe'], // Here `shouldObserve` control if the request timing should be observed, based on context shouldObserve: ({ operationName }) => TRACKED_OPERATIONS.includes(operationName) }) } }) ] })
Default Behavior Change
A metric is enabled using
true
value in metrics options will observe in every phases available.Previously, which phase was observe was depending on which other metric were enabled. For example, this config would only trace validation error:
usePrometheus({ metrics: { graphql_envelop_phase_error: true, graphql_envelop_phase_validate: true } })
This is no longer the case. If you were relying on this behavior, please use an array of string to restrict observed phases.
usePrometheus({ metrics: { graphql_envelop_phase_error: ['validate'] } })
Deprecation
The
fillLabelFn
function was provided theresponse
andrequest
through thecontext
argument.This is now deprecated,
request
andresponse
are now available in the firstparams
argument. This change allows to provide better typing, sincecontext
is not typed.
Patch Changes
-
#3489
131dfa3
Thanks @EmrysMyrddin ! - dependencies updates:- Updated dependency
@envelop/prometheus@11.1.0-alpha-20241122091727-adade563355e3d213f27427a9a1d86adf9431d41
↗︎ (from11.0.0
, independencies
)
- Updated dependency
-
#3519
ca1e8b4
Thanks @EmrysMyrddin ! - dependencies updates:- Updated dependency
@envelop/prometheus@11.1.0
↗︎ (from11.1.0-alpha-20241122091727-adade563355e3d213f27427a9a1d86adf9431d41
, independencies
)
- Updated dependency
6.4.3
Patch Changes
6.4.2
Patch Changes
6.4.1
Patch Changes
- Updated dependencies
[
20cd9b6
]:- graphql-yoga@5.10.1
6.4.0
Patch Changes
- Updated dependencies
[
f81501c
]:- graphql-yoga@5.10.0
6.3.0
Patch Changes
6.2.0
Patch Changes
6.1.0
Patch Changes
6.0.0
Major Changes
-
#3391
0788d8a
Thanks @EmrysMyrddin ! - Breaking Change: Rename all metrics options to their actual metric name to avoid confusion.All metric options have been moved under a mandatory
metrics
key, and the name of each options have been renamed to match the default metric name.The plugin option argument is also now mandatory.
export const serveConfig = defineConfig({ plugins: pluginCtx => [ usePrometheus({ ...pluginCtx, // Enable all available metrics - http: true - requestSummary: true, - parse: true, - validate: true, - contextBuilding: true, - execute: true, - subscribe: true, - errors: true, - deprecatedFields: true, - requestTotalDuration: true, - schemaChangeCount: true, // Warning: enabling resolvers level metrics will introduce significant overhead - resolvers: true, + metrics: { + graphql_yoga_http_duration: true, + graphql_envelop_request_time_summary: true, + graphql_envelop_phase_parse: true, + graphql_envelop_phase_validate: true, + graphql_envelop_phase_context: true, + graphql_envelop_phase_execute: true, + graphql_envelop_phase_subscribe: true, + graphql_envelop_error_result: true, + graphql_envelop_deprecated_field: true, + graphql_envelop_request_duration: true, + graphql_envelop_schema_change: true, // Warning: enabling resolvers level metrics will introduce significant overhead + graphql_envelop_execute_resolver: true, + } }) ] })
-
#3408
88393b3
Thanks @dotansimha ! - By default, the following metrics are now enabled:graphql_envelop_deprecated_field
graphql_envelop_request
graphql_envelop_request_duration
graphql_envelop_request_time_summary
graphql_envelop_phase_parse
graphql_envelop_phase_validate
graphql_envelop_phase_context
graphql_envelop_error_result
graphql_envelop_phase_execute
graphql_envelop_phase_subscribe
graphql_envelop_schema_change
graphql_yoga_http_duration
Minor Changes
-
#3391
0788d8a
Thanks @EmrysMyrddin ! - Add missing labelspath
andphase
ofgraphql_envelop_error_result
metric to the configuration.Add missing labels
method
andstatusCode
ofgraphql_yoga_http_duration
metric to the configuration.
Patch Changes
- #3391
0788d8a
Thanks @EmrysMyrddin ! - dependencies updates:- Updated dependency
@envelop/prometheus@11.0.0
↗︎ (from^10.0.0
, independencies
)
- Updated dependency
5.3.3
Patch Changes
- Updated dependencies
[
0866c1b
]:- graphql-yoga@5.6.3
5.3.2
Patch Changes
5.3.1
Patch Changes
- Updated dependencies
[
4252e3d
]:- graphql-yoga@5.6.1
5.3.0
Patch Changes
- Updated dependencies
[
9f3f945
]:- graphql-yoga@5.6.0
5.2.0
Patch Changes
- Updated dependencies
[
0208024
]:- graphql-yoga@5.5.0
5.1.0
Patch Changes
-
#3300
fdd902c
Thanks @EmrysMyrddin ! - dependencies updates:- Updated dependency
graphql-yoga@workspace:^
↗︎ (from^5.3.1
, inpeerDependencies
)
- Updated dependency
-
#3278
edf3737
Thanks @EmrysMyrddin ! - Fix labels not filled properly on invalid operations -
Updated dependencies [
4cd43b9
,fdd902c
,d5dfe99
,7335a82
,f9aa1cd
]:- graphql-yoga@5.4.0
5.0.0
Major Changes
-
#3251
a8ddac54
Thanks @EmrysMyrddin ! - Adds a cache for metrics definition (Summary, Histogram and Counter).Fixes an issue preventing this plugin to be initialized multiple times, leading to metrics duplication error (https://github.com/ardatan/graphql-mesh/issues/6545 ).
Behavior Breaking Change:
Due to Prometheus client API limitations, a metric is only defined once for a given registry. This means that if the configuration of the metrics, it will be silently ignored on plugin re-initialization.
This is to avoid potential loss of metrics data produced between the plugin re-initialization and the last pull by the prometheus agent.
If you need to be sure metrics configuration is up to date after a plugin re-initialization, you can either:
- restart the whole node process instead of just recreating a graphql server at runtime
- clear the registry using
registry.clear()
before plugin re-initialization:function usePrometheusWithReset() { registry.clear() return usePrometheus({ ... }) }
- use a new registry for each plugin instance:
function usePrometheusWithRegistry() { const registry = new Registry() return usePrometheus({ registry, ... }) }
Keep in mind that this implies potential data loss in pull mode.
API Breaking Change:
To ensure metrics from being registered multiple times on the same registry, the signature of
createHistogram
,createSummary
andcreateCounter
have been changed to now include the registry as a mandatory parameter.If you were customizing metrics parameters, you will need to update the metric definitions
usePrometheus({ execute: createHistogram({ + registry: registry histogram: new Histogram({ name: 'my_custom_name', help: 'HELP ME', labelNames: ['opText'] as const, - registers: [registry], }), fillLabelsFn: () => {} }), requestCount: createCounter({ + registry: registry histogram: new Histogram({ name: 'my_custom_name', help: 'HELP ME', labelNames: ['opText'] as const, - registers: [registry], }), fillLabelsFn: () => {} }), requestSummary: createSummary({ + registry: registry histogram: new Histogram({ name: 'my_custom_name', help: 'HELP ME', labelNames: ['opText'] as const, - registers: [registry], }), fillLabelsFn: () => {} }), })
Patch Changes
- #3251
a8ddac54
Thanks @EmrysMyrddin ! - dependencies updates:- Updated dependency
@envelop/prometheus@^10.0.0
↗︎ (from^9.4.0
, independencies
)
- Updated dependency
- Updated dependencies
[
3324bbab
,3324bbab
]:- graphql-yoga@5.3.1
4.2.0
Patch Changes
4.1.0
Minor Changes
Patch Changes
4.0.0
Major Changes
- #3179
7dc37e62
Thanks @darren-west ! - Removed labels that cause high cardinality
3.1.2
Patch Changes
3.1.1
Patch Changes
- Updated dependencies
[
3ef877a7
]:- graphql-yoga@5.1.1
3.1.0
Patch Changes
- Updated dependencies
[
b1f0e3a2
]:- graphql-yoga@5.1.0
3.0.2
Patch Changes
- Updated dependencies
[
77d107fe
]:- graphql-yoga@5.0.2
3.0.1
Patch Changes
- Updated dependencies
[
3fea19f2
]:- graphql-yoga@5.0.1
3.0.0
Major Changes
-
#3050
17343a1e
Thanks @renovate ! - dependencies updates:- Updated dependency
prom-client@^15.0.0
↗︎ (from^13 || ^14.0.0
, inpeerDependencies
)
- Updated dependency
-
#3070
5b615478
Thanks @renovate ! - dependencies updates:- Updated dependency
@envelop/prometheus@9.0.0
↗︎ (from8.0.3
, independencies
)
- Updated dependency
-
#3063
01430e03
Thanks @EmrysMyrddin ! - Breaking Change: Drop support of Node.js 16
Patch Changes
2.0.6
Patch Changes
-
#2985
75ee8523
Thanks @ardatan ! - dependencies updates:- Updated dependency
@envelop/prometheus@8.0.1
↗︎ (from8.0.0
, independencies
)
- Updated dependency
-
#3026
365d0284
Thanks @renovate ! - dependencies updates:- Updated dependency
@envelop/prometheus@8.0.3
↗︎ (from8.0.1
, independencies
)
- Updated dependency
-
Updated dependencies [
bf602edf
]:- graphql-yoga@4.0.5
2.0.5
Patch Changes
- #2980
6fd67f7e
Thanks @renovate ! - dependencies updates:- Updated dependency
@envelop/prometheus@8.0.1
↗︎ (from8.0.0
, independencies
)
- Updated dependency
2.0.4
Patch Changes
- Updated dependencies
[
5f182006
]:- graphql-yoga@4.0.4
2.0.3
Patch Changes
- Updated dependencies
[
5efb8250
]:- graphql-yoga@4.0.3
2.0.2
Patch Changes
- Updated dependencies
[
ce6d2465
]:- graphql-yoga@4.0.2
2.0.1
Patch Changes
2.0.0
Major Changes
Patch Changes
- Updated dependencies
[
4228c1d5
,34ecb4bb
,ec318fe6
,cc370691
,b309ca0d
,dd699c4b
,4228c1d5
,0522c740
]:- graphql-yoga@4.0.0
1.9.1
Patch Changes
1.9.0
Patch Changes
- Updated dependencies
[
aff69200
]:- graphql-yoga@3.9.0
1.8.1
Patch Changes
1.8.0
Patch Changes
1.7.3
Patch Changes
- Updated dependencies
[
46e75917
]:- graphql-yoga@3.7.3
1.7.2
Patch Changes
- Updated dependencies
[
7ad50529
]:- graphql-yoga@3.7.2
1.7.1
Patch Changes
- #2472
ae18a7cb
Thanks @renovate ! - dependencies updates:- Updated dependency
@envelop/prometheus@7.0.6
↗︎ (from7.0.5
, independencies
)
- Updated dependency
- Updated dependencies
[
9fdd94b5
,47b1c4a4
,02ac055c
,02ac055c
]:- graphql-yoga@3.7.1
1.7.0
Patch Changes
-
#2452
64f769ec
Thanks @ardatan ! - dependencies updates:- Updated dependency
@envelop/prometheus@7.0.5
↗︎ (from7.0.4
, independencies
)
- Updated dependency
-
#2460
aff16d01
Thanks @renovate ! - dependencies updates:- Updated dependency
@envelop/prometheus@7.0.5
↗︎ (from7.0.4
, independencies
)
- Updated dependency
-
Updated dependencies [
23d1b26c
,9e743db5
,23d1b26c
]:- graphql-yoga@3.7.0
1.6.1
Patch Changes
- Updated dependencies
[
3c8c8434
]:- graphql-yoga@3.6.1
1.6.0
Patch Changes
-
#2411
a747d249
Thanks @ardatan ! - dependencies updates:- Added dependency
graphql@^15.2.0 || ^16.0.0
↗︎ (topeerDependencies
)
- Added dependency
-
#2411
a747d249
Thanks @ardatan ! - Allow customizations in prometheus plugin -
Updated dependencies [
790330be
,6bc1410f
,ddb2607d
,6bc1410f
,1caac99b
,790330be
,7587d5c5
,cc0d3899
,a747d249
,2933fc89
,543e490b
]:- graphql-yoga@3.6.0
1.5.1
Patch Changes
- Updated dependencies
[
3a8446df
]:- graphql-yoga@3.5.1
1.5.0
Patch Changes
- Updated dependencies
[
03597a5a
]:- graphql-yoga@3.5.0
1.4.1
Patch Changes
1.4.0
Patch Changes
- Updated dependencies
[
76c1ecb9
,8cd8b5a5
,6e8bddba
,6ee252db
,8f139e15
,9beef914
,c46d75e8
,f9ab8a70
]:- graphql-yoga@3.4.0
1.3.1
Patch Changes
- Updated dependencies
[
d4dab446
]:- graphql-yoga@3.3.1
1.3.0
Patch Changes
1.2.1
Patch Changes
- Updated dependencies
[
5528d312
]:- graphql-yoga@3.2.1
1.2.0
Patch Changes
1.1.2
Patch Changes
1.1.1
Patch Changes
- Updated dependencies
[
534780c9
]:- graphql-yoga@3.1.1
1.1.0
Patch Changes
1.0.3
Patch Changes
- #2156
491ef5da
Thanks @renovate ! - dependencies updates:- Updated dependency
@envelop/prometheus@7.0.4
↗︎ (from7.0.3
, independencies
)
- Updated dependency
- Updated dependencies
[
491ef5da
]:- graphql-yoga@3.0.3
1.0.2
Patch Changes
1.0.1
Patch Changes
- Updated dependencies
[
d63fe841
]:- graphql-yoga@3.0.1
1.0.0
Major Changes
Patch Changes
- Updated dependencies
[
2e0c4824
,8773a27f
,720898db
,9f991a27
,6e250209
,cebca219
,eeaced00
,74e1f830
,e7a47b56
,5f5b1160
,1d7f810a
,209b1620
,098e139f
,73e56068
,02d2aecd
,74e1f830
,c4b3a9c8
,b079c93b
,71554172
,b19a9104
,1d5cde96
,44878a5b
,1d508495
]:- graphql-yoga@3.0.0
1.0.0-next.6
Patch Changes
- Updated dependencies
[
73e56068
]:- graphql-yoga@3.0.0-next.12
1.0.0-next.5
Patch Changes
1.0.0-next.4
Patch Changes
1.0.0-next.3
Patch Changes
1.0.0-next.2
Patch Changes
- Updated dependencies
[
6e250209
]:- graphql-yoga@3.0.0-next.8
1.0.0-next.1
Patch Changes
1.0.0-next.0
Major Changes
Patch Changes
- Updated dependencies
[
dc45a7b5
]:- graphql-yoga@3.0.0-next.6