@mark1russell7/otel-ts 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +7 -5
- package/dist/.tsbuildinfo +1 -1
- package/dist/node.d.ts +11 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +21 -11
- package/dist/node.js.map +1 -1
- package/package.json +3 -1
- package/src/node.ts +32 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Russell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@ OpenTelemetry and Grafana Faro for TypeScript web apps, with one `init()` call.
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
Install the package from
|
|
7
|
+
Install the package from npm:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pnpm add
|
|
10
|
+
pnpm add @mark1russell7/otel-ts
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The
|
|
13
|
+
The npm package contains the compiled `dist/` folder. You do not need a build step.
|
|
14
14
|
|
|
15
15
|
## Quick start
|
|
16
16
|
|
|
@@ -343,7 +343,9 @@ node --import ./dist/instrumentation.js dist/server.js
|
|
|
343
343
|
|
|
344
344
|
The instrumentations patch a module when it loads, so this module must load before the modules of the service. In an ES module service, the CommonJS hook does not see a package that an ES module imports. When you give `importMetaUrl`, `startNodeTelemetry()` registers the loader hook of OpenTelemetry (`@opentelemetry/instrumentation/hook.mjs`) before the SDK starts. The hook then patches those imports too.
|
|
345
345
|
|
|
346
|
-
`startNodeTelemetry()` starts nothing when `OTEL_EXPORTER_OTLP_ENDPOINT` has no value. Set `enabled` to change this. By default, it stops the SDK and sends the last spans at `SIGTERM` and `SIGINT`.
|
|
346
|
+
`startNodeTelemetry()` starts nothing when `OTEL_EXPORTER_OTLP_ENDPOINT` has no value. Set `enabled` to change this. By default, it stops the SDK and sends the last spans at `SIGTERM` and `SIGINT`. Then, when the service has no listener of its own for the signal, the process ends with the signal, as it does without `startNodeTelemetry()`. When the service has a listener, that listener ends the process. Set `stopOnSignals: false` to add no listener.
|
|
347
|
+
|
|
348
|
+
The option `env` sets only `enabled` and the service name. The SDK reads its exporter settings (`OTEL_EXPORTER_OTLP_*`) from `process.env`. To send the spans to another endpoint, give `traceExporter`.
|
|
347
349
|
|
|
348
350
|
### The trace of a write, in its echo
|
|
349
351
|
|
|
@@ -415,4 +417,4 @@ pnpm test
|
|
|
415
417
|
- `browser runtime`: The tests in happy-dom. The project gives async-browser-context the browser runtime, as a browser does.
|
|
416
418
|
- `node`: The tests in `test/node/`. Node.js gives async-browser-context the native `AsyncLocalStorage`.
|
|
417
419
|
|
|
418
|
-
|
|
420
|
+
`pnpm run build` writes `dist/`. Git ignores `dist/`: the release workflow builds it from `src/` for each npm version (`RELEASING.md`).
|