From 253c34ea6acafcd6da7dc5af257e0b5085b242dc Mon Sep 17 00:00:00 2001 From: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> Date: Wed, 1 Oct 2025 11:57:14 +0600 Subject: [PATCH 1/4] feat: add deprecation warning for metrics --- .../240-metrics.mdx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx index d49b3400fc..697329b3db 100644 --- a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx +++ b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx @@ -6,17 +6,25 @@ sidebar_class_name: preview-badge toc_max_heading_level: 4 --- - 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. - +:::info 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). - +::: + +:::warning[`metrics` preview feature is deprecated] + +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. + +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. + +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. + +::: - ## About metrics From dae2310ac5040dc806e1c47582c3aaefc36e8043 Mon Sep 17 00:00:00 2001 From: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> Date: Mon, 6 Oct 2025 13:40:46 +0600 Subject: [PATCH 2/4] fix: add note QC does not support metrics --- .../600-observability-and-logging/240-metrics.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx index 697329b3db..41c8d2963f 100644 --- a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx +++ b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx @@ -19,6 +19,8 @@ If you want an even more detailed insight into your Prisma Client's performance, 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. +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). + 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. 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. @@ -26,6 +28,7 @@ If you need visibility into query or connection pool behavior, we recommend usin ::: + ## About metrics You can export metrics in JSON or Prometheus formats and view them in a console log, or integrate them into an external metrics system, such as [StatsD](https://github.com/statsd/statsd) or [Prometheus](https://prometheus.io/). If you integrate them into an external metrics system, then you can view the metrics data over time. For example, you can use metrics to help diagnose how your application's number of idle and active connections changes. From 69fc2cae411015c8d7beed52a0648dce2cc34fb3 Mon Sep 17 00:00:00 2001 From: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> Date: Mon, 6 Oct 2025 13:45:12 +0600 Subject: [PATCH 3/4] enhance: coderabbit comments --- .../240-metrics.mdx | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx index 41c8d2963f..b693745094 100644 --- a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx +++ b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx @@ -19,6 +19,8 @@ If you want an even more detailed insight into your Prisma Client's performance, 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. +**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. + 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). 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. @@ -61,18 +63,33 @@ You can [add global labels to your metrics data](#global-labels) to help you gro ## Prerequisites +:::warning[Version compatibility] + +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. + +::: + To use Prisma Client metrics, you must do the following: -1. [Install the appropriate dependencies](#1-install-up-to-date-prisma-orm-dependencies). +1. [Install compatible Prisma ORM dependencies](#1-install-compatible-prisma-orm-dependencies). 1. [Enable the `metrics` feature flag in your Prisma schema file](#2-enable-the-feature-flag-in-the-prisma-schema-file). ### 1. Install up-to-date Prisma ORM dependencies -Use version `3.15.0` or higher of the `prisma` and `@prisma/client` npm packages. +You must use a version between `3.15.0` and `6.13.x` of the `prisma` and `@prisma/client` npm packages. + +**Install a compatible version:** + +```terminal +npm install prisma@6.13.0 --save-dev +npm install @prisma/client@6.13.0 +``` + +**Or use a version range that stays within the compatible range:** ```terminal -npm install prisma@latest --save-dev -npm install @prisma/client@latest +npm install prisma@">=3.15.0 <6.14.0" --save-dev +npm install @prisma/client@">=3.15.0 <6.14.0" ``` ### 2. Enable the feature flag in the Prisma schema file From 32e2ff5b16da22e503d0283209a9d4288785fe63 Mon Sep 17 00:00:00 2001 From: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> Date: Mon, 6 Oct 2025 14:01:03 +0600 Subject: [PATCH 4/4] fix: broken url --- .../600-observability-and-logging/240-metrics.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx index b693745094..cff5a46155 100644 --- a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx +++ b/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx @@ -71,7 +71,7 @@ The `metrics` preview feature is **only available in Prisma ORM versions ≤6.13 To use Prisma Client metrics, you must do the following: -1. [Install compatible Prisma ORM dependencies](#1-install-compatible-prisma-orm-dependencies). +1. [Install compatible Prisma ORM dependencies](#1-install-up-to-date-prisma-orm-dependencies). 1. [Enable the `metrics` feature flag in your Prisma schema file](#2-enable-the-feature-flag-in-the-prisma-schema-file). ### 1. Install up-to-date Prisma ORM dependencies