Skip to content

Commit 79f4e11

Browse files
jankaiferstyfle
andauthored
Fix grammar and typos in OTEL docs (vercel#48235)
I ran a grammar check on OTEL docs to get any remaining issues that spell check didn't fix. --------- Co-authored-by: Steven <steven@ceriously.com>
1 parent c1991c6 commit 79f4e11

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@
7171
"cSpell.words": [
7272
"Entrypoints",
7373
"napi",
74+
"nextjs",
7475
"opentelemetry",
7576
"Threadsafe",
7677
"zipkin"
78+
],
79+
"grammarly.selectors": [
80+
{
81+
"language": "markdown",
82+
"scheme": "file"
83+
}
7784
]
7885
}

docs/advanced-features/instrumentation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Learn how to instrument your Next.js app.
2+
description: Learn how to use instrumentation to run code at server startup in your Next.js app
33
---
44

55
> **Note**: This feature is experimental. To use it, you must explicitly opt in by defining `experimental.instrumentationHook = true;` in your `next.config.js`.
@@ -35,7 +35,7 @@ export const register() {
3535

3636
By doing this, you can colocate all of your side effects in one place in your code, and avoid any unintended consequences from importing files.
3737

38-
We call `register` in all environments, so it's necessary to conditionally require any code that doesn't support both `edge` and `nodejs`. You can use environment variable `NEXT_RUNTIME` to get the current environment. Importing environment specific code would look like this:
38+
We call `register` in all environments, so it's necessary to conditionally require any code that doesn't support both `edge` and `nodejs`. You can use the environment variable `NEXT_RUNTIME` to get the current environment. Importing an environment-specific code would look like this:
3939

4040
```ts
4141
// /instrumentation.ts

docs/advanced-features/open-telemetry.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Learn how instrument your Next.js app with OpenTelemetry.
2+
description: Learn how to instrument your Next.js app with OpenTelemetry.
33
---
44

55
> **Note**: This feature is experimental, you need to explicitly opt-in by providing `experimental.instrumentationHook = true;` in your `next.config.js`.
@@ -11,13 +11,13 @@ Observability is crucial for understanding and optimizing the behavior and perfo
1111
As applications become more complex, it becomes increasingly difficult to identify and diagnose issues that may arise. By leveraging observability tools, such as logging and metrics, developers can gain insights into their application's behavior and identify areas for optimization. With observability, developers can proactively address issues before they become major problems and provide a better user experience. Therefore, it is highly recommended to use observability in your Next.js applications to improve performance, optimize resources, and enhance user experience.
1212

1313
We recommend using OpenTelemetry for instrumenting your apps.
14-
It's a platform agnostic way to instrument apps that allows you to change your observability provider without changing your code.
14+
It's a platform-agnostic way to instrument apps that allows you to change your observability provider without changing your code.
1515
Read [Official OpenTelemetry docs](https://opentelemetry.io/docs/) for more information about OpenTelemetry and how it works.
1616

1717
This documentation uses terms like _Span_, _Trace_ or _Exporter_ throughout this doc, all of which can be found in [the OpenTelemetry Observability Primer](https://opentelemetry.io/docs/concepts/observability-primer/).
1818

19-
Next.js supports OpenTelemetry instrumentation out of the box, that means that we already instrumented Next.js itself.
20-
When you enable OpenTelemetry you we will automatically wrap all your code like `getStaticProps` in a _spans_ with helpful attributes.
19+
Next.js supports OpenTelemetry instrumentation out of the box, which means that we already instrumented Next.js itself.
20+
When you enable OpenTelemetry we will automatically wrap all your code like `getStaticProps` in _spans_ with helpful attributes.
2121

2222
> **Note:** We currently support OpenTelemetry bindings only in serverless functions.
2323
> We don't provide any for `edge` or client side code.
@@ -61,7 +61,7 @@ npm install @opentelemetry/sdk-node @opentelemetry/resources @opentelemetry/sema
6161
```
6262

6363
Now you can initialize `NodeSDK` in your `instrumentation.ts`.
64-
OpenTelemetry APIs are not compatible with edge runtime, so you need to make sure that you are importing them only when `process.end.NEXT_RUNTIME === "nodejs"`. Conditionally importing with an `require` doesn't play well with typescript. We recommend using a conditionally `require`ing new file `instrumentation.node.ts` which can use normal `import`s:
64+
OpenTelemetry APIs are not compatible with edge runtime, so you need to make sure that you are importing them only when `process.env.NEXT_RUNTIME === 'nodejs'`. Conditionally importing with an `require` doesn't play well with typescript. We recommend using a conditionally `require`ing new file `instrumentation.node.ts` which can use normal `import`s:
6565
6666
```ts
6767
// instrumentation.ts
@@ -91,11 +91,11 @@ sdk.start()
9191
```
9292
9393
Doing this is equivalent to using `@vercel/otel`, but it's possible to modify and extend.
94-
For example you could use `@opentelemetry/exporter-trace-otlp-grpc` instead of `@opentelemetry/exporter-trace-otlp-http`.
94+
For example, you could use `@opentelemetry/exporter-trace-otlp-grpc` instead of `@opentelemetry/exporter-trace-otlp-http`.
9595

9696
## Testing your instrumentation
9797

98-
You need a OpenTelemetry collector with a compatible backend to test OpenTelemetry traces locally.
98+
You need an OpenTelemetry collector with a compatible backend to test OpenTelemetry traces locally.
9999
We recommend using our [OpenTelemetry dev environment](https://github.com/vercel/opentelemetry-collector-dev-setup).
100100

101101
If everything works well you should be able to see the root server span labeled as `GET /requested/pathname`.
@@ -132,7 +132,7 @@ If that is not possible on your platform, you can use a custom OpenTelemetry exp
132132

133133
## Custom Spans
134134

135-
You can add your own span with [OpenTelemetry APIs](https://opentelemetry.io/docs/instrumentation/js/instrumentation).
135+
You can add a custom span with [OpenTelemetry APIs](https://opentelemetry.io/docs/instrumentation/js/instrumentation).
136136

137137
```bash
138138
npm install @opentelemetry/api
@@ -166,12 +166,12 @@ Next.js automatically instruments several spans for you to provide useful insigh
166166
Attributes on spans follow [OpenTelemetry semantic conventions](https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/). We also add some custom attributes under the `next` namespace:
167167

168168
- `next.span_name` - duplicates span name
169-
- `next.span_type` - each span type has unique identifier
169+
- `next.span_type` - each span type has a unique identifier
170170
- `next.route` - The route pattern of the request (e.g., `/[param]/user`).
171171
- `next.page`
172172
- This is an internal value used by an app router.
173173
- You can think about it as a route to a special file (like `page.ts`, `layout.ts`, `loading.ts` and others)
174-
- It can be used as an unique identifier only when paired with `next.route` because `/layout` can be used to identify both `/(groupA)/layout.ts` and `/(groupB)/layout.ts`
174+
- It can be used as a unique identifier only when paired with `next.route` because `/layout` can be used to identify both `/(groupA)/layout.ts` and `/(groupB)/layout.ts`
175175

176176
### `[http.method] [next.route]`
177177

@@ -195,7 +195,7 @@ Attributes:
195195

196196
- `next.span_type`: `AppRender.getBodyResult`.
197197

198-
This span represents the process of rendering a route in app router.
198+
This span represents the process of rendering a route in the app router.
199199

200200
Attributes:
201201

@@ -224,7 +224,7 @@ Attributes:
224224

225225
- `next.span_type`: `AppRouteRouteHandlers.runHandler`.
226226

227-
This span represents the execution of an API route handler in app router.
227+
This span represents the execution of an API route handler in the app router.
228228

229229
Attributes:
230230

@@ -272,7 +272,7 @@ Attributes:
272272

273273
- `next.span_type`: `ResolveMetadata.generateMetadata`.
274274

275-
This span represents the process of generating metadata for a specific page (single route can have multiple of these spans).
275+
This span represents the process of generating metadata for a specific page (a single route can have multiple of these spans).
276276

277277
Attributes:
278278

0 commit comments

Comments
 (0)