@prisma/extension-optimize 0.0.0-dev.202408252347 → 0.0.0-dev.202408260920
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -50
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,26 +13,19 @@ Prisma is leading Data DX, a philosophy that promotes simplicity in data-driven
|
|
|
13
13
|
|
|
14
14
|
## Getting started with Prisma Optimize
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Enabling Prisma Optimize in your local development workflow is really simple.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### 1. Install the extension
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Using Optimize
|
|
25
|
-
|
|
26
|
-
#### 1. Launch Optimize
|
|
27
|
-
|
|
28
|
-
1. Log in to your [Prisma Data Platform](https://console.prisma.io/login?utm_source=github&utm_medium=optimize-readme) account.
|
|
29
|
-
2. Access and launch the Optimize dashboard by following the instructions here.
|
|
20
|
+
```
|
|
21
|
+
npm install @prisma/extension-optimize --save-dev
|
|
22
|
+
```
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
> Starting a Prisma ORM project from scratch? Follow https://www.prisma.io/docs/getting-started
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
### 2. Enable the `tracing` preview feature in your Prisma schema
|
|
34
27
|
|
|
35
|
-
Prisma Optimize uses [Prisma ORM's OpenTelemetry tracing functionality](https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/opentelemetry-tracing).
|
|
28
|
+
Prisma Optimize uses [Prisma ORM's OpenTelemetry tracing functionality](https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/opentelemetry-tracing). Enabled it in your Prisma schema:
|
|
36
29
|
|
|
37
30
|
```diff
|
|
38
31
|
generator client {
|
|
@@ -41,53 +34,37 @@ Prisma Optimize uses [Prisma ORM's OpenTelemetry tracing functionality](https://
|
|
|
41
34
|
}
|
|
42
35
|
```
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```shell
|
|
47
|
-
npx prisma generate
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
##### 2.2. Install the Optimize Prisma Client extension
|
|
51
|
-
|
|
52
|
-
Install the latest versions of Prisma Client and the Optimize extension:
|
|
37
|
+
After enabling the `tracing` preview feature, you need to re-generate your Prisma Client:
|
|
53
38
|
|
|
54
|
-
```shell
|
|
55
|
-
npm install @prisma/client@latest @prisma/extension-optimize
|
|
56
39
|
```
|
|
57
|
-
|
|
58
|
-
##### 2.3. Create an API Key via Optimize's UI and add it to your .env file
|
|
59
|
-
|
|
60
|
-
Generate an Optimize API key by following the instructions [here](https://pris.ly/optimize/r/api-token-generation) and add it to your .env file:
|
|
61
|
-
|
|
62
|
-
```env
|
|
63
|
-
OPTIMIZE_API_KEY="YOUR_OPTIMIZE_API_KEY"
|
|
40
|
+
npx prisma generate
|
|
64
41
|
```
|
|
65
42
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Extend your existing Prisma Client instance with the Optimize extension:
|
|
43
|
+
### 3. Extend your Prisma Client with Prisma Optimize support
|
|
69
44
|
|
|
70
45
|
```typescript
|
|
71
46
|
import { PrismaClient } from "@prisma/client";
|
|
72
47
|
import { withOptimize } from "@prisma/extension-optimize";
|
|
73
48
|
|
|
74
|
-
const prisma = new PrismaClient().$extends(withOptimize(
|
|
49
|
+
const prisma = new PrismaClient().$extends(withOptimize());
|
|
75
50
|
```
|
|
76
51
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Follow these steps to start generating query insights with Prisma Optimize:
|
|
80
|
-
|
|
81
|
-
1. In the Optimize dashboard, click the Start recording button, then run your app.
|
|
82
|
-
|
|
83
|
-
2. After your app runs and insights are generated for the desired queries, click the Stop recording button.
|
|
84
|
-
|
|
85
|
-
3. Explore individual query details by clicking on them, and check the Recommendations tab for any suggested improvements to enhance query performance.
|
|
52
|
+
The extension will orchestrate the user experience around Prisma Optimize. When running your app, you will:
|
|
86
53
|
|
|
87
|
-
|
|
54
|
+
- Be required to log into the Prisma Data Platform through your GitHub account
|
|
55
|
+
- And be instructed to visit the URL of your Optimize dashboard:
|
|
88
56
|
|
|
89
|
-
|
|
57
|
+
```terminal
|
|
58
|
+
$ tsx index.ts
|
|
59
|
+
|
|
60
|
+
┌─────────────────────────────────┐
|
|
61
|
+
│ See your Optimize dashboard at: │
|
|
62
|
+
│ https://optimize.prisma.io/ │
|
|
63
|
+
└─────────────────────────────────┘
|
|
64
|
+
|
|
65
|
+
[...]
|
|
66
|
+
```
|
|
90
67
|
|
|
91
|
-
|
|
68
|
+
## Got feedback?
|
|
92
69
|
|
|
93
|
-
|
|
70
|
+
Please [submit an issue](https://github.com/prisma/optimize-feedback/issues/new/choose) or [join a discussion](https://github.com/prisma/optimize-feedback/discussions) in our [feedback repository](https://github.com/prisma/optimize-feedback/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/extension-optimize",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.202408260920",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"hono": "4.4.6",
|
|
29
29
|
"tsup": "8.0.2",
|
|
30
30
|
"vitest": "1.4.0",
|
|
31
|
-
"common": "0.0.0-dev.
|
|
31
|
+
"common": "0.0.0-dev.202408260920"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@prisma/client": "5.x"
|