diff --git a/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx b/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx
index ba25506e73..2479c5da37 100644
--- a/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx
+++ b/content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx
@@ -86,7 +86,7 @@ datasource db {
#### Viewing the connection pool size
-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).
+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.
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.
@@ -127,78 +127,6 @@ Note that the output generated by `log: ['info']` can change in any release with
-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).
-
-Consider the following example:
-
-
-
-
-```ts
-import { PrismaClient } from '@prisma/client'
-
-const prisma = new PrismaClient()
-
-async function main() {
- await Promise.all([prisma.user.findMany(), prisma.post.findMany()])
-
- const metrics = await prisma.$metrics.json()
- console.dir(metrics, { depth: Infinity })
-}
-
-main()
-```
-
-
-
-
-```json no-copy
-{
- "counters": [
- // ...
- {
- "key": "prisma_pool_connections_open",
- "labels": {},
- "value": 2,
- "description": "Number of currently open Pool Connections"
- }
- ],
- "gauges": [
- // ...
- {
- "key": "prisma_pool_connections_busy",
- "labels": {},
- "value": 0,
- "description": "Number of currently busy Pool Connections (executing a datasource query)"
- },
- {
- "key": "prisma_pool_connections_idle",
- "labels": {},
- "value": 21,
- "description": "Number of currently unused Pool Connections (waiting for the next datasource query to run)"
- },
- {
- "key": "prisma_pool_connections_opened_total",
- "labels": {},
- "value": 2,
- "description": "Total number of Pool Connections opened"
- }
- ],
- "histograms": [
- /** ... **/
- ]
-}
-```
-
-
-
-
-
-
-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.
-
-
-
### Connection pool timeout
#### Default pool timeout
diff --git a/content/200-orm/200-prisma-client/300-client-extensions/110-client.mdx b/content/200-orm/200-prisma-client/300-client-extensions/110-client.mdx
index 5aad99108e..eae480e2f8 100644
--- a/content/200-orm/200-prisma-client/300-client-extensions/110-client.mdx
+++ b/content/200-orm/200-prisma-client/300-client-extensions/110-client.mdx
@@ -34,29 +34,25 @@ const prisma = new PrismaClient().$extends({
The following example uses the `client` component to add two methods to Prisma Client:
- `$log` outputs a message.
-- `$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.
+- `$totalQueries` returns the number of queries executed by the current client instance.
-
-
-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).
+```ts
-
-```ts
+const total = 0
const prisma = new PrismaClient().$extends({
client: {
$log: (s: string) => console.log(s),
- async $totalQueries() {
- const index_prisma_client_queries_total = 0
- // Prisma.getExtensionContext(this) in the following block
- // returns the current client instance
- const metricsCounters = await (
- await Prisma.getExtensionContext(this).$metrics.json()
- ).counters
-
- return metricsCounters[index_prisma_client_queries_total].value
- },
+ async $totalQueries() { return total; },
},
+ query: {
+ $allModels: {
+ async $allOperations({ query, args }) {
+ total += 1;
+ return query(args);
+ },
+ },
+ },
})
async function main() {
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
deleted file mode 100644
index cff5a46155..0000000000
--- a/content/200-orm/200-prisma-client/600-observability-and-logging/240-metrics.mdx
+++ /dev/null
@@ -1,600 +0,0 @@
----
-title: 'Metrics'
-metaTitle: 'Metrics (Preview)'
-metaDescription: 'Diagnose application performance with insights into Prisma Client database activity.'
-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.
-
-**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.
-
-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
-
-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.
-
-Prisma Client provides the following metrics:
-
-- Counters (always increase):
-
- - `prisma_client_queries_total`: The total number of Prisma Client queries executed.
- - `prisma_datasource_queries_total`: The total number of datasource queries executed (SQL queries in relational databases, and commands in MongoDB).
- - The value returned by `prisma_datasource_queries_total` can be greater than `prisma_client_queries_total`, because some Prisma Client operations create multiple queries.
- - `prisma_pool_connections_closed_total`: The total number of pool connections closed.
- - `prisma_pool_connections_opened_total`: The number of currently open pool connections.
-
-- Gauges (can increase or decrease):
-
- - `prisma_client_queries_active`: The number of currently active Prisma Client queries.
- - `prisma_client_queries_wait`: The number of Prisma Client queries currently waiting for a connection because all connections are in use.
- - `prisma_pool_connections_busy`: The number of currently busy pool connections. These pool connections are currently executing a datasource query.
- - `prisma_pool_connections_idle`: The number of pool connections that are not currently being used. These pool connections are waiting for the next datasource query to run.
- - `prisma_pool_connections_open`: The number of [pool connections](/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool#default-connection-pool-size) open.
-
-- Histograms (metrics data divided into a collection of values; we call each container in the collection a "bucket"):
-
- - `prisma_client_queries_wait_histogram_ms`: The time waiting for a pool connection for all Prisma Client queries in ms.
- - `prisma_client_queries_duration_histogram_ms`: The execution time for all executed Prisma Client queries in ms. This includes the time taken to execute all database queries, and to carry out all database engine activities, such as joining data and transforming data to the correct format.
- - `prisma_datasource_queries_duration_histogram_ms`: The execution time for all executed Datasource queries in ms.
-
-You can [add global labels to your metrics data](#global-labels) to help you group and separate your metrics, for example by infrastructure region or server.
-
-## 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 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
-
-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@">=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
-
-In the `generator` block of your `schema.prisma` file, enable the `metrics` feature flag:
-
-```prisma
-generator client {
- provider = "prisma-client-js"
- previewFeatures = ["metrics"]
-}
-```
-
-## Retrieve metrics in JSON format
-
-When you retrieve metrics in JSON format, you can use them in the format they are returned, or [send them to StatSD](#use-prisma-client-metrics-with-statsd) to visualize how they change over time.
-
-To retrieve metrics in JSON format, add the following lines to your application code:
-
-```ts
-const metrics = await prisma.$metrics.json()
-console.log(metrics)
-```
-
-This returns metrics as follows:
-
-```json
-{
- "counters": [
- {
- "key": "prisma_client_queries_total",
- "labels": {},
- "value": 0,
- "description": "Total number of Prisma Client queries executed"
- },
- {
- "key": "prisma_datasource_queries_total",
- "labels": {},
- "value": 0,
- "description": "Total number of Datasource Queries executed"
- },
- {
- "key": "prisma_pool_connections_closed_total",
- "labels": {},
- "value": 0,
- "description": "Total number of Pool Connections closed"
- },
- {
- "key": "prisma_pool_connections_opened_total",
- "labels": {},
- "value": 1,
- "description": "Total number of Pool Connections opened"
- }
- ...
- ],
- "gauges": [
- ...
- ],
- "histograms": [
- ...
- ]
-}
-```
-
-
-
-Expand to view the full output
-
-```json no-copy
-{
- "counters": [
- {
- "key": "prisma_client_queries_total",
- "labels": {},
- "value": 2,
- "description": "Total number of Prisma Client queries executed"
- },
- {
- "key": "prisma_datasource_queries_total",
- "labels": {},
- "value": 5,
- "description": "Total number of Datasource Queries executed"
- },
- {
- "key": "prisma_pool_connections_open",
- "labels": {},
- "value": 1,
- "description": "Number of currently open Pool Connections"
- }
- ],
- "gauges": [
- {
- "key": "prisma_client_queries_active",
- "labels": {},
- "value": 0,
- "description": "Number of currently active Prisma Client queries"
- },
- {
- "key": "prisma_client_queries_wait",
- "labels": {},
- "value": 0,
- "description": "Number of Prisma Client queries currently waiting for a connection"
- },
- {
- "key": "prisma_pool_connections_busy",
- "labels": {},
- "value": 0,
- "description": "Number of currently busy Pool Connections (executing a datasource query)"
- },
- {
- "key": "prisma_pool_connections_idle",
- "labels": {},
- "value": 21,
- "description": "Number of currently unused Pool Connections (waiting for the next datasource query to run)"
- },
- {
- "key": "prisma_pool_connections_open",
- "labels": {},
- "value": 1,
- "description": "Number of currently open Pool Connections"
- }
- ],
- "histograms": [
- {
- "key": "prisma_client_queries_duration_histogram_ms",
- "labels": {},
- "value": {
- "buckets": [
- [0, 0],
- [1, 0],
- [5, 0],
- [10, 1],
- [50, 1],
- [100, 0],
- [500, 0],
- [1000, 0],
- [5000, 0],
- [50000, 0]
- ],
- "sum": 47.430541000000005,
- "count": 2
- },
- "description": "Histogram of the duration of all executed Prisma Client queries in ms"
- },
- {
- "key": "prisma_client_queries_wait_histogram_ms",
- "labels": {},
- "value": {
- "buckets": [
- [0, 0],
- [1, 3],
- [5, 0],
- [10, 0],
- [50, 0],
- [100, 0],
- [500, 0],
- [1000, 0],
- [5000, 0],
- [50000, 0]
- ],
- "sum": 0.0015830000000000002,
- "count": 3
- },
- "description": "Histogram of the wait time of all Prisma Client Queries in ms"
- },
- {
- "key": "prisma_datasource_queries_duration_histogram_ms",
- "labels": {},
- "value": {
- "buckets": [
- [0, 0],
- [1, 0],
- [5, 2],
- [10, 2],
- [50, 1],
- [100, 0],
- [500, 0],
- [1000, 0],
- [5000, 0],
- [50000, 0]
- ],
- "sum": 47.134498,
- "count": 5
- },
- "description": "Histogram of the duration of all executed Datasource Queries in ms"
- }
- ]
-}
-```
-
-
-
-### Histograms in JSON data
-
-Each histogram "bucket" has two values. The first one is the upper bound of the bucket, and the second one is the count (the number of data values that fall into that bucket). In the following example, there are two instances of values between 11 and 20, and five instances of values between 21 and 30:
-
-```json
-...
-[20, 2],
-[30, 5],
-...
-```
-
-### Use Prisma Client metrics with StatsD
-
-You can send JSON-formatted metrics to [StatsD](https://github.com/statsd/statsd) to visualize your metrics data over time.
-
-
-
-Note: You must provide counter metrics to StatsD as a series of values that are incremented or decremented from a previous retrieval of the metrics. However, Prisma Client's counter
-metrics return absolute values. Therefore, you must convert your counter metrics to a series of incremented and decremented values and send them to StatsD as gauge data. In the code example below, we convert counter metrics into incremented and decremented gauge data in `diffHistograms`.
-
-
-
-In the following example, we send metrics to StatsD every 10 seconds. This timing aligns with the default 10s flush rate of StatsD.
-
-```ts
-import StatsD from 'hot-shots'
-let statsd = new StatsD({
- port: 8125,
-})
-
-const diffMetrics = (metrics: Metric[]) => {
- return metrics.map((metric) => {
- let prev = 0;
-
- const diffBuckets = metric.value.buckets.map(
- (values) => {
- const [bucket, value] = values
- const diff = value - prev
- prev = value
- return [bucket, diff]
- }
- )
-
- metric.value.buckets = diffBuckets
- return metric
- })
-}
-
-let previousHistograms: Metric[] = []
-
-
-const statsdSender = async () => {
- const metrics = await prisma.$metrics.json()
-
- metrics.counters.forEach((counter: any) => {
- statsd.gauge('prisma.' + counter.key, counter.value, (...res) => {})
- });
-
- metrics.gauges.forEach((counter: any) => {
- statsd.gauge('prisma.' + counter.key, counter.value, (...res) => {})
- })
-
- if (!previousHistograms.length) {
- previousHistograms = diffMetrics(metrics.histograms)
-
- return
- }
-
- const diffHistograms = diffMetrics(metrics.histograms);
-
- diffHistograms.forEach((diffHistogram, histogramIndex) => {
- diffHistogram.value.buckets.forEach((values, bucketIndex) => {
- const [bucket, count] = values
- const [_, prev] =
- previousHistograms[histogramIndex].value.buckets[bucketIndex]
- const change = count - prev
-
- for (let sendTimes = 0; sendTimes < change; sendTimes++) {
- statsd.timing('prisma.' + diffHistograms.key, bucket)
- }
- })
- })
-
- previousHistograms = diffHistograms
-}
-
-setInterval(async () => await statsdSender(), 10000)
-```
-
-## Retrieve metrics in Prometheus format
-
-When you retrieve Prisma Client metrics in Prometheus format, you can use them in the format they are returned, or [send them to the Prometheus metrics system](#use-prisma-client-metrics-with-the-prometheus-metrics-system) to visualize how they change over time.
-
-To retrieve metrics in Prometheus format, add the following lines to your application code:
-
-```ts
-const metrics = await prisma.$metrics.prometheus()
-console.log(metrics)
-```
-
-This returns metrics as follows:
-
-```c
-# HELP prisma_client_queries_total Total number of Prisma Client queries executed
-# TYPE prisma_client_queries_total counter
-prisma_client_queries_total 14
-
-...
-# HELP prisma_pool_connections_busy The number of active connections in use.
-# TYPE prisma_pool_connections_busy gauge
-prisma_pool_connections_busy 0
-
-...
-# HELP prisma_client_queries_wait_histogram_ms The wait time for a worker to get a connection.
-# TYPE prisma_client_queries_wait_histogram_ms histogram
-prisma_client_queries_wait_histogram_ms_bucket{le="0"} 0
-prisma_client_queries_wait_histogram_ms_bucket{le="1"} 3
-```
-
-
-
-Expand to view the full output
-
-```c
-# HELP query_total_operations
-# TYPE query_total_operations counter
-query_total_operations 2
-
-# HELP prisma_datasource_queries_total
-# TYPE prisma_datasource_queries_total counter
-prisma_datasource_queries_total 28
-
-# HELP prisma_pool_connections_closed_total Total number of Pool Connections closed
-# TYPE prisma_pool_connections_closed_total counter
-prisma_pool_connections_closed_total 0
-
-# HELP prisma_pool_connections_opened_total Total number of Pool Connections opened
-# TYPE prisma_pool_connections_opened_total counter
-prisma_pool_connections_opened_total 0
-
-# HELP prisma_client_queries_active Number of currently active Prisma Client queries
-# TYPE prisma_client_queries_active gauge
-prisma_client_queries_active 0
-
-# HELP prisma_client_queries_wait Number of queries currently waiting for a connection
-# TYPE prisma_client_queries_wait gauge
-prisma_client_queries_wait 0
-
-# HELP prisma_pool_connections_busy Number of currently busy Pool Connections (executing a datasource query)
-# TYPE prisma_pool_connections_busy gauge
-prisma_pool_connections_busy 0
-
-# HELP prisma_pool_connections_idle Number of currently unused Pool Connections (waiting for the next pool query to run)
-# TYPE prisma_pool_connections_idle gauge
-prisma_pool_connections_idle 21
-
-# HELP prisma_pool_connections_open Number of currently open Pool Connections
-# TYPE prisma_pool_connections_open gauge
-prisma_pool_connections_open 1
-
-# HELP prisma_pool_connections_open Number of currently open Pool Connections (able to execute a datasource query)
-# TYPE prisma_pool_connections_open gauge
-prisma_pool_connections_open 0
-
-# HELP prisma_client_queries_wait_histogram_ms The wait time for a worker to get a connection.
-# TYPE prisma_client_queries_wait_histogram_ms histogram
-prisma_client_queries_wait_histogram_ms_bucket{le="0"} 0
-prisma_client_queries_wait_histogram_ms_bucket{le="1"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="5"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="10"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="50"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="100"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="500"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="1000"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="5000"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="50000"} 3
-prisma_client_queries_wait_histogram_ms_bucket{le="+Inf"} 3
-prisma_client_queries_wait_histogram_ms_sum 0.023208
-prisma_client_queries_wait_histogram_ms_count 3
-
-# HELP prisma_client_queries_duration_histogram_ms Histogram of the duration of all executed Prisma Client queries in ms
-# TYPE prisma_client_queries_duration_histogram_ms histogram
-prisma_client_queries_duration_histogram_ms_bucket{le="0"} 0
-prisma_client_queries_duration_histogram_ms_bucket{le="1"} 1
-prisma_client_queries_duration_histogram_ms_bucket{le="5"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="10"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="50"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="100"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="500"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="1000"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="5000"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="50000"} 2
-prisma_client_queries_duration_histogram_ms_bucket{le="+Inf"} 2
-prisma_client_queries_duration_histogram_ms_sum 3.197624
-prisma_client_queries_duration_histogram_ms_count 2
-
-# HELP prisma_datasource_queries_duration_histogram_ms Histogram of the duration of all executed Datasource Queries in ms
-# TYPE prisma_datasource_queries_duration_histogram_ms histogram
-prisma_datasource_queries_duration_histogram_ms_bucket{le="0"} 0
-prisma_datasource_queries_duration_histogram_ms_bucket{le="1"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="5"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="10"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="50"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="100"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="500"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="1000"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="5000"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="50000"} 5
-prisma_datasource_queries_duration_histogram_ms_bucket{le="+Inf"} 5
-prisma_datasource_queries_duration_histogram_ms_sum 1.8407059999999997
-prisma_datasource_queries_duration_histogram_ms_count 5
-```
-
-
-Metrics of type `histogram` expose three different class of values in the Prometheus format:
-
-1. Multiple cumulative counters for observation buckets. These counters are suffixed with `_bucket{le=""}`. For example, `prisma_datasource_queries_duration_histogram_ms` has a counter exposed as `prisma_datasource_queries_duration_histogram_ms_bucket{le="1"}`
-
- When an observed value is less than or equal to the upper inclusive bound of a bucket, then Prisma Client metrics increments that bucket by 1. Suppose that you have buckets with the upper inclusive bounds 0, 1, 5, 10, and 50 respectively. If the observed value is 5 then Prisma Client metrics increments the third bucket onwards, because the value is greater than 0 and greater than 1, but less than or equal to 5, 10, and 50.
-
-2. A single **total sum** for all observed values. This counter is suffixed with `_sum`. For example the total sum of `prisma_datasource_queries_duration_histogram_ms` is exposed as `prisma_datasource_queries_duration_histogram_ms_sum`.
-3. The **count** of the number of events that have been observed. This counter is suffixed with `_count`. For example the total count of `prisma_datasource_queries_duration_histogram_ms` events is exposed as `prisma_datasource_queries_duration_histogram_ms_count`.
-
-For more information, read the Prometheus documentation on [metric types](https://prometheus.io/docs/concepts/metric_types/#histogram).
-
-### Use Prisma Client metrics with the Prometheus metrics system
-
-In the majority of cases, Prometheus must scrape an endpoint to retrieve metrics. The following example shows how to send data with `Express.js`:
-
-```js
-import { PrismaClient } from '@prisma/client'
-import express, { Request, Response } from 'express'
-
-const app = express()
-const port = 4000
-const prisma = new PrismaClient()
-
-app.get('/metrics', async (_req, res: Response) => {
- const metrics = await prisma.$metrics.prometheus()
- res.end(metrics)
-})
-
-app.listen(port, () => {
- console.log(`Example app listening on port ${port}`)
-})
-```
-
-The following example shows how to combine Prisma Client metrics with other Prometheus client libraries that are also served with a REST API endpoint in conjunction with `Express.js`:
-
-```js
-import { PrismaClient } from '@prisma/client'
-import express, { Request, Response } from 'express'
-import prom from 'prom-client'
-
-const app = express()
-const port = 4000
-const prisma = new PrismaClient()
-
-const register = new prom.Registry()
-prom.collectDefaultMetrics({ register })
-
-app.get('/metrics', async (_req, res: Response) => {
- const prismaMetrics = await prisma.$metrics.prometheus()
- const appMetrics = await register.metrics()
- res.end(prismaMetrics + appMetrics)
-})
-
-app.listen(port, () => {
- console.log(`Example app listening on port ${port}`)
-})
-```
-
-## Global labels
-
-You can add global labels to your metrics to help you group and separate your metrics. Each instance of Prisma Client adds these labels to the metrics that it generates. For example, you can group your metrics by infrastructure region, or by server, with a label like `{ server: us_server1', 'app_version': 'one' }`.
-
-Global labels work with JSON and Prometheus-formatted metrics.
-
-For example, to add global labels to JSON-format metrics, add the following code to your application:
-
-```ts
-const metrics = prisma.$metrics.json({
- globalLabels: { server: 'us_server1', app_version: 'one' },
-})
-console.log(metrics)
-```
-
-This returns information in the following format:
-
-```json highlight=5,11;add
-{
- "counters": [
- {
- "key": "query_total_operations",
- //add-next-line
- "labels": { "server": "us_server1", "app_version": "one" },
- "value": 0,
- "description": "The total number of operations executed"
- },
- {
- "key": "prisma_datasource_queries_total",
- //add-next-line
- "labels": { "server": "us_server1", "app_version": "one" },
- "value": 0,
- "description": "The total number of queries executed"
- },
- ...
- ],
- "gauges": [
- ...
- ],
- "histograms": [
- ...
- ]
-}
-```
diff --git a/content/200-orm/200-prisma-client/600-observability-and-logging/250-opentelemetry-tracing.mdx b/content/200-orm/200-prisma-client/600-observability-and-logging/250-opentelemetry-tracing.mdx
index f1b866c7d3..c755f0c538 100644
--- a/content/200-orm/200-prisma-client/600-observability-and-logging/250-opentelemetry-tracing.mdx
+++ b/content/200-orm/200-prisma-client/600-observability-and-logging/250-opentelemetry-tracing.mdx
@@ -9,7 +9,7 @@ Tracing provides a detailed log of the activity that Prisma Client carries out,
:::info
-Tracing gives you a highly detailed, operation-level insight into your Prisma ORM project. If you want aggregated numerical reporting, such as query counts, connection counts, and total query execution times, see [Metrics](/orm/prisma-client/observability-and-logging/metrics).
+Tracing gives you a highly detailed, operation-level insight into your Prisma ORM project.
:::
@@ -471,5 +471,4 @@ registerTracing({
import { PrismaClient } from '@prisma/client'
import async from 'express-async-handler'
import express from 'express'
-```
-
+```
\ No newline at end of file
diff --git a/content/200-orm/500-reference/050-prisma-client-reference.mdx b/content/200-orm/500-reference/050-prisma-client-reference.mdx
index cc31ef781c..aed44b75c9 100644
--- a/content/200-orm/500-reference/050-prisma-client-reference.mdx
+++ b/content/200-orm/500-reference/050-prisma-client-reference.mdx
@@ -5542,14 +5542,6 @@ See: [Using Raw SQL (`$runCommandRaw()`)](/orm/prisma-client/using-raw-sql/raw-q
See: [Transactions](/orm/prisma-client/queries/transactions).
-### `$metrics`
-
-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. Learn more: [Metrics](/orm/prisma-client/observability-and-logging/metrics).
-
-Prisma Client metrics has the following methods:
-
-- `$metrics.json()`: [Retrieves Prisma Client metrics in JSON format](/orm/prisma-client/observability-and-logging/metrics#retrieve-metrics-in-json-format).
-- `$metrics.prometheus()`: [Retrieves Prisma Client metrics in Prometheus format](/orm/prisma-client/observability-and-logging/metrics#retrieve-metrics-in-prometheus-format).
### `$extends`
diff --git a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx
index 1ea24923c5..dadac31c83 100644
--- a/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx
+++ b/content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx
@@ -12,16 +12,15 @@ For more information, see [ORM releases and maturity levels](/orm/more/releases)
The following [Preview](/orm/more/releases#preview) feature flags are available for Prisma Client and Prisma schema:
-| Feature | Released into Preview | Feedback issue |
-| ----------------------------------------------------------------------- | :------------------------------------------------------------- | :-------------------------------------------------------------------: |
-| [`metrics`](/orm/prisma-client/observability-and-logging/metrics) | [3.15.0](https://github.com/prisma/prisma/releases/tag/3.15.0) | [Submit feedback](https://github.com/prisma/prisma/issues/13579) |
-| [`views`](/orm/prisma-schema/data-model/views) | [4.9.0](https://github.com/prisma/prisma/releases/tag/4.9.0) | [Submit feedback](https://github.com/prisma/prisma/issues/17335) |
-| `relationJoins` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22288) |
-| `nativeDistinct` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22287) |
-| `typedSql` | [5.19.0](https://github.com/prisma/prisma/releases/tag/5.19.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25106) |
-| `strictUndefinedChecks` | [5.20.0](https://github.com/prisma/prisma/releases/tag/5.20.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25271) |
-| [`fullTextSearchPostgres`](/orm/prisma-client/queries/full-text-search) | [6.0.0](https://github.com/prisma/prisma/releases/tag/6.0.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) |
-| `shardKeys` | [6.10.0](https://pris.ly/release/6.10.0) | [Submit feedback](https://github.com/prisma/prisma/issues/) |
+| Feature | Released into Preview | Feedback issue |
+| ------------------------------------------------------------------------------- | :------------------------------------------------------------- | :-------------------------------------------------------------------: |
+| [`views`](/orm/prisma-schema/data-model/views) | [4.9.0](https://github.com/prisma/prisma/releases/tag/4.9.0) | [Submit feedback](https://github.com/prisma/prisma/issues/17335) |
+| `relationJoins` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22288) |
+| `nativeDistinct` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22287) |
+| `typedSql` | [5.19.0](https://github.com/prisma/prisma/releases/tag/5.19.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25106) |
+| `strictUndefinedChecks` | [5.20.0](https://github.com/prisma/prisma/releases/tag/5.20.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25271) |
+| [`fullTextSearchPostgres`](/orm/prisma-client/queries/full-text-search) | [6.0.0](https://github.com/prisma/prisma/releases/tag/6.0.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) |
+| `shardKeys` | [6.10.0](https://pris.ly/release/6.10.0) | [Submit feedback](https://github.com/prisma/prisma/issues/) |
To enable a Preview feature, [add the feature flag to the `generator` block](#enabling-a-prisma-client-preview-feature) in your `schema.prisma` file. [Share your feedback on all Preview features on GitHub](https://github.com/prisma/prisma/issues/3108).
diff --git a/content/200-orm/800-more/400-comparisons/04-prisma-and-drizzle.mdx b/content/200-orm/800-more/400-comparisons/04-prisma-and-drizzle.mdx
index b01adb8ab7..3c2a085b36 100644
--- a/content/200-orm/800-more/400-comparisons/04-prisma-and-drizzle.mdx
+++ b/content/200-orm/800-more/400-comparisons/04-prisma-and-drizzle.mdx
@@ -408,7 +408,6 @@ const posts = await db
Both Drizzle and Prisma ORM have the ability to log queries and the underlying SQL generated.
-Prisma ORM has additional features built into the client that help teams get a better understanding of their data usage. [Metrics](/orm/prisma-client/observability-and-logging/metrics) and [tracing](/orm/prisma-client/observability-and-logging/opentelemetry-tracing) are two features that can be enabled at any time and give you per query information. This information can be integrated with external tools so that you can track performance over time.
## Additional products
diff --git a/content/250-postgres/1200-more/1000-faq.mdx b/content/250-postgres/1200-more/1000-faq.mdx
index bca6c2d8c4..87c924c37c 100644
--- a/content/250-postgres/1200-more/1000-faq.mdx
+++ b/content/250-postgres/1200-more/1000-faq.mdx
@@ -97,9 +97,7 @@ Yes, a query like `SELECT 1` counts as an operation and will be billed according
### How can I estimate the number of operations in Prisma ORM?
-You can estimate your operation usage in Prisma ORM by integrating an application performance monitoring tool like Prometheus with Prisma ORM's [`metrics` preview feature](/orm/prisma-client/observability-and-logging/metrics). Once you enable the `metrics` preview feature, look at the `prisma_client_queries_total` metric for the number of operations.
-
-Prisma Postgres uses the `prisma_client_queries_total` counter, which tracks every client operation sent to your database to calculate your billing. For a detailed, step-by-step walkthrough on configuring Prometheus and monitor your application, [see our full guide](https://www.prisma.io/blog/metrics-tutorial-prisma-pmoldgq10kz).
+You can estimate your operation usage in Prisma ORM by integrating an application performance monitoring tool like Prometheus.
### What strategies can I use to optimize cost per operation?