Releases: graphql-hive/envelop
August 20, 2024
@envelop/core@5.0.2
Patch Changes
@envelop/on-resolve@4.1.1
Patch Changes
-
#2292
c3dd2c3
Thanks @ardatan! - Refactor the plugin to avoid extra promises with
`mapMaybePromise` -
Updated dependencies
[c3dd2c3
]:- @envelop/core@5.0.2
@envelop/rate-limiter@6.2.0
Minor Changes
-
#2292
c3dd2c3
Thanks @ardatan! - Now you can define a custom string interpolation
function to be used in the rate limit message. This is useful when you want to include dynamic
values in the message.useRateLimiter({ configByField: [ { type: 'Query', field: 'search', // You can also use glob patterns max: 10, window: '1m', message: 'My custom message with interpolated values: ${args.searchTerm} and ${context.user.id}' } ], interpolateMessage: (message, args, context) => { return message.replace(/\${(.*?)}/g, (_, key) => { return key.split('.').reduce((acc, part) => acc[part], { args, context }) }) } })
-
#2292
c3dd2c3
Thanks @ardatan! - New directive SDL;directive @rateLimit( max: Int window: String message: String identityArgs: [String] arrayLengthField: String readOnly: Boolean uncountRejected: Boolean ) on FIELD_DEFINITION
-
#2292
c3dd2c3
Thanks @ardatan! - Programmatic API to define rate limit
configuration in addition to directivesuseRateLimiter({ configByField: [ { type: 'Query', field: 'search', // You can also use glob patterns max: 10, window: '1m' } ] })
Patch Changes
-
#2292
c3dd2c3
Thanks @ardatan! - dependencies updates:- Updated dependency
graphql-rate-limit@^3.3.0
↗︎
(from3.3.0
, independencies
) - Added dependency
@graphql-tools/utils@^10.5.4
↗︎
(todependencies
) - Added dependency
minimatch@^10.0.1
↗︎ (to
dependencies
)
- Updated dependency
-
#2276
ba368ba
Thanks @deggertsen! - useRateLimiter will now accept all options
available to graphql-rate-limit getGraphQLRateLimiter function so that they are usable. -
Updated dependencies
[c3dd2c3
,
c3dd2c3
]:- @envelop/on-resolve@4.1.1
- @envelop/core@5.0.2
August 13, 2024
@envelop/prometheus@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
- #2270
73eb69f
Thanks @EmrysMyrddin! - Add missing labelspath
andphase
ofgraphql_envelop_error_result
metric to the configuration.
July 16, 2024
@envelop/response-cache@6.2.1
Patch Changes
- #2266
389d5f6
Thanks @EmrysMyrddin! - The plugin now try to reduce the size
of the resulting query by not adding a__typename
aliased selection if__typename
is already
selected.
May 30, 2024
@envelop/response-cache@6.2.0
Minor Changes
- #2238
430ee7d
Thanks @ardatan! - Accept a factory function tocache
that takes
the context and returns the cache implementation
@envelop/response-cache-cloudflare-kv@1.0.0
Minor Changes
-
#2238
430ee7d
Thanks @ardatan! - BREAKING: Now the cache implementation does not
require theExecutionContext
orKVNamespace
instance but only the name of the namespaceimport { createSchema, createYoga, YogaInitialContext } from 'graphql-yoga' import { useResponseCache } from '@envelop/response-cache' import { createKvCache } from '@envelop/response-cache-cloudflare-kv' import { resolvers } from './graphql-schema/resolvers.generated' import { typeDefs } from './graphql-schema/typeDefs.generated' export type Env = { GRAPHQL_RESPONSE_CACHE: KVNamespace } const graphqlServer = createYoga<Env & ExecutionContext>({ schema: createSchema({ typeDefs, resolvers }), plugins: [ useResponseCache({ cache: createKvCache({ KVName: 'GRAPHQL_RESPONSE_CACHE', keyPrefix: 'graphql' // optional }), session: () => null, includeExtensionMetadata: true, ttl: 1000 * 10 // 10 seconds }) ] }) export default { fetch: graphqlServer }
Patch Changes
- Updated dependencies
[430ee7d
]:- @envelop/response-cache@6.2.0
May 08, 2024
@envelop/core@5.0.1
Patch Changes
@envelop/opentelemetry@6.3.1
Patch Changes
-
#2218
75b73fb
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@opentelemetry/api@^1.8.0
↗︎
(from^1.0.0
, independencies
)
- Updated dependency
-
Updated dependencies
[dc1222f
]:- @envelop/core@5.0.1
@envelop/prometheus@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 (ardatan/graphql-mesh#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
- Updated dependencies
[dc1222f
]:- @envelop/core@5.0.1
April 02, 2024
@envelop/graphql-jit@8.0.3
Patch Changes
-
#2188
3a32aa9
Thanks @renovate! - dependencies updates:- Updated dependency
graphql-jit@0.8.6
↗︎
(from0.8.5
, independencies
)
- Updated dependency
@envelop/opentelemetry@6.3.0
Minor Changes
-
#2201
396bccb
Thanks @dotansimha! - feat: exclude operations by using list of
names or a custom function -
#2201
396bccb
Thanks @dotansimha! - feat: allow to use a custom function to
resolve/sanitize variables
@envelop/sentry@9.0.0
Major Changes
- #2163
7686b33
Thanks @MarcelCutts! - Removed includedResolverArgs from
SentryPluginOptions as it lead to no functionality.
March 18, 2024
@envelop/graphql-jit@8.0.2
Patch Changes
-
#2177
dded74e
Thanks @renovate! - dependencies updates:- Updated dependency
graphql-jit@0.8.5
↗︎
(from0.8.2
, independencies
)
- Updated dependency