Skip to Content
Yoga

@graphql-yoga/plugin-prometheus

6.7.1

Patch Changes

  • Updated dependencies [fbf328c]:
    • graphql-yoga@5.12.1

6.7.0

Patch Changes

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

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 the response and request through the context argument.

    This is now deprecated, request and response are now available in the first params argument. This change allows to provide better typing, since context is not typed.

Patch Changes

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 labels path and phase of graphql_envelop_error_result metric to the configuration.

    Add missing labels method and statusCode of graphql_yoga_http_duration metric to the configuration.

Patch Changes

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

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 and createCounter 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

4.2.0

Patch Changes

4.1.0

Minor Changes

  • 9047d76d Thanks @ardatan! - Ability to rename the metrics without creating a new histogram

Patch Changes

4.0.0

Major Changes

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

Patch Changes

2.0.6

Patch Changes

2.0.5

Patch Changes

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

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

1.7.0

Patch Changes

1.6.1

Patch Changes

  • Updated dependencies [3c8c8434]:
    • graphql-yoga@3.6.1

1.6.0

Patch Changes

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

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

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

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