@flareapp/node 0.10.0 → 0.11.0

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/dist/index.cjs CHANGED
@@ -125,6 +125,25 @@ function redact(value, denylist, seen = /* @__PURE__ */ new WeakSet()) {
125
125
  return out;
126
126
  }
127
127
 
128
+ //#endregion
129
+ //#region src/context/deviceInfo.ts
130
+ /** Node os + runtime as normalised device info. */
131
+ var NodeDeviceInfoProvider = class {
132
+ collect() {
133
+ return {
134
+ os: {
135
+ name: node_os.default.type(),
136
+ version: node_os.default.release()
137
+ },
138
+ runtime: {
139
+ name: "nodejs",
140
+ version: process.version
141
+ }
142
+ };
143
+ }
144
+ };
145
+ const nodeDeviceInfoProvider = new NodeDeviceInfoProvider();
146
+
128
147
  //#endregion
129
148
  //#region src/context/headers.ts
130
149
  /** Case-insensitive. An array value collapses to its first element; callers here want a single value. */
@@ -167,20 +186,15 @@ function projectHeaders(headers, options) {
167
186
  //#endregion
168
187
  //#region src/context/process.ts
169
188
  /**
170
- * Snapshot the Node runtime + host environment at report time as OTel resource attributes. Called
171
- * per-report rather than cached so `process.uptime()` stays accurate and `os.hostname()` tracks mid-run
172
- * changes; cheap enough (property reads plus a couple `os` syscalls).
189
+ * Host + process attributes, read per report so `process.uptime()` and `os.hostname()` stay current.
190
+ * os and runtime come from `NodeDeviceInfoProvider`.
173
191
  */
174
192
  function collectProcessAttributes() {
175
193
  return {
176
- "process.runtime.name": "nodejs",
177
- "process.runtime.version": process.version,
178
194
  "process.pid": process.pid,
179
195
  "process.uptime": process.uptime(),
180
196
  "host.name": node_os.default.hostname(),
181
- "host.arch": process.arch,
182
- "os.type": node_os.default.type(),
183
- "os.version": node_os.default.release()
197
+ "host.arch": process.arch
184
198
  };
185
199
  }
186
200
 
@@ -197,7 +211,8 @@ function makeNodeContextCollector(provider, getOptions) {
197
211
  return (config) => {
198
212
  const attrs = {
199
213
  "flare.entry_point.type": "web",
200
- ...collectProcessAttributes()
214
+ ...collectProcessAttributes(),
215
+ ...(0, _flareapp_core.deviceInfoToAttributes)(nodeDeviceInfoProvider.collect())
201
216
  };
202
217
  const { request } = provider.active();
203
218
  if (request.method) attrs["http.request.method"] = request.method;
@@ -389,7 +404,7 @@ function isLocalFileUrl(url) {
389
404
  //#endregion
390
405
  //#region src/Flare.ts
391
406
  const NODE_SDK_NAME = "@flareapp/node";
392
- const NODE_SDK_VERSION = typeof process !== "undefined" && true ? "0.10.0" : "?";
407
+ const NODE_SDK_VERSION = typeof process !== "undefined" && true ? "0.11.0" : "?";
393
408
  /** `g`/`y` make `.test()` keep `lastIndex` state, so reusing the regex across keys skips every other
394
409
  * match. All other flags are preserved. */
395
410
  function sanitizeRegex(re) {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { Api, DEFAULT_URL_DENYLIST, DEFAULT_URL_DENYLIST as DEFAULT_URL_DENYLIST$1, Flare, Flare as Flare$1, FrameworkName, GlobalScopeProvider, Logger, NullFileReader, Scope, Scope as Scope$1, convertToError, redactUrlQuery, redactUrlQuery as redactUrlQuery$1, resolveDenylist, urlAttributes } from "@flareapp/core";
1
+ import { Api, DEFAULT_URL_DENYLIST, DEFAULT_URL_DENYLIST as DEFAULT_URL_DENYLIST$1, Flare, Flare as Flare$1, FrameworkName, GlobalScopeProvider, Logger, NullFileReader, Scope, Scope as Scope$1, convertToError, deviceInfoToAttributes, redactUrlQuery, redactUrlQuery as redactUrlQuery$1, resolveDenylist, urlAttributes } from "@flareapp/core";
2
2
  import os from "node:os";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { readFile } from "node:fs/promises";
@@ -96,6 +96,25 @@ function redact(value, denylist, seen = /* @__PURE__ */ new WeakSet()) {
96
96
  return out;
97
97
  }
98
98
 
99
+ //#endregion
100
+ //#region src/context/deviceInfo.ts
101
+ /** Node os + runtime as normalised device info. */
102
+ var NodeDeviceInfoProvider = class {
103
+ collect() {
104
+ return {
105
+ os: {
106
+ name: os.type(),
107
+ version: os.release()
108
+ },
109
+ runtime: {
110
+ name: "nodejs",
111
+ version: process.version
112
+ }
113
+ };
114
+ }
115
+ };
116
+ const nodeDeviceInfoProvider = new NodeDeviceInfoProvider();
117
+
99
118
  //#endregion
100
119
  //#region src/context/headers.ts
101
120
  /** Case-insensitive. An array value collapses to its first element; callers here want a single value. */
@@ -138,20 +157,15 @@ function projectHeaders(headers, options) {
138
157
  //#endregion
139
158
  //#region src/context/process.ts
140
159
  /**
141
- * Snapshot the Node runtime + host environment at report time as OTel resource attributes. Called
142
- * per-report rather than cached so `process.uptime()` stays accurate and `os.hostname()` tracks mid-run
143
- * changes; cheap enough (property reads plus a couple `os` syscalls).
160
+ * Host + process attributes, read per report so `process.uptime()` and `os.hostname()` stay current.
161
+ * os and runtime come from `NodeDeviceInfoProvider`.
144
162
  */
145
163
  function collectProcessAttributes() {
146
164
  return {
147
- "process.runtime.name": "nodejs",
148
- "process.runtime.version": process.version,
149
165
  "process.pid": process.pid,
150
166
  "process.uptime": process.uptime(),
151
167
  "host.name": os.hostname(),
152
- "host.arch": process.arch,
153
- "os.type": os.type(),
154
- "os.version": os.release()
168
+ "host.arch": process.arch
155
169
  };
156
170
  }
157
171
 
@@ -168,7 +182,8 @@ function makeNodeContextCollector(provider, getOptions) {
168
182
  return (config) => {
169
183
  const attrs = {
170
184
  "flare.entry_point.type": "web",
171
- ...collectProcessAttributes()
185
+ ...collectProcessAttributes(),
186
+ ...deviceInfoToAttributes(nodeDeviceInfoProvider.collect())
172
187
  };
173
188
  const { request } = provider.active();
174
189
  if (request.method) attrs["http.request.method"] = request.method;
@@ -360,7 +375,7 @@ function isLocalFileUrl(url) {
360
375
  //#endregion
361
376
  //#region src/Flare.ts
362
377
  const NODE_SDK_NAME = "@flareapp/node";
363
- const NODE_SDK_VERSION = typeof process !== "undefined" && true ? "0.10.0" : "?";
378
+ const NODE_SDK_VERSION = typeof process !== "undefined" && true ? "0.11.0" : "?";
364
379
  /** `g`/`y` make `.test()` keep `lastIndex` state, so reusing the regex across keys skips every other
365
380
  * match. All other flags are preserved. */
366
381
  function sanitizeRegex(re) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flareapp/node",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Node.js SDK for flareapp.io",
5
5
  "homepage": "https://flareapp.io",
6
6
  "bugs": {
@@ -44,7 +44,7 @@
44
44
  "release": "release-it"
45
45
  },
46
46
  "dependencies": {
47
- "@flareapp/core": "2.10.0"
47
+ "@flareapp/core": "2.11.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@flareapp/test-helpers": "*",