Skip to content

Commit fefe8d7

Browse files
authored
feat: add deprecation warning for metrics (#7151)
* feat: add deprecation warning for metrics * fix: add note QC does not support metrics * enhance: coderabbit comments * fix: broken url
1 parent 09ceaf5 commit fefe8d7

File tree

1 file changed

+36
-8
lines changed
  • content/200-orm/200-prisma-client/600-observability-and-logging

1 file changed

+36
-8
lines changed

content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,30 @@ sidebar_class_name: preview-badge
66
toc_max_heading_level: 4
77
---
88

9-
<TopBlock>
109

1110
Prisma Client metrics give you a detailed insight into how Prisma Client interacts with your database. You can use this insight to help diagnose performance issues with your application.
1211

13-
<Admonition type="info">
12+
:::info
1413

1514
If you want an even more detailed insight into your Prisma Client's performance, at the level of individual operations, see [Tracing](/orm/prisma-client/observability-and-logging/opentelemetry-tracing).
1615

17-
</Admonition>
16+
:::
17+
18+
:::warning[`metrics` preview feature is deprecated]
19+
20+
The `metrics` preview feature has been **deprecated** as of [Prisma ORM v6.14.0](https://github.com/prisma/prisma/releases/tag/6.14.0) and will be removed in Prisma ORM v7.
21+
22+
**The `metrics` preview feature is only available in Prisma ORM versions ≤6.13.x.** If you are using Prisma ORM v6.14.0 or later, the `$metrics` API is no longer available.
23+
24+
The feature is not supported when using Prisma ORM with the [query compiler architecture](/orm/prisma-client/setup-and-configuration/no-rust-engine) (setting `engineType` to 'client' in the `generator` block of your `schema.prisma` file).
25+
26+
Metrics were originally introduced to provide insights into query and connection behavior. With the changes in the new [query compiler architecture](/orm/prisma-client/setup-and-configuration/no-rust-engine), these values no longer reflect the system reliably. Because of this, we are not continuing support for this feature.
27+
28+
If you need visibility into query or connection pool behavior, we recommend using the *native metrics provided by your database driver* (for example, pool statistics) or setting up *OpenTelemetry* for a more complete observability solution.
29+
30+
:::
31+
1832

19-
</TopBlock>
2033

2134
## About metrics
2235

@@ -50,18 +63,33 @@ You can [add global labels to your metrics data](#global-labels) to help you gro
5063

5164
## Prerequisites
5265

66+
:::warning[Version compatibility]
67+
68+
The `metrics` preview feature is **only available in Prisma ORM versions ≤6.13.x**. It has been removed in v6.14.0 and later versions.
69+
70+
:::
71+
5372
To use Prisma Client metrics, you must do the following:
5473

55-
1. [Install the appropriate dependencies](#1-install-up-to-date-prisma-orm-dependencies).
74+
1. [Install compatible Prisma ORM dependencies](#1-install-up-to-date-prisma-orm-dependencies).
5675
1. [Enable the `metrics` feature flag in your Prisma schema file](#2-enable-the-feature-flag-in-the-prisma-schema-file).
5776

5877
### 1. Install up-to-date Prisma ORM dependencies
5978

60-
Use version `3.15.0` or higher of the `prisma` and `@prisma/client` npm packages.
79+
You must use a version between `3.15.0` and `6.13.x` of the `prisma` and `@prisma/client` npm packages.
80+
81+
**Install a compatible version:**
82+
83+
```terminal
84+
npm install [email protected] --save-dev
85+
npm install @prisma/[email protected]
86+
```
87+
88+
**Or use a version range that stays within the compatible range:**
6189

6290
```terminal
63-
npm install prisma@latest --save-dev
64-
npm install @prisma/client@latest
91+
npm install prisma@">=3.15.0 <6.14.0" --save-dev
92+
npm install @prisma/client@">=3.15.0 <6.14.0"
6593
```
6694

6795
### 2. Enable the feature flag in the Prisma schema file

0 commit comments

Comments
 (0)