Skip to content

Commit

Permalink
first pass at updating tracing docs for GA
Browse files Browse the repository at this point in the history
  • Loading branch information
jharrell committed Dec 13, 2024
1 parent ef29992 commit 8ced916
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Sometimes you need more control over what queries execute within a transaction.

Interactive transactions have been generally available from version 4.7.0.

If you use interactive transactions in preview from version 2.29.0 to 4.6.1 (included), you need to add the `interactiveTransactions` preview feature to the generator block of your Prisma schema.
If you use interactive transactions in preview from version 2.29.0 to 4.6.1 (inclusive), you need to add the `interactiveTransactions` preview feature to the generator block of your Prisma schema.

</Admonition>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: 'OpenTelemetry tracing'
metaTitle: 'OpenTelemetry tracing (Preview)'
metaTitle: 'OpenTelemetry tracing'
metaDescription: 'Diagnose application performance with detailed traces of each query.'
sidebar_class_name: preview-badge
toc_max_heading_level: 4
---


Expand Down Expand Up @@ -80,17 +78,18 @@ This section explains how to install and register tracing in your application.

### Step 1. Install up-to-date Prisma ORM dependencies

Use version `4.2.0` or later of the `prisma`, `@prisma/client`, and `@prisma/instrumentation` npm packages.
Use version `6.1.0` or later of the `prisma`, `@prisma/client`, and `@prisma/instrumentation` npm packages.

```terminal
npm install prisma@latest --save-dev
npm install @prisma/client@latest --save
npm install @prisma/instrumentation@latest --save
```

### Step 2: Enable the feature flag in your Prisma schema file
<details>
<summary>Tracing on previous versions of Prisma ORM</summary>

In the `generator` block of your `schema.prisma` file, enable the `tracing` feature flag:
Tracing was added in version `4.2.0` of Prisma ORM as a Preview feature. For versions of Prisma ORM between `4.2.0` and `6.1.0`, you need to enable the `tracing` Preview feature in your Prisma schema file.

```prisma
generator client {
Expand All @@ -99,15 +98,17 @@ generator client {
}
```

### Step 3: Install OpenTelemetry packages
</details>

Finally, install the appropriate OpenTelemetry packages, as follows:
### Step 2: Install OpenTelemetry packages

Now install the appropriate OpenTelemetry packages, as follows:

```console
npm install @opentelemetry/semantic-conventions @opentelemetry/exporter-trace-otlp-http @opentelemetry/instrumentation @opentelemetry/sdk-trace-base @opentelemetry/sdk-trace-node @opentelemetry/resources
```

### Register tracing in your application
### Step 3: Register tracing in your application

The following code provides two examples of configuring OpenTelemetry tracing in Prisma:

Expand Down Expand Up @@ -308,7 +309,6 @@ As an example, take the following Prisma schema:
```prisma file=schema.prisma showLineNumbers
generator client {
provider = "prisma-client-js"
previewFeatures = ["tracing", "interactiveTransactions"]
}
datasource db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ In the list below, you can find a history of Prisma Client and Prisma schema fea
| [`fieldReference`](/orm/reference/prisma-client-reference#compare-columns-in-the-same-table) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [5.0.0](https://github.com/prisma/prisma/releases/tag/5.0.0) |
| [`clientExtensions`](/orm/prisma-client/client-extensions) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
| [`filteredRelationCount`](/orm/prisma-client/queries/aggregation-grouping-summarizing#filter-the-relation-count) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
| [`tracing`](/orm/prisma-client/observability-and-logging/opentelemetry-tracing) | [4.2.0](https://github.com/prisma/prisma/releases/tag/4.2.0) | [6.1.0](https://github.com/prisma/prisma/releases/tag/6.1.0)

Check failure on line 69 in content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx

View workflow job for this annotation

GitHub Actions / Linkspector

[linkspector] content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx#L69

Raw output
message:"Cannot reach https://github.com/prisma/prisma/releases/tag/6.1.0. Status: 404"  location:{path:"content/200-orm/500-reference/500-preview-features/050-client-preview-features.mdx"  range:{start:{line:69  column:191}  end:{line:69  column:251}}}  severity:ERROR  source:{name:"linkspector"  url:"https://github.com/UmbrellaDocs/linkspector"}
| [`orderByNulls`](/orm/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last) | [4.1.0](https://github.com/prisma/prisma/releases/tag/4.1.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
| [`referentialIntegrity`](/orm/prisma-schema/data-model/relations/relation-mode) | [3.1.1](https://github.com/prisma/prisma/releases/tag/3.1.1) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) |
| [`interactiveTransactions`](/orm/prisma-client/queries/transactions#interactive-transactions) | [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) | <ul><li> [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0)</li><li>with Prisma Accelerate [5.1.1](https://github.com/prisma/prisma/releases/tag/5.1.1)</li></ul> |
Expand Down
31 changes: 14 additions & 17 deletions content/700-optimize/200-getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ Prisma Optimize is intended for use in local environments. Learn more in the [FA

## 2. Add Optimize to your application

### 2.1. Update Your `schema.prisma` file
### 2.1. Install the Optimize Prisma Client extension

In the `generator` block of your Prisma schema, add the `tracing` preview feature:
Install the latest versions of Prisma Client and the Optimize extension:

```bash
npm install @prisma/client@latest @prisma/extension-optimize
```

<details>
<summary>Enabling tracing in older versions of Prisma ORM</summary>

For versions of Prisma ORM between `4.2.0` and `6.1.0`, you need to enable the `tracing` preview feature in your Prisma schema file.

```prisma
generator client {
Expand All @@ -38,29 +47,17 @@ generator client {
}
```

Then, generate the Prisma Client:

```bash
npx prisma generate
```

### 2.2. Install the Optimize Prisma Client extension

Install the latest versions of Prisma Client and the Optimize extension:

```bash
npm install @prisma/client@latest @prisma/extension-optimize
```
</details>

### 2.3. Add the Optimize API Key to your `.env` file
### 2.2. Add the Optimize API Key to your `.env` file

<a href="/docs/platform/about#generating-an-optimize-api-key" target="_blank">Generate a Prisma Optimize API key</a> and add it to your `.env` file:

```bash
OPTIMIZE_API_KEY="YOUR_OPTIMIZE_API_KEY"
```

### 2.4. Extend your Prisma Client instance
### 2.3. Extend your Prisma Client instance

Extend your existing Prisma Client instance with the Optimize extension:

Expand Down

0 comments on commit 8ced916

Please sign in to comment.