Skip to content

Commit c197edd

Browse files
committed
[prometheus] fix documentation
1 parent d644d85 commit c197edd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

website/src/pages/docs/features/monitoring.mdx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ npm i prom-client @graphql-yoga/plugin-prometheus
2525
You can then add the plugin to your GraphQL server:
2626

2727
```ts
28-
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
29-
import { envelop, useEngine } from '@envelop/core'
30-
import { usePrometheus } from '@envelop/prometheus'
28+
import { createYoga } from 'graphql-yoga'
29+
import { usePrometheus } from '@graphql-yoga/plugin-prometheus'
3130

32-
const getEnveloped = envelop({
31+
const yoga = createYoga({
3332
plugins: [
34-
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
35-
// ... other plugins ...
33+
schema: mySchema, // Provide your GraphQL schema
3634
usePrometheus({
3735
endpoint: '/metrics', // optional, default is `/metrics`, you can disable it by setting it to `false` if registry is configured in "push" mode
3836
// Optional, see default values below
@@ -58,6 +56,11 @@ const getEnveloped = envelop({
5856
})
5957
]
6058
})
59+
60+
const server = createServer(yoga)
61+
server.listen(4000, () => {
62+
console.log(`Server is running on http://localhost:4000/${server.graphqlEndpoint}`)
63+
})
6164
```
6265

6366
<Callout type="warning">

0 commit comments

Comments
 (0)