Skip to content

Commit

Permalink
chore(release): update monorepo packages versions
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 12, 2024
1 parent 8e3529c commit 17b8c70
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 75 deletions.
74 changes: 0 additions & 74 deletions .changeset/cold-seals-play.md

This file was deleted.

78 changes: 78 additions & 0 deletions packages/plugins/prometheus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,83 @@
# @envelop/prometheus

## 12.0.0

### Major Changes

- [#2317](https://github.com/n1ru4l/envelop/pull/2317)
[`0977ef7`](https://github.com/n1ru4l/envelop/commit/0977ef74dc997108229c8906a650bfbd922a45f1)
Thanks [@EmrysMyrddin](https://github.com/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.

```ts
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: {

// only trace errors of execute and subscribe phases
graphql_envelop_phase_error: ['execute', 'subscribe']

// only monitor timing of some operations
graphql_yoga_http_duration: createHistogram({
registry,
histogram: {
name: 'graphql_envelop_request_duration',
help: 'Time spent on HTTP connection',
labelNames: ['operation_name']
},
fillLabelsFn: ({ operationName }, _rawContext) => ({
operation_name: operationName,
}),
phases: ['execute', 'subscribe'],

// Here `shouldObserve` control if the request timing should be observed, based on context
shouldObserve: (_, context) => TRACKED_OPERATIONS.includes(context?.params?.operationName),
})
},
})
]
})
```

**Breaking 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:

```ts
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.

```ts
usePrometheus({
metrics: {
graphql_envelop_phase_error: ['validate']
}
})
```

## 11.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/prometheus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@envelop/prometheus",
"version": "11.0.0",
"version": "12.0.0",
"type": "module",
"repository": {
"type": "git",
Expand Down

0 comments on commit 17b8c70

Please sign in to comment.