@diveinto/obs 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -110,8 +110,16 @@ once produced tens of millions of samples a month that nobody read.
110
110
 
111
111
  ## Requirements
112
112
 
113
- Node 22 or newer, ESM. `@opentelemetry/api` is a peer dependency; the SDK
114
- packages are optional peers, needed only if you use OTLP export.
113
+ Node 22 or newer, ESM. **Node only**: the trace context is
114
+ `AsyncLocalStorage` and the file sinks are `node:fs`, so in Next import it
115
+ from the Node branch of `instrumentation.ts` and from route handlers, not
116
+ from Edge middleware.
117
+
118
+ `@opentelemetry/api` and `@opentelemetry/api-logs` are required peers. The
119
+ SDK packages (`@vercel/otel`, `@opentelemetry/sdk-logs`,
120
+ `@opentelemetry/exporter-logs-otlp-proto`, `@opentelemetry/resources`) are
121
+ optional peers, imported dynamically and needed only if you use OTLP export
122
+ via `@diveinto/obs/start`.
115
123
 
116
124
  ## License
117
125
 
package/dist/index.d.ts CHANGED
@@ -9,11 +9,16 @@
9
9
  * which had drifted and grown something the others lacked; this is the union
10
10
  * of the four, and every one of those differences is pinned by a test.
11
11
  *
12
- * WHAT IT IS NOT: this module is runtime-agnostic and must stay importable
13
- * from the Edge runtime. The Node-only pieces live behind their own imports:
14
- * the OTLP start path is `@diveinto/obs/start`, and the file sinks are only
15
- * wired by `setupLogging()`, which an app calls from `instrumentation.ts` on
16
- * the Node runtime. Do not add a static `node:*` import here.
12
+ * NODE ONLY. The trace context is `AsyncLocalStorage` and the file sinks are
13
+ * `node:fs`, so this cannot be imported from an Edge runtime. In Next, import
14
+ * it from the Node branch of `instrumentation.ts` and from route handlers and
15
+ * server actions, never from Edge middleware.
16
+ *
17
+ * What IS kept out of the entry point is the OpenTelemetry SDK: `startOtel`
18
+ * lives behind the `@diveinto/obs/start` subpath and imports @vercel/otel and
19
+ * the OTLP exporter dynamically, so a consumer who never exports pays nothing
20
+ * for them. Do not static-import an SDK package from anything this module
21
+ * reaches; a test enforces it.
17
22
  *
18
23
  * Usage, once, from the app's instrumentation.ts:
19
24
  *
package/dist/index.js CHANGED
@@ -9,11 +9,16 @@
9
9
  * which had drifted and grown something the others lacked; this is the union
10
10
  * of the four, and every one of those differences is pinned by a test.
11
11
  *
12
- * WHAT IT IS NOT: this module is runtime-agnostic and must stay importable
13
- * from the Edge runtime. The Node-only pieces live behind their own imports:
14
- * the OTLP start path is `@diveinto/obs/start`, and the file sinks are only
15
- * wired by `setupLogging()`, which an app calls from `instrumentation.ts` on
16
- * the Node runtime. Do not add a static `node:*` import here.
12
+ * NODE ONLY. The trace context is `AsyncLocalStorage` and the file sinks are
13
+ * `node:fs`, so this cannot be imported from an Edge runtime. In Next, import
14
+ * it from the Node branch of `instrumentation.ts` and from route handlers and
15
+ * server actions, never from Edge middleware.
16
+ *
17
+ * What IS kept out of the entry point is the OpenTelemetry SDK: `startOtel`
18
+ * lives behind the `@diveinto/obs/start` subpath and imports @vercel/otel and
19
+ * the OTLP exporter dynamically, so a consumer who never exports pays nothing
20
+ * for them. Do not static-import an SDK package from anything this module
21
+ * reaches; a test enforces it.
17
22
  *
18
23
  * Usage, once, from the app's instrumentation.ts:
19
24
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diveinto/obs",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Structured logging, tracing and metrics for Next.js and Node services: one record shape, rotating files, W3C trace context, optional OpenTelemetry export",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -41,13 +41,11 @@
41
41
  "@opentelemetry/api": "^1.9.1",
42
42
  "@opentelemetry/api-logs": "^0.219.0",
43
43
  "@opentelemetry/exporter-logs-otlp-proto": "^0.219.0",
44
+ "@opentelemetry/resources": "^2.0.0",
44
45
  "@opentelemetry/sdk-logs": "^0.219.0",
45
46
  "@vercel/otel": "^2.1.3"
46
47
  },
47
48
  "peerDependenciesMeta": {
48
- "@opentelemetry/api-logs": {
49
- "optional": true
50
- },
51
49
  "@opentelemetry/exporter-logs-otlp-proto": {
52
50
  "optional": true
53
51
  },
@@ -56,12 +54,16 @@
56
54
  },
57
55
  "@vercel/otel": {
58
56
  "optional": true
57
+ },
58
+ "@opentelemetry/resources": {
59
+ "optional": true
59
60
  }
60
61
  },
61
62
  "devDependencies": {
62
63
  "@opentelemetry/api": "^1.9.1",
63
64
  "@opentelemetry/api-logs": "^0.219.0",
64
65
  "@opentelemetry/exporter-logs-otlp-proto": "^0.219.0",
66
+ "@opentelemetry/resources": "^2.11.0",
65
67
  "@opentelemetry/sdk-logs": "^0.219.0",
66
68
  "@types/node": "^22.10.2",
67
69
  "@vercel/otel": "^2.1.3",