You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx
+1-73Lines changed: 1 addition & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ datasource db {
86
86
87
87
#### Viewing the connection pool size
88
88
89
-
The number of connections Prisma Client uses can be viewed using [logging](/orm/prisma-client/observability-and-logging/logging) and [metrics](/orm/prisma-client/observability-and-logging/metrics).
89
+
The number of connections Prisma Client uses can be viewed using [logging](/orm/prisma-client/observability-and-logging/logging) and built in APIs provided by the Prisma Postgres Driver.
90
90
91
91
Using the `info`[logging level](/orm/reference/prisma-client-reference#log-levels), you can log the number of connections in a connection pool that are opened when Prisma Client is instantiated.
92
92
@@ -127,78 +127,6 @@ Note that the output generated by `log: ['info']` can change in any release with
127
127
128
128
</Admonition>
129
129
130
-
If you need even more insights into the size of your connection pool and the amount of in-use and idle connection, you can use the [metrics](/orm/prisma-client/observability-and-logging/metrics) feature (which is currently in Preview).
"description": "Number of currently open Pool Connections"
164
-
}
165
-
],
166
-
"gauges": [
167
-
// ...
168
-
{
169
-
"key": "prisma_pool_connections_busy",
170
-
"labels": {},
171
-
"value": 0,
172
-
"description": "Number of currently busy Pool Connections (executing a datasource query)"
173
-
},
174
-
{
175
-
"key": "prisma_pool_connections_idle",
176
-
"labels": {},
177
-
"value": 21,
178
-
"description": "Number of currently unused Pool Connections (waiting for the next datasource query to run)"
179
-
},
180
-
{
181
-
"key": "prisma_pool_connections_opened_total",
182
-
"labels": {},
183
-
"value": 2,
184
-
"description": "Total number of Pool Connections opened"
185
-
}
186
-
],
187
-
"histograms": [
188
-
/** ... **/
189
-
]
190
-
}
191
-
```
192
-
193
-
</cmdResult>
194
-
</CodeWithResult>
195
-
196
-
<Admonitiontype="info">
197
-
198
-
For more details on what is available in the metrics output, see the [About metrics](/orm/prisma-client/observability-and-logging/metrics#about-metrics) section.
Copy file name to clipboardExpand all lines: content/200-orm/200-prisma-client/300-client-extensions/110-client.mdx
+12-16Lines changed: 12 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,29 +34,25 @@ const prisma = new PrismaClient().$extends({
34
34
The following example uses the `client` component to add two methods to Prisma Client:
35
35
36
36
-`$log` outputs a message.
37
-
-`$totalQueries` returns the number of queries executed by the current client instance. It uses the [metrics](/orm/prisma-client/observability-and-logging/metrics) feature to collect this information.
37
+
-`$totalQueries` returns the number of queries executed by the current client instance.
38
38
39
-
<Admonitiontype="info">
40
-
41
-
To use metrics in your project, you must enable the `metrics` feature flag in the `generator` block of your `schema.prisma` file. [Learn more](/orm/prisma-client/observability-and-logging/metrics#2-enable-the-feature-flag-in-the-prisma-schema-file).
39
+
```ts
42
40
43
-
</Admonition>
44
41
45
-
```ts
42
+
const total =0
46
43
const prisma =newPrismaClient().$extends({
47
44
client: {
48
45
$log: (s:string) =>console.log(s),
49
-
async $totalQueries() {
50
-
const index_prisma_client_queries_total =0
51
-
// Prisma.getExtensionContext(this) in the following block
0 commit comments