Skip to content

Conversation

Msksgm
Copy link
Member

@Msksgm Msksgm commented Sep 26, 2025

original

preview.

drifted diffs.

> check:i18n
> scripts/check-i18n.sh -d content/ja/docs/languages/js/

Processing paths: content/ja/docs/languages/js/
diff --git a/content/en/docs/languages/js/resources.md b/content/en/docs/languages/js/resources.md
index b15d14fb..fb8f3dc7 100644
--- a/content/en/docs/languages/js/resources.md
+++ b/content/en/docs/languages/js/resources.md
@@ -248,8 +248,7 @@ DockerCGroupV1Detector found resource. Resource {
 
 There are more resource detectors you can add to your configuration, for example
 to get details about your [Cloud] environment or [Deployment]. For more, see the
-complete
-[list of detectors](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node).
+[packages named `resource-detector-*` in the opentelemetry-js-contrib repository](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages).
 
 [getting started - node.js]: /docs/languages/js/getting-started/nodejs/
 [process and process runtime resources]: /docs/specs/semconv/resource/process/
diff --git a/content/en/docs/languages/js/propagation.md b/content/en/docs/languages/js/propagation.md
index 950f1157..99ffb437 100644
--- a/content/en/docs/languages/js/propagation.md
+++ b/content/en/docs/languages/js/propagation.md
@@ -5,7 +5,7 @@ weight: 65
 cSpell:ignore: rolldice
 ---
 
-{{% docs/languages/propagation js %}}
+{{% docs/languages/propagation %}}
 
 ## Automatic context propagation
 
@@ -33,15 +33,10 @@ dependencies:
 
 ```sh
 npm init -y
-npm install typescript \
-  ts-node \
-  @types/node \
-  undici \
+npm install undici \
   @opentelemetry/instrumentation-undici \
   @opentelemetry/sdk-node
-
-# initialize typescript
-npx tsc --init
+npm install -D tsx  # a tool to run TypeScript (.ts) files directly with node

{{% /tab %}} {{% tab JavaScript %}}
@@ -55,12 +50,13 @@ npm install undici \

{{% /tab %}} {{< /tabpane >}}

-Next, create a new file called client.ts (or client.js) with the following
+Next, create a new file called client.ts (or client.js) with the following
content:

{{< tabpane text=true >}} {{% tab TypeScript %}}

+/* client.ts */
import { NodeSDK } from '@opentelemetry/sdk-node';
import {
  SimpleSpanProcessor,
@@ -84,14 +80,13 @@ request('http://localhost:8080/rolldice').then((response) => {
{{% /tab %}} {{% tab JavaScript %}}

```js
-const { NodeSDK } = require('@opentelemetry/sdk-node');
-const {
+/* instrumentation.mjs */
+import { NodeSDK } from '@opentelemetry/sdk-node';
+import {
  SimpleSpanProcessor,
  ConsoleSpanExporter,
-} = require('@opentelemetry/sdk-trace-node');
-const {
-  UndiciInstrumentation,
-} = require('@opentelemetry/instrumentation-undici');
+} from '@opentelemetry/sdk-trace-node';
+import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';

const sdk = new NodeSDK({
  spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())],
@@ -114,14 +109,14 @@ the [Getting Started](../getting-started/nodejs) running in one shell:
{{< tabpane text=true >}} {{% tab TypeScript %}}

```console
-$ npx ts-node --require ./instrumentation.ts app.ts
+$ npx tsx --import ./instrumentation.ts app.ts
Listening for requests on http://localhost:8080

{{% /tab %}} {{% tab JavaScript %}}

-$ node --require ./instrumentation.js app.js
+$ node --import ./instrumentation.mjs app.js
Listening for requests on http://localhost:8080

@@ -132,7 +127,7 @@ Start a second shell and run the client.ts (or client.js):
{{< tabpane text=true >}} {{% tab TypeScript %}}

-npx ts-node client.ts
+npx tsx client.ts

{{% /tab %}} {{% tab JavaScript %}}
@@ -154,7 +149,7 @@ similar to the following:
}
},
traceId: 'cccd19c3a2d10e589f01bfe2dc896dc2',

  • parentId: undefined,
  • parentSpanContext: undefined,
    traceState: undefined,
    name: 'GET',
    id: '6f64ce484217a7bf',
    @@ -174,14 +169,19 @@ similar to the following:
    Take note of the traceId (cccd19c3a2d10e589f01bfe2dc896dc2) and ID
    (6f64ce484217a7bf). Both can be found in the output of client as well:

-javascript {hl_lines=["6-7"]} +javascript {hl_lines=[6,9]}
{
resource: {
attributes: {
// ...
},
traceId: 'cccd19c3a2d10e589f01bfe2dc896dc2',

  • parentId: '6f64ce484217a7bf',
  • parentSpanContext: {
  • traceId: 'cccd19c3a2d10e589f01bfe2dc896dc2',
  • spanId: '6f64ce484217a7bf',
  • traceFlags: 1,
  • isRemote: true
  • },
    traceState: undefined,
    name: 'GET /rolldice',
    id: '027c5c8b916d29da',
    @@ -469,12 +469,12 @@ To enable OpenTelemetry and see the context propagation in action, create an
    additional file called instrumentation.js with the following content:
-// instrumentation.js
-const { NodeSDK } = require('@opentelemetry/sdk-node');
-const {
+// instrumentation.mjs
+import { NodeSDK } from '@opentelemetry/sdk-node';
+import {
  ConsoleSpanExporter,
  SimpleSpanProcessor,
-} = require('@opentelemetry/sdk-trace-node');
+} from '@opentelemetry/sdk-trace-node';

const sdk = new NodeSDK({
  spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())],
@@ -487,14 +487,14 @@ Use this file to run both, the server and the client, with instrumentation
enabled:

```console
-$ node -r ./instrumentation.js server.js
+$ node --import ./instrumentation.mjs server.js
Server listening on port 8124

and

-node -r ./instrumentation client.js
+node --import ./instrumentation.mjs client.js

After the client has sent data to the server and terminated you should see spans
diff --git a/content/en/docs/languages/js/getting-started/nodejs.md b/content/en/docs/languages/js/getting-started/nodejs.md
index c16fb07c..ffe188ac 100644
--- a/content/en/docs/languages/js/getting-started/nodejs.md
+++ b/content/en/docs/languages/js/getting-started/nodejs.md
@@ -3,7 +3,7 @@ title: Node.js
description: Get telemetry for your app in less than 5 minutes!
aliases: [/docs/js/getting_started/nodejs]
weight: 10
-cSpell:ignore: autoinstrumentations KHTML rolldice
+cSpell:ignore: autoinstrumentations rolldice

This page will show you how to get started with OpenTelemetry in Node.js.
@@ -47,14 +47,8 @@ Next, install Express dependencies.
{{< tabpane text=true >}} {{% tab TypeScript %}}

-npm install typescript \
-  ts-node \
-  @types/node \
-  express \
-  @types/express
-
-# initialize typescript
-npx tsc --init
+npm install express @types/express
+npm install -D tsx  # a tool to run TypeScript (.ts) files directly with node

{{% /tab %}} {{% tab JavaScript %}}
@@ -122,7 +116,7 @@ Run the application with the following command and open
{{< tabpane text=true >}} {{% tab TypeScript %}}

-$ npx ts-node app.ts
+$ npx tsx app.ts
Listening for requests on http://localhost:8080

@@ -167,10 +161,14 @@ To find all autoinstrumentation modules, you can look at the

The instrumentation setup and configuration must be run before your
application code. One tool commonly used for this task is the
---require flag.
+--import flag.

-Create a file named instrumentation.ts (or instrumentation.js if not using
-TypeScript) , which will contain your instrumentation setup code.
+Create a file named instrumentation.ts (or instrumentation.mjs if not using
+TypeScript), which will contain your instrumentation setup code.
+
+{{% alert title="Note" %}} The following examples using
+--import instrumentation.ts (TypeScript) require Node.js v.20 or later. If you
+are using Node.js v.18, please use the JavaScript example. {{% /alert %}}

{{< tabpane text=true >}} {{% tab TypeScript %}}

@@ -198,17 +196,14 @@ sdk.start();
{{% /tab %}} {{% tab JavaScript %}}

-/*instrumentation.js*/
-// Require dependencies
-const { NodeSDK } = require('@opentelemetry/sdk-node');
-const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-node');
-const {
-  getNodeAutoInstrumentations,
-} = require('@opentelemetry/auto-instrumentations-node');
-const {
+/*instrumentation.mjs*/
+import { NodeSDK } from '@opentelemetry/sdk-node';
+import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
+import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
+import {
  PeriodicExportingMetricReader,
  ConsoleMetricExporter,
-} = require('@opentelemetry/sdk-metrics');
+} from '@opentelemetry/sdk-metrics';

const sdk = new NodeSDK({
  traceExporter: new ConsoleSpanExporter(),
@@ -226,22 +221,22 @@ sdk.start();
## Run the instrumented app

Now you can run your application as you normally would, but you can use the
-`--require` flag to load the instrumentation before the application code. Make
-sure you don't have other conflicting `--require` flags such as
-`--require @opentelemetry/auto-instrumentations-node/register` on your
+`--import` flag to load the instrumentation before the application code. Make
+sure you don't have other conflicting `--import` or `--require` flags such as
+`--require @opentelemetry/auto-instrumentations-node/register` in your
`NODE_OPTIONS` environment variable.

{{< tabpane text=true >}} {{% tab TypeScript %}}

```console
-$ npx ts-node --require ./instrumentation.ts app.ts
+$ npx tsx --import ./instrumentation.ts app.ts
Listening for requests on http://localhost:8080

{{% /tab %}} {{% tab JavaScript %}}

-$ node --require ./instrumentation.js app.js
+$ node --import ./instrumentation.mjs app.js
Listening for requests on http://localhost:8080

@@ -254,82 +249,98 @@ few times. After a while you should see the spans printed in the console by the

View example output

-json +js
{

  • "traceId": "3f1fe6256ea46d19ec3ca97b3409ad6d",
  • "parentId": "f0b7b340dd6e08a7",
  • "name": "middleware - query",
  • "id": "41a27f331c7bfed3",
  • "kind": 0,
  • "timestamp": 1624982589722992,
  • "duration": 417,
  • "attributes": {
  • "http.route": "/",
  • "express.name": "query",
  • "express.type": "middleware"
  • resource: {
  • attributes: {
  •  'host.arch': 'arm64',
    
  •  'host.id': '8FEBBC33-D6DA-57FC-8EF0-1A9C14B919F8',
    
  •  'process.pid': 12460,
    
  •  // ... some resource attributes elided ...
    
  •  'process.runtime.version': '22.17.1',
    
  •  'process.runtime.name': 'nodejs',
    
  •  'process.runtime.description': 'Node.js',
    
  •  'telemetry.sdk.language': 'nodejs',
    
  •  'telemetry.sdk.name': 'opentelemetry',
    
  •  'telemetry.sdk.version': '2.0.1'
    
  • }
    },
  • "status": { "code": 0 },
  • "events": []
    -}
    -{
  • "traceId": "3f1fe6256ea46d19ec3ca97b3409ad6d",
  • "parentId": "f0b7b340dd6e08a7",
  • "name": "middleware - expressInit",
  • "id": "e0ed537a699f652a",
  • "kind": 0,
  • "timestamp": 1624982589725778,
  • "duration": 673,
  • "attributes": {
  • "http.route": "/",
  • "express.name": "expressInit",
  • "express.type": "middleware"
  • instrumentationScope: {
  • name: '@opentelemetry/instrumentation-express',
  • version: '0.52.0',
  • schemaUrl: undefined
    },
  • "status": { code: 0 },
  • "events": []
    -}
    -{
  • "traceId": "3f1fe6256ea46d19ec3ca97b3409ad6d",
  • "parentId": "f0b7b340dd6e08a7",
  • "name": "request handler - /",
  • "id": "8614a81e1847b7ef",
  • "kind": 0,
  • "timestamp": 1624982589726941,
  • "duration": 21,
  • "attributes": {
  • "http.route": "/",
  • "express.name": "/",
  • "express.type": "request_handler"
  • traceId: '61e8960c349ca2a3a51289e050fd3b82',
  • parentSpanContext: {
  • traceId: '61e8960c349ca2a3a51289e050fd3b82',
  • spanId: '631b666604f933bc',
  • traceFlags: 1,
  • traceState: undefined
    },
  • "status": { code: 0 },
  • "events": []
  • traceState: undefined,
  • name: 'request handler - /rolldice',
  • id: 'd8fcc05ac4f60c99',
  • kind: 0,
  • timestamp: 1755719307779000,
  • duration: 2801.5,
  • attributes: {
  • 'http.route': '/rolldice',
  • 'express.name': '/rolldice',
  • 'express.type': 'request_handler'
  • },
  • status: { code: 0 },
  • events: [],
  • links: []
    }
    {
  • "traceId": "3f1fe6256ea46d19ec3ca97b3409ad6d",
  • "parentId": undefined,
  • "name": "GET /",
  • "id": "f0b7b340dd6e08a7",
  • "kind": 1,
  • "timestamp": 1624982589720260,
  • "duration": 11380,
  • "attributes": {
  • "http.url": "http://localhost:8080/",
  • "http.host": "localhost:8080",
  • "net.host.name": "localhost",
  • "http.method": "GET",
  • "http.route": "",
  • "http.target": "/",
  • "http.user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
  • "http.flavor": "1.1",
  • "net.transport": "ip_tcp",
  • "net.host.ip": "::1",
  • "net.host.port": 8080,
  • "net.peer.ip": "::1",
  • "net.peer.port": 61520,
  • "http.status_code": 304,
  • "http.status_text": "NOT MODIFIED"
  • resource: {
  • attributes: {
  •  'host.arch': 'arm64',
    
  •  'host.id': '8FEBBC33-D6DA-57FC-8EF0-1A9C14B919F8',
    
  •  'process.pid': 12460,
    
  •  // ... some resource attributes elided ...
    
  •  'process.runtime.version': '22.17.1',
    
  •  'process.runtime.name': 'nodejs',
    
  •  'process.runtime.description': 'Node.js',
    
  •  'telemetry.sdk.language': 'nodejs',
    
  •  'telemetry.sdk.name': 'opentelemetry',
    
  •  'telemetry.sdk.version': '2.0.1'
    
  • }
  • },
  • instrumentationScope: {
  • name: '@opentelemetry/instrumentation-http',
  • version: '0.203.0',
  • schemaUrl: undefined
    },
  • "status": { "code": 1 },
  • "events": []
  • traceId: '61e8960c349ca2a3a51289e050fd3b82',
  • parentSpanContext: undefined,
  • traceState: undefined,
  • name: 'GET /rolldice',
  • id: '631b666604f933bc',
  • kind: 1,
  • timestamp: 1755719307777000,
  • duration: 4705.75,
  • attributes: {
  • 'http.url': 'http://localhost:8080/rolldice',
  • 'http.host': 'localhost:8080',
  • 'net.host.name': 'localhost',
  • 'http.method': 'GET',
  • 'http.scheme': 'http',
  • 'http.target': '/rolldice',
  • 'http.user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:141.0) Gecko/20100101 Firefox/141.0',
  • 'http.flavor': '1.1',
  • 'net.transport': 'ip_tcp',
  • 'net.host.ip': '::ffff:127.0.0.1',
  • 'net.host.port': 8080,
  • 'net.peer.ip': '::ffff:127.0.0.1',
  • 'net.peer.port': 63067,
  • 'http.status_code': 200,
  • 'http.status_text': 'OK',
  • 'http.route': '/rolldice'
  • },
  • status: { code: 0 },
  • events: [],
  • links: []
    }

@@ -348,122 +359,147 @@ the console output, such as the following:
  descriptor: {
    name: 'http.server.duration',
    type: 'HISTOGRAM',
-    description: 'measures the duration of the inbound HTTP requests',
+    description: 'Measures the duration of inbound HTTP requests.',
    unit: 'ms',
-    valueType: 1
+    valueType: 1,
+    advice: {}
  },
  dataPointType: 0,
  dataPoints: [
    {
-      attributes: [Object],
-      startTime: [Array],
-      endTime: [Array],
-      value: [Object]
+      attributes: {
+        'http.scheme': 'http',
+        'http.method': 'GET',
+        'net.host.name': 'localhost',
+        'http.flavor': '1.1',
+        'http.status_code': 200,
+        'net.host.port': 8080,
+        'http.route': '/rolldice'
+      },
+      startTime: [ 1755719307, 782000000 ],
+      endTime: [ 1755719482, 940000000 ],
+      value: {
+        min: 1.439792,
+        max: 5.775,
+        sum: 15.370167,
+        buckets: {
+          boundaries: [
+               0,    5,    10,   25,
+              50,   75,   100,  250,
+             500,  750,  1000, 2500,
+            5000, 7500, 10000
+          ],
+          counts: [
+            0, 5, 1, 0, 0, 0,
+            0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0
+          ]
+        },
+        count: 6
+      }
+    },
+    {
+      attributes: {
+        'http.scheme': 'http',
+        'http.method': 'GET',
+        'net.host.name': 'localhost',
+        'http.flavor': '1.1',
+        'http.status_code': 304,
+        'net.host.port': 8080,
+        'http.route': '/rolldice'
+      },
+      startTime: [ 1755719433, 609000000 ],
+      endTime: [ 1755719482, 940000000 ],
+      value: {
+        min: 1.39575,
+        max: 1.39575,
+        sum: 1.39575,
+        buckets: {
+          boundaries: [
+               0,    5,    10,   25,
+              50,   75,   100,  250,
+             500,  750,  1000, 2500,
+            5000, 7500, 10000
+          ],
+          counts: [
+            0, 1, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0
+          ]
+        },
+        count: 1
+      }
    }
  ]
}
{
  descriptor: {
-    name: 'http.client.duration',
-    type: 'HISTOGRAM',
-    description: 'measures the duration of the outbound HTTP requests',
-    unit: 'ms',
-    valueType: 1
+    name: 'nodejs.eventloop.utilization',
+    type: 'OBSERVABLE_GAUGE',
+    description: 'Event loop utilization',
+    unit: '1',
+    valueType: 1,
+    advice: {}
  },
-  dataPointType: 0,
-  dataPoints: []
-}
-{
-  descriptor: {
-    name: 'db.client.connections.usage',
-    type: 'UP_DOWN_COUNTER',
-    description: 'The number of connections that are currently in the state referenced by the attribute "state".',
-    unit: '{connections}',
-    valueType: 1
-  },
-  dataPointType: 3,
-  dataPoints: []
-}
-{
-  descriptor: {
-    name: 'http.server.duration',
-    type: 'HISTOGRAM',
-    description: 'measures the duration of the inbound HTTP requests',
-    unit: 'ms',
-    valueType: 1
-  },
-  dataPointType: 0,
+  dataPointType: 2,
  dataPoints: [
    {
-      attributes: [Object],
-      startTime: [Array],
-      endTime: [Array],
-      value: [Object]
+      attributes: {},
+      startTime: [ 1755719362, 939000000 ],
+      endTime: [ 1755719482, 940000000 ],
+      value: 0.00843049454565211
    }
  ]
}
{
  descriptor: {
-    name: 'http.client.duration',
+    name: 'v8js.gc.duration',
    type: 'HISTOGRAM',
-    description: 'measures the duration of the outbound HTTP requests',
-    unit: 'ms',
-    valueType: 1
-  },
-  dataPointType: 0,
-  dataPoints: []
-}
-{
-  descriptor: {
-    name: 'db.client.connections.usage',
-    type: 'UP_DOWN_COUNTER',
-    description: 'The number of connections that are currently in the state referenced by the attribute "state".',
-    unit: '{connections}',
-    valueType: 1
-  },
-  dataPointType: 3,
-  dataPoints: []
-}
-{
-  descriptor: {
-    name: 'http.server.duration',
-    type: 'HISTOGRAM',
-    description: 'measures the duration of the inbound HTTP requests',
-    unit: 'ms',
-    valueType: 1
+    description: 'Garbage collection duration by kind, one of major, minor, incremental or weakcb.',
+    unit: 's',
+    valueType: 1,
+    advice: { explicitBucketBoundaries: [ 0.01, 0.1, 1, 10 ] }
  },
  dataPointType: 0,
  dataPoints: [
    {
-      attributes: [Object],
-      startTime: [Array],
-      endTime: [Array],
-      value: [Object]
+      attributes: { 'v8js.gc.type': 'minor' },
+      startTime: [ 1755719303, 5000000 ],
+      endTime: [ 1755719482, 940000000 ],
+      value: {
+        min: 0.0005120840072631835,
+        max: 0.0022552499771118163,
+        sum: 0.006526499509811401,
+        buckets: { boundaries: [ 0.01, 0.1, 1, 10 ], counts: [ 6, 0, 0, 0, 0 ] },
+        count: 6
+      }
+    },
+    {
+      attributes: { 'v8js.gc.type': 'incremental' },
+      startTime: [ 1755719310, 812000000 ],
+      endTime: [ 1755719482, 940000000 ],
+      value: {
+        min: 0.0003403329849243164,
+        max: 0.0012867081165313721,
+        sum: 0.0016270411014556885,
+        buckets: { boundaries: [ 0.01, 0.1, 1, 10 ], counts: [ 2, 0, 0, 0, 0 ] },
+        count: 2
+      }
+    },
+    {
+      attributes: { 'v8js.gc.type': 'major' },
+      startTime: [ 1755719310, 830000000 ],
+      endTime: [ 1755719482, 940000000 ],
+      value: {
+        min: 0.0025888750553131105,
+        max: 0.005744750022888183,
+        sum: 0.008333625078201293,
+        buckets: { boundaries: [ 0.01, 0.1, 1, 10 ], counts: [ 2, 0, 0, 0, 0 ] },
+        count: 2
+      }
    }
  ]
}
-{
-  descriptor: {
-    name: 'http.client.duration',
-    type: 'HISTOGRAM',
-    description: 'measures the duration of the outbound HTTP requests',
-    unit: 'ms',
-    valueType: 1
-  },
-  dataPointType: 0,
-  dataPoints: []
-}
-{
-  descriptor: {
-    name: 'db.client.connections.usage',
-    type: 'UP_DOWN_COUNTER',
-    description: 'The number of connections that are currently in the state referenced by the attribute "state".',
-    unit: '{connections}',
-    valueType: 1
-  },
-  dataPointType: 3,
-  dataPoints: []
-}
@@ -503,9 +539,8 @@ diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO); {{% /tab %}} {{% tab JavaScript %}}
-/*instrumentation.js*/
-// Require dependencies
-const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
+/*instrumentation.mjs*/
+import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';

// For troubleshooting, set the log level to DiagLogLevel.DEBUG
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);
diff --git a/content/en/docs/languages/js/instrumentation.md b/content/en/docs/languages/js/instrumentation.md
index 9a4a253a..d5514df1 100644
--- a/content/en/docs/languages/js/instrumentation.md
+++ b/content/en/docs/languages/js/instrumentation.md
@@ -46,11 +46,8 @@ Next, install Express dependencies.
{{< tabpane text=true >}} {{% tab TypeScript %}}

```sh
-npm install typescript \
-  ts-node \
-  @types/node \
-  express \
-  @types/express
+npm install express @types/express
+npm install -D tsx  # a tool to run TypeScript (.ts) files directly with node

{{% /tab %}} {{% tab JavaScript %}}
@@ -115,7 +112,7 @@ add the following code to it:

/*app.ts*/
-import express, { Express } from 'express';
+import express, { type Express } from 'express';
import { rollTheDice } from './dice';

const PORT: number = parseInt(process.env.PORT || '8080');
@@ -171,7 +168,7 @@ open <http://localhost:8080/rolldice?rolls=12> in your web browser.
{{< tabpane text=true >}} {{% tab TypeScript %}}

```console
-$ npx ts-node app.ts
+$ npx tsx app.ts
Listening for requests on http://localhost:8080

@@ -244,18 +241,18 @@ sdk.start();
{{% /tab %}} {{% tab JavaScript %}}

-/*instrumentation.js*/
-const { NodeSDK } = require('@opentelemetry/sdk-node');
-const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-node');
-const {
+/*instrumentation.mjs*/
+import { NodeSDK } from '@opentelemetry/sdk-node';
+import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
+import {
  PeriodicExportingMetricReader,
  ConsoleMetricExporter,
-} = require('@opentelemetry/sdk-metrics');
-const { resourceFromAttributes } = require('@opentelemetry/resources');
-const {
+} from '@opentelemetry/sdk-metrics';
+import { resourceFromAttributes } from '@opentelemetry/resources';
+import {
  ATTR_SERVICE_NAME,
  ATTR_SERVICE_VERSION,
-} = require('@opentelemetry/semantic-conventions');
+} from '@opentelemetry/semantic-conventions';

const sdk = new NodeSDK({
  resource: resourceFromAttributes({
@@ -287,18 +284,20 @@ API or implementation.
Alternative methods exist for setting up resource attributes. For more
information, see [Resources](/docs/languages/js/resources/).

-To verify your code, run the app by requiring the library:
+{{% alert title="Note" %}} The following examples using
+`--import instrumentation.ts` (TypeScript) require Node.js v20 or later. If you
+are using Node.js v18, please use the JavaScript example. {{% /alert %}}

{{< tabpane text=true >}} {{% tab TypeScript %}}

```sh
-npx ts-node --require ./instrumentation.ts app.ts
+npx tsx --import ./instrumentation.ts app.ts

{{% /tab %}} {{% tab JavaScript %}}

-node --require ./instrumentation.js app.js
+node --import ./instrumentation.mjs app.js

{{% /tab %}} {{< /tabpane >}}
@@ -499,7 +498,7 @@ First, in the application file app.ts (or app.js):

/*app.ts*/
import { trace } from '@opentelemetry/api';
-import express, { Express } from 'express';
+import express, { type Express } from 'express';
import { rollTheDice } from './dice';

const tracer = trace.getTracer('dice-server', '0.1.0');
@@ -625,7 +624,7 @@ The code below illustrates how to create an active span.
{{< tabpane text=true >}} {{% tab TypeScript %}}

```ts
-import { trace, Span } from '@opentelemetry/api';
+import { trace, type Span } from '@opentelemetry/api';

/* ... */

@@ -672,13 +671,13 @@ Start your app as follows, and then send it requests by visiting
{{< tabpane text=true >}} {{% tab TypeScript %}}

```sh
-ts-node --require ./instrumentation.ts app.ts
+npx tsx --import ./instrumentation.ts app.ts

{{% /tab %}} {{% tab JavaScript %}}

-node --require ./instrumentation.js app.js
+node --import ./instrumentation.mjs app.js

{{% /tab %}} {{< /tabpane >}}
@@ -686,19 +685,28 @@ node --require ./instrumentation.js app.js
After a while, you should see the spans printed in the console by the
ConsoleSpanExporter, something like this:

-json +js
{

  • "traceId": "6cc927a05e7f573e63f806a2e9bb7da8",
  • "parentId": undefined,
  • "name": "rollTheDice",
  • "id": "117d98e8add5dc80",
  • "kind": 0,
  • "timestamp": 1688386291908349,
  • "duration": 501,
  • "attributes": {},
  • "status": { "code": 0 },
  • "events": [],
  • "links": []
  • resource: {
  • attributes: {
  •  'service.name': 'dice-server',
    
  •  'service.version': '0.1.0',
    
  •  // ...
    
  • }
  • },
  • instrumentationScope: { name: 'dice-lib', version: undefined, schemaUrl: undefined },
  • traceId: '30d32251088ba9d9bca67b09c43dace0',
  • parentSpanContext: undefined,
  • traceState: undefined,
  • name: 'rollTheDice',
  • id: 'cc8a67c2d4840402',
  • kind: 0,
  • timestamp: 1756165206470000,
  • duration: 35.584,
  • attributes: {},
  • status: { code: 0 },
  • events: [],
  • links: []
    }

@@ -764,32 +772,41 @@ function rollTheDice(rolls, min, max) {
This code creates a child span for each _roll_ that has `parentSpan`'s ID as
their parent ID:

-```json
+```js
+{
+  traceId: '6469e115dc1562dd768c999da0509615',
+  parentSpanContext: {
+    traceId: '6469e115dc1562dd768c999da0509615',
+    spanId: '38691692d6bc3395',
+    // ...
+  },
+  name: 'rollOnce:0',
+  id: '36423bc1ce7532b0',
+  timestamp: 1756165362215000,
+  duration: 85.667,
+  // ...
+}
{
-  "traceId": "ff1d39e648a3dc53ba710e1bf1b86e06",
-  "parentId": "9214ff209e6a8267",
-  "name": "rollOnce:4",
-  "id": "7eccf70703e2bccd",
-  "kind": 0,
-  "timestamp": 1688387049511591,
-  "duration": 22,
-  "attributes": {},
-  "status": { "code": 0 },
-  "events": [],
-  "links": []
+  traceId: '6469e115dc1562dd768c999da0509615',
+  parentSpanContext: {
+    traceId: '6469e115dc1562dd768c999da0509615',
+    spanId: '38691692d6bc3395',
+    // ...
+  },
+  name: 'rollOnce:1',
+  id: 'ed9bbba2264d6872',
+  timestamp: 1756165362215000,
+  duration: 16.834,
+  // ...
}
{
-  "traceId": "ff1d39e648a3dc53ba710e1bf1b86e06",
-  "parentId": undefined,
-  "name": "rollTheDice",
-  "id": "9214ff209e6a8267",
-  "kind": 0,
-  "timestamp": 1688387049510303,
-  "duration": 1314,
-  "attributes": {},
-  "status": { "code": 0 },
-  "events": [],
-  "links": []
+  traceId: '6469e115dc1562dd768c999da0509615',
+  parentSpanContext: undefined,
+  name: 'rollTheDice',
+  id: '38691692d6bc3395',
+  timestamp: 1756165362214000,
+  duration: 1022.209,
+  // ...
}

@@ -799,7 +816,7 @@ The previous examples showed how to create an active span. In some cases, you'll
want to create inactive spans that are siblings of one another rather than being
nested.

-javascript +js
const doWork = () => {
const span1 = tracer.startSpan('work-1');
// do some work
@@ -949,8 +966,8 @@ Add the following to the top of your application file:

import {
-  SEMATTRS_CODE_FUNCTION,
-  SEMATTRS_CODE_FILEPATH,
+  ATTR_CODE_FUNCTION_NAME,
+  ATTR_CODE_FILE_PATH,
} from '@opentelemetry/semantic-conventions';

@@ -958,8 +975,8 @@ import {

const {
-  SEMATTRS_CODE_FUNCTION,
-  SEMATTRS_CODE_FILEPATH,
+  ATTR_CODE_FUNCTION_NAME,
+  ATTR_CODE_FILE_PATH,
} = require('@opentelemetry/semantic-conventions');

@@ -970,8 +987,8 @@ Finally, you can update your file to include semantic attributes:

const doWork = () => {
  tracer.startActiveSpan('app.doWork', (span) => {
-    span.setAttribute(SEMATTRS_CODE_FUNCTION, 'doWork');
-    span.setAttribute(SEMATTRS_CODE_FILEPATH, __filename);
+    span.setAttribute(ATTR_CODE_FUNCTION_NAME, 'doWork');
+    span.setAttribute(ATTR_CODE_FILE_PATH, __filename);

    // Do some work...

@@ -1365,18 +1382,18 @@ opentelemetry.metrics.setGlobalMeterProvider(myServiceMeterProvider);

{{% /tab %}} {{< /tabpane >}}

-You'll need to `--require` this file when you run your app, such as:
+You'll need to `--import` this file when you run your app, such as:

{{< tabpane text=true >}} {{% tab TypeScript %}}

```sh
-ts-node --require ./instrumentation.ts app.ts
+npx tsx --import ./instrumentation.ts app.ts

{{% /tab %}} {{% tab JavaScript %}}

-node --require ./instrumentation.js app.js
+node --import ./instrumentation.mjs app.js

{{% /tab %}} {{< /tabpane >}}
@@ -1437,7 +1454,7 @@ First, in the application file app.ts (or app.js):

/*app.ts*/
import { metrics, trace } from '@opentelemetry/api';
-import express, { Express } from 'express';
+import express, { type Express } from 'express';
import { rollTheDice } from './dice';

const tracer = trace.getTracer('dice-server', '0.1.0');
diff --git a/content/en/docs/languages/js/libraries.md b/content/en/docs/languages/js/libraries.md
index 874c186e..a90a8dc6 100644
--- a/content/en/docs/languages/js/libraries.md
+++ b/content/en/docs/languages/js/libraries.md
@@ -210,7 +210,7 @@ const sdk = new NodeSDK({
Some instrumentation libraries offer additional configuration options.

For example,
-[Express instrumentation](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express#express-instrumentation-options)
+[Express instrumentation](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express#express-instrumentation-options)
offers ways to ignore specified middleware or enrich spans created automatically
with a request hook:

diff --git a/content/en/docs/languages/js/_index.md b/content/en/docs/languages/js/_index.md
index 4438fb18..4fad0632 100644
--- a/content/en/docs/languages/js/_index.md
+++ b/content/en/docs/languages/js/_index.md
@@ -21,7 +21,7 @@ OpenTelemetry.
OpenTelemetry JavaScript has no official supported list of browsers. It is aimed
to work on currently supported versions of major browsers.

-OpenTelemetry JavaScript follows DefinitelyType's support policy for TypeScript
+OpenTelemetry JavaScript follows DefinitelyTyped's support policy for TypeScript
which sets a support window of 2 years. Support for TypeScript versions older
than 2 years will be dropped in minor releases of OpenTelemetry JavaScript.

DRIFTED files: 6 out of 14

@Msksgm Msksgm force-pushed the drifted-content-ja-docs-languages-js branch from 7030f9a to 29d091f Compare September 27, 2025 09:27
@Msksgm Msksgm marked this pull request as ready for review September 27, 2025 09:40
@Msksgm Msksgm requested a review from a team as a code owner September 27, 2025 09:40
@Msksgm Msksgm changed the title fix: drifted files of content/ja/docs/languages/js/ [ja] fix: drifted files of content/ja/docs/languages/js/ Sep 27, 2025
@vitorvasc vitorvasc added the sig-approval-missing Co-owning SIG didn't provide an approval label Sep 29, 2025
Copy link
Contributor

@kohbis kohbis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

細かいですがコメントしています 🙇

@otelbot-docs otelbot-docs bot requested a review from a team October 6, 2025 22:59
@Msksgm
Copy link
Member Author

Msksgm commented Oct 6, 2025

@kohbis

ありがとうございます。対応しました 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang:ja sig-approval-missing Co-owning SIG didn't provide an approval

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants