Skip to Content
Yoga

@envelop/prometheus

14.1.1

Patch Changes

  • Updated dependencies [0bfde27]:
    • @envelop/core@5.5.1
    • @envelop/on-resolve@7.1.1

14.1.0

Patch Changes

  • Updated dependencies [d3d83bc, 49346b2]:
    • @envelop/core@5.5.0
    • @envelop/on-resolve@7.1.0

14.0.0

Patch Changes

  • Updated dependencies [0434fbd]:
    • @envelop/core@5.4.0
    • @envelop/on-resolve@7.0.0

13.0.0

Patch Changes

  • Updated dependencies [3ebaa3b]:
    • @envelop/core@5.3.0
    • @envelop/on-resolve@6.0.0

12.1.3

Patch Changes

  • Updated dependencies [914f9ed, 914f9ed]:
    • @envelop/core@5.2.3
    • @envelop/on-resolve@5.1.3

12.1.2

Patch Changes

  • Updated dependencies [26137e7, 26137e7]:
    • @envelop/core@5.2.2
    • @envelop/on-resolve@5.1.2

12.1.1

Patch Changes

  • Updated dependencies [90dd1a6, 90dd1a6]:
    • @envelop/core@5.2.1
    • @envelop/on-resolve@5.1.1

12.1.0

Patch Changes

  • Updated dependencies [a107c89, a107c89]:
    • @envelop/core@5.2.0
    • @envelop/on-resolve@5.1.0

12.0.1

Patch Changes

  • Updated dependencies [5b6a166, 5b6a166]:
    • @envelop/core@5.1.1
    • @envelop/on-resolve@5.0.1

12.0.0

Patch Changes

  • Updated dependencies [9bd1b20]:
    • @envelop/core@5.1.0
    • @envelop/on-resolve@5.0.0

11.1.0

Minor Changes

  • #2326 443fc15 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'] } })

11.0.0

Major Changes

  • #2270 73eb69f 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 - 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_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, + } }) ] })

Minor Changes

10.0.0

Major Changes

  • #2217 7ac1d3c 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

  • Updated dependencies [dc1222f]:
    • @envelop/core@5.0.1

9.4.0

Minor Changes

9.3.1

Patch Changes

9.3.0

Minor Changes

9.2.0

Minor Changes

  • #2142 4c11530 Thanks @ardatan! - - Ability to hide operationName and operationType in the labels
    • Count schema changes
    • Catch errors during the context creation

9.1.0

Patch Changes

  • Updated dependencies [408f5be3]:
    • @envelop/on-resolve@4.1.0

9.0.0

Major Changes

Patch Changes

8.0.3

Patch Changes

8.0.2

Patch Changes

  • Updated dependencies [db20864a]:
    • @envelop/core@4.0.2
  • Updated dependencies []:
    • @envelop/on-resolve@3.0.2

8.0.1

Patch Changes

  • Updated dependencies []:
    • @envelop/core@4.0.1
  • Updated dependencies []:
    • @envelop/on-resolve@3.0.1

8.0.0

Major Changes

Patch Changes

7.0.6

Patch Changes

7.0.5

Patch Changes

  • Updated dependencies [270249cf]:
    • @envelop/core@3.0.5
  • Updated dependencies []:
    • @envelop/on-resolve@2.0.5

7.0.4

Patch Changes

  • Updated dependencies []:
    • @envelop/core@3.0.4
  • Updated dependencies []:
    • @envelop/on-resolve@2.0.4

7.0.3

Patch Changes

  • Updated dependencies [6b48ef96]:
    • @envelop/core@3.0.3
  • Updated dependencies []:
    • @envelop/on-resolve@2.0.3

7.0.2

Patch Changes

  • Updated dependencies [22f5ccfb]:
    • @envelop/core@3.0.2
  • Updated dependencies []:
    • @envelop/on-resolve@2.0.2

7.0.0

Major Changes

Patch Changes

  • Updated dependencies [dc1e24b5]:
    • @envelop/on-resolve@2.0.0

6.6.0

Minor Changes

  • #1499 1f7af02b Thanks @viniciuspalma! - Adding tslib to package dependencies

    Projects that currently are using yarn Berry with PnP or any strict dependency resolver, that requires that all dependencies are specified on package.json otherwise it would endue in an error if not treated correct

    Since https://www.typescriptlang.org/tsconfig#importHelpers is currently being used, tslib should be exported as a dependency to external runners get the proper import.

    Change on each package:

    // package.json { "dependencies": { "tslib": "^2.4.0" } }
  • Updated dependencies [1f7af02b, ae7bc9a3]:

    • @envelop/core@2.6.0

6.5.0

Minor Changes

6.4.2

Patch Changes

  • 071f946: Fix CommonJS TypeScript resolution with moduleResolution node16 or nodenext
  • Updated dependencies [071f946]
    • @envelop/core@2.4.2

6.4.1

Patch Changes

  • Updated dependencies [787d28a2]
    • @envelop/core@2.4.1

6.4.0

Minor Changes

  • 8bb2738: Support TypeScript module resolution.
  • Updated dependencies [8bb2738]
    • @envelop/core@2.4.0

6.3.3

Patch Changes

  • fbf6155: update package.json repository links to point to the new home
  • Updated dependencies [fbf6155]
    • @envelop/core@2.3.3

6.3.2

Patch Changes

  • Updated dependencies [07d029b]
    • @envelop/core@2.3.2

6.3.1

Patch Changes

  • Updated dependencies [d5c2c9a]
    • @envelop/core@2.3.1

6.3.0

Minor Changes

  • Updated dependencies [af23408]
    • @envelop/core@2.3.0

6.2.0

Minor Changes

  • Updated dependencies [ada7fb0]
  • Updated dependencies [d5115b4]
  • Updated dependencies [d5115b4]
    • @envelop/core@2.2.0

6.1.0

Minor Changes

  • Updated dependencies [78b3db2]
  • Updated dependencies [f5eb436]
    • @envelop/core@2.1.0

6.0.1

Patch Changes

  • f102d38: move @envelop/core dependency to peerDependencies

6.0.0

Patch Changes

  • Updated dependencies [4106e08]
  • Updated dependencies [aac65ef]
  • Updated dependencies [4106e08]
    • @envelop/core@2.0.0

5.0.0

Patch Changes

  • Updated dependencies [d9cfb7c]
    • @envelop/core@1.7.0

4.2.1

Patch Changes

  • b1a0331: Properly list @envelop/core as a peerDependency in plugins.

    This resolves issues where the bundled envelop plugins published to npm had logic inlined from the @envelop/core package, causing instanceof check of EnvelopError to fail.

  • Updated dependencies [b1a0331]

    • @envelop/core@1.6.1

4.2.0

Minor Changes

  • 090cae4: GraphQL v16 support

4.1.0

Minor Changes

  • 04120de: add support for GraphQL.js 16

4.0.0

Patch Changes

  • Updated dependencies [d65e35d]
  • Updated dependencies [26475c9]
    • @envelop/core@1.3.0

3.0.0

Patch Changes

  • Updated dependencies [eb0a4bd]
    • @envelop/core@1.2.0

2.0.0

Patch Changes

  • Updated dependencies [7704fc3]
  • Updated dependencies [7704fc3]
  • Updated dependencies [7704fc3]
    • @envelop/core@1.1.0

1.0.3

Patch Changes

  • 452af8f: Update dependencies of graphql-tools to latest
  • Updated dependencies [452af8f]
    • @envelop/core@1.0.3

1.0.2

Patch Changes

  • 94db02d: Update usage of plugins to use the correct isAsyncIterable and new helper handleStreamOrSingleExecutionResult
  • Updated dependencies [94db02d]
  • Updated dependencies [94db02d]
    • @envelop/core@1.0.2

1.0.1

Patch Changes

  • 8021229: fix ESM graphql import
  • Updated dependencies [c24a8fd]
  • Updated dependencies [f45c0bf]
  • Updated dependencies [8021229]
  • Updated dependencies [adca399]
    • @envelop/core@1.0.1

1.0.0

Major Changes

  • 40bc444: v1 major release for envelop packages

Patch Changes

  • Updated dependencies [dbb241d]
  • Updated dependencies [40bc444]
    • @envelop/core@1.0.0

0.2.0

Minor Changes

  • e151100: Add support for tracking amount of requests
  • e151100: Expose entire context object as part of the FillParams fn
  • e151100: Added option to skipIntrospection
  • e151100: Add support for tracking total “graphql” time

Patch Changes

  • e151100: Set the defualt options to {}
  • e151100: Use static checking with TypeInfo for “deprecatedFields” counter
  • e151100: Fix issues with serialized [Object object] in some built-ins
  • e151100: Cleanup, fix some implementation details

0.1.0

Minor Changes

  • ccc6cfa: New plugin for prometheus metrics