@superblocksteam/telemetry 2.0.105-next.1 → 2.0.105-next.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.
@@ -25,8 +25,8 @@ export interface BrowserInstrumentationConfig {
25
25
  /**
26
26
  * Create auto-instrumentations for browser telemetry.
27
27
  *
28
- * Returns an array containing XMLHttpRequestInstrumentation and
29
- * FetchInstrumentation.
28
+ * Returns an array containing XMLHttpRequestInstrumentation and optionally
29
+ * FetchInstrumentation (when the package is available).
30
30
  *
31
31
  * Both instrumentations use the provided ignoreUrls to filter out asset
32
32
  * downloads, and propagate trace context only to URLs matching propagateTraceUrls.
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentations.d.ts","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYtE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,4BAA4B,GACpC,eAAe,EAAE,CAcnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
1
+ {"version":3,"file":"instrumentations.d.ts","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAWtE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,4BAA4B,GACpC,eAAe,EAAE,CAiCnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.createBrowserInstrumentations = createBrowserInstrumentations;
11
11
  exports.registerBrowserContextManager = registerBrowserContextManager;
12
12
  const api_1 = require("@opentelemetry/api");
13
- const instrumentation_fetch_1 = require("@opentelemetry/instrumentation-fetch");
14
13
  const instrumentation_xml_http_request_1 = require("@opentelemetry/instrumentation-xml-http-request");
15
14
  const sdk_trace_web_1 = require("@opentelemetry/sdk-trace-web");
16
15
  /**
@@ -21,8 +20,8 @@ const DEFAULT_IGNORE_URLS = /\.(js|css|png|jpg|jpeg|svg|gif|woff|woff2|ttf|eot|i
21
20
  /**
22
21
  * Create auto-instrumentations for browser telemetry.
23
22
  *
24
- * Returns an array containing XMLHttpRequestInstrumentation and
25
- * FetchInstrumentation.
23
+ * Returns an array containing XMLHttpRequestInstrumentation and optionally
24
+ * FetchInstrumentation (when the package is available).
26
25
  *
27
26
  * Both instrumentations use the provided ignoreUrls to filter out asset
28
27
  * downloads, and propagate trace context only to URLs matching propagateTraceUrls.
@@ -42,16 +41,27 @@ const DEFAULT_IGNORE_URLS = /\.(js|css|png|jpg|jpeg|svg|gif|woff|woff2|ttf|eot|i
42
41
  function createBrowserInstrumentations(config) {
43
42
  const ignoreUrls = config?.ignoreUrls ?? [DEFAULT_IGNORE_URLS];
44
43
  const propagateTraceHeaderCorsUrls = config?.propagateTraceUrls ?? [];
45
- return [
44
+ const instrumentations = [
46
45
  new instrumentation_xml_http_request_1.XMLHttpRequestInstrumentation({
47
46
  ignoreUrls,
48
47
  propagateTraceHeaderCorsUrls,
49
48
  }),
50
- new instrumentation_fetch_1.FetchInstrumentation({
49
+ ];
50
+ // Attempt to include FetchInstrumentation if available.
51
+ // This package may not be installed in all environments.
52
+ try {
53
+ const { FetchInstrumentation } =
54
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
55
+ require("@opentelemetry/instrumentation-fetch");
56
+ instrumentations.push(new FetchInstrumentation({
51
57
  ignoreUrls,
52
58
  propagateTraceHeaderCorsUrls,
53
- }),
54
- ];
59
+ }));
60
+ }
61
+ catch {
62
+ // FetchInstrumentation is not available; XHR instrumentation will be used alone.
63
+ }
64
+ return instrumentations;
55
65
  }
56
66
  /**
57
67
  * Register the StackContextManager for async context propagation in the browser.
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentations.js","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAqDH,sEAgBC;AAeD,sEAIC;AAtFD,4CAA6C;AAE7C,gFAA4E;AAC5E,sGAAgG;AAChG,gEAAmE;AAEnE;;;GAGG;AACH,MAAM,mBAAmB,GACvB,yDAAyD,CAAC;AAmB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,6BAA6B,CAC3C,MAAqC;IAErC,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC/D,MAAM,4BAA4B,GAAG,MAAM,EAAE,kBAAkB,IAAI,EAAE,CAAC;IAEtE,OAAO;QACL,IAAI,gEAA6B,CAAC;YAChC,UAAU;YACV,4BAA4B;SAC7B,CAAC;QACF,IAAI,4CAAoB,CAAC;YACvB,UAAU;YACV,4BAA4B;SAC7B,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,6BAA6B;IAC3C,MAAM,cAAc,GAAG,IAAI,mCAAmB,EAAE,CAAC;IACjD,cAAc,CAAC,MAAM,EAAE,CAAC;IACxB,aAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"instrumentations.js","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAoDH,sEAmCC;AAeD,sEAIC;AAxGD,4CAA6C;AAE7C,sGAAgG;AAChG,gEAAmE;AAEnE;;;GAGG;AACH,MAAM,mBAAmB,GACvB,yDAAyD,CAAC;AAmB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,6BAA6B,CAC3C,MAAqC;IAErC,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC/D,MAAM,4BAA4B,GAAG,MAAM,EAAE,kBAAkB,IAAI,EAAE,CAAC;IAEtE,MAAM,gBAAgB,GAAsB;QAC1C,IAAI,gEAA6B,CAAC;YAChC,UAAU;YACV,4BAA4B;SAC7B,CAAC;KACH,CAAC;IAEF,wDAAwD;IACxD,yDAAyD;IACzD,IAAI,CAAC;QACH,MAAM,EAAE,oBAAoB,EAAE;QAC5B,iEAAiE;QACjE,OAAO,CAAC,sCAAsC,CAK7C,CAAC;QACJ,gBAAgB,CAAC,IAAI,CACnB,IAAI,oBAAoB,CAAC;YACvB,UAAU;YACV,4BAA4B;SAC7B,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;IACnF,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,6BAA6B;IAC3C,MAAM,cAAc,GAAG,IAAI,mCAAmB,EAAE,CAAC;IACjD,cAAc,CAAC,MAAM,EAAE,CAAC;IACxB,aAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAClD,CAAC"}
@@ -25,8 +25,8 @@ export interface BrowserInstrumentationConfig {
25
25
  /**
26
26
  * Create auto-instrumentations for browser telemetry.
27
27
  *
28
- * Returns an array containing XMLHttpRequestInstrumentation and
29
- * FetchInstrumentation.
28
+ * Returns an array containing XMLHttpRequestInstrumentation and optionally
29
+ * FetchInstrumentation (when the package is available).
30
30
  *
31
31
  * Both instrumentations use the provided ignoreUrls to filter out asset
32
32
  * downloads, and propagate trace context only to URLs matching propagateTraceUrls.
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentations.d.ts","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYtE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,4BAA4B,GACpC,eAAe,EAAE,CAcnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
1
+ {"version":3,"file":"instrumentations.d.ts","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAWtE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,4BAA4B,GACpC,eAAe,EAAE,CAiCnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
@@ -6,7 +6,6 @@
6
6
  * trace context propagation.
7
7
  */
8
8
  import { context } from "@opentelemetry/api";
9
- import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
10
9
  import { XMLHttpRequestInstrumentation } from "@opentelemetry/instrumentation-xml-http-request";
11
10
  import { StackContextManager } from "@opentelemetry/sdk-trace-web";
12
11
  /**
@@ -17,8 +16,8 @@ const DEFAULT_IGNORE_URLS = /\.(js|css|png|jpg|jpeg|svg|gif|woff|woff2|ttf|eot|i
17
16
  /**
18
17
  * Create auto-instrumentations for browser telemetry.
19
18
  *
20
- * Returns an array containing XMLHttpRequestInstrumentation and
21
- * FetchInstrumentation.
19
+ * Returns an array containing XMLHttpRequestInstrumentation and optionally
20
+ * FetchInstrumentation (when the package is available).
22
21
  *
23
22
  * Both instrumentations use the provided ignoreUrls to filter out asset
24
23
  * downloads, and propagate trace context only to URLs matching propagateTraceUrls.
@@ -38,16 +37,27 @@ const DEFAULT_IGNORE_URLS = /\.(js|css|png|jpg|jpeg|svg|gif|woff|woff2|ttf|eot|i
38
37
  export function createBrowserInstrumentations(config) {
39
38
  const ignoreUrls = config?.ignoreUrls ?? [DEFAULT_IGNORE_URLS];
40
39
  const propagateTraceHeaderCorsUrls = config?.propagateTraceUrls ?? [];
41
- return [
40
+ const instrumentations = [
42
41
  new XMLHttpRequestInstrumentation({
43
42
  ignoreUrls,
44
43
  propagateTraceHeaderCorsUrls,
45
44
  }),
46
- new FetchInstrumentation({
45
+ ];
46
+ // Attempt to include FetchInstrumentation if available.
47
+ // This package may not be installed in all environments.
48
+ try {
49
+ const { FetchInstrumentation } =
50
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
51
+ require("@opentelemetry/instrumentation-fetch");
52
+ instrumentations.push(new FetchInstrumentation({
47
53
  ignoreUrls,
48
54
  propagateTraceHeaderCorsUrls,
49
- }),
50
- ];
55
+ }));
56
+ }
57
+ catch {
58
+ // FetchInstrumentation is not available; XHR instrumentation will be used alone.
59
+ }
60
+ return instrumentations;
51
61
  }
52
62
  /**
53
63
  * Register the StackContextManager for async context propagation in the browser.
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentations.js","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;GAGG;AACH,MAAM,mBAAmB,GACvB,yDAAyD,CAAC;AAmB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAqC;IAErC,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC/D,MAAM,4BAA4B,GAAG,MAAM,EAAE,kBAAkB,IAAI,EAAE,CAAC;IAEtE,OAAO;QACL,IAAI,6BAA6B,CAAC;YAChC,UAAU;YACV,4BAA4B;SAC7B,CAAC;QACF,IAAI,oBAAoB,CAAC;YACvB,UAAU;YACV,4BAA4B;SAC7B,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,6BAA6B;IAC3C,MAAM,cAAc,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACjD,cAAc,CAAC,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"instrumentations.js","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;GAGG;AACH,MAAM,mBAAmB,GACvB,yDAAyD,CAAC;AAmB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAqC;IAErC,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC/D,MAAM,4BAA4B,GAAG,MAAM,EAAE,kBAAkB,IAAI,EAAE,CAAC;IAEtE,MAAM,gBAAgB,GAAsB;QAC1C,IAAI,6BAA6B,CAAC;YAChC,UAAU;YACV,4BAA4B;SAC7B,CAAC;KACH,CAAC;IAEF,wDAAwD;IACxD,yDAAyD;IACzD,IAAI,CAAC;QACH,MAAM,EAAE,oBAAoB,EAAE;QAC5B,iEAAiE;QACjE,OAAO,CAAC,sCAAsC,CAK7C,CAAC;QACJ,gBAAgB,CAAC,IAAI,CACnB,IAAI,oBAAoB,CAAC;YACvB,UAAU;YACV,4BAA4B;SAC7B,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;IACnF,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,6BAA6B;IAC3C,MAAM,cAAc,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACjD,cAAc,CAAC,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAClD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/telemetry",
3
- "version": "2.0.105-next.1",
3
+ "version": "2.0.105-next.2",
4
4
  "description": "Superblocks Telemetry - Canonical OTEL bootstrap with tier-aware policy enforcement",
5
5
  "license": "Superblocks Community Software License",
6
6
  "repository": {
@@ -52,7 +52,6 @@
52
52
  "@opentelemetry/exporter-metrics-otlp-http": "^0.203.0",
53
53
  "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
54
54
  "@opentelemetry/instrumentation": "^0.55.0",
55
- "@opentelemetry/instrumentation-fetch": "^0.55.0",
56
55
  "@opentelemetry/instrumentation-xml-http-request": "^0.55.0",
57
56
  "@opentelemetry/resources": "^2.0.1",
58
57
  "@opentelemetry/sdk-logs": "^0.203.0",
@@ -76,10 +75,10 @@
76
75
  "typescript": "^5.9.3",
77
76
  "typescript-eslint": "^8.47.0",
78
77
  "vitest": "^2.0.0",
79
- "@superblocksteam/shared": "0.9577.0"
78
+ "@superblocksteam/shared": "0.9577.1"
80
79
  },
81
80
  "peerDependencies": {
82
- "@superblocksteam/shared": "0.9577.0"
81
+ "@superblocksteam/shared": "0.9577.1"
83
82
  },
84
83
  "engines": {
85
84
  "node": ">=24"