@superblocksteam/telemetry 2.0.115 → 2.0.116-next.1
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/browser/instrumentations.d.ts +11 -5
- package/dist/browser/instrumentations.d.ts.map +1 -1
- package/dist/browser/instrumentations.js +18 -19
- package/dist/browser/instrumentations.js.map +1 -1
- package/dist-esm/browser/instrumentations.d.ts +11 -5
- package/dist-esm/browser/instrumentations.d.ts.map +1 -1
- package/dist-esm/browser/instrumentations.js +19 -20
- package/dist-esm/browser/instrumentations.js.map +1 -1
- package/package.json +12 -11
|
@@ -21,15 +21,21 @@ export interface BrowserInstrumentationConfig {
|
|
|
21
21
|
* Defaults to common static asset extensions.
|
|
22
22
|
*/
|
|
23
23
|
ignoreUrls?: RegExp[];
|
|
24
|
+
/**
|
|
25
|
+
* Set to true to skip FetchInstrumentation entirely.
|
|
26
|
+
* Acts as an escape valve if the Fetch instrumentation regresses in production
|
|
27
|
+
* without requiring a full revert.
|
|
28
|
+
* Defaults to false.
|
|
29
|
+
*/
|
|
30
|
+
disableFetch?: boolean;
|
|
24
31
|
}
|
|
25
32
|
/**
|
|
26
33
|
* Create auto-instrumentations for browser telemetry.
|
|
27
34
|
*
|
|
28
|
-
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
29
|
-
* FetchInstrumentation
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* downloads, and propagate trace context only to URLs matching propagateTraceUrls.
|
|
35
|
+
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
36
|
+
* FetchInstrumentation. Both instrumentations use the provided ignoreUrls to
|
|
37
|
+
* filter out asset downloads, and propagate trace context only to URLs
|
|
38
|
+
* matching propagateTraceUrls.
|
|
33
39
|
*
|
|
34
40
|
* @param config - Optional instrumentation configuration
|
|
35
41
|
* @returns Array of configured Instrumentation instances
|
|
@@ -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;
|
|
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;AAatE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,4BAA4B,GACpC,eAAe,EAAE,CA6BnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
|
|
@@ -10,21 +10,22 @@ 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");
|
|
13
14
|
const instrumentation_xml_http_request_1 = require("@opentelemetry/instrumentation-xml-http-request");
|
|
14
15
|
const sdk_trace_web_1 = require("@opentelemetry/sdk-trace-web");
|
|
15
16
|
/**
|
|
16
17
|
* Default regex for ignoring static asset URLs.
|
|
18
|
+
* Uses ([?#]|$) to also match cache-busted URLs (e.g. app.js?v=abc123).
|
|
17
19
|
* These requests are not worth tracing and would create noise.
|
|
18
20
|
*/
|
|
19
|
-
const DEFAULT_IGNORE_URLS = /\.(js|css|png|jpg|jpeg|svg|gif|woff|woff2|ttf|eot|ico)
|
|
21
|
+
const DEFAULT_IGNORE_URLS = /\.(js|css|map|png|jpg|jpeg|svg|gif|webp|avif|woff|woff2|ttf|eot|ico)([?#]|$)/i;
|
|
20
22
|
/**
|
|
21
23
|
* Create auto-instrumentations for browser telemetry.
|
|
22
24
|
*
|
|
23
|
-
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
24
|
-
* FetchInstrumentation
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* downloads, and propagate trace context only to URLs matching propagateTraceUrls.
|
|
25
|
+
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
26
|
+
* FetchInstrumentation. Both instrumentations use the provided ignoreUrls to
|
|
27
|
+
* filter out asset downloads, and propagate trace context only to URLs
|
|
28
|
+
* matching propagateTraceUrls.
|
|
28
29
|
*
|
|
29
30
|
* @param config - Optional instrumentation configuration
|
|
30
31
|
* @returns Array of configured Instrumentation instances
|
|
@@ -47,19 +48,17 @@ function createBrowserInstrumentations(config) {
|
|
|
47
48
|
propagateTraceHeaderCorsUrls,
|
|
48
49
|
}),
|
|
49
50
|
];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
catch {
|
|
62
|
-
// FetchInstrumentation is not available; XHR instrumentation will be used alone.
|
|
51
|
+
if (!config?.disableFetch) {
|
|
52
|
+
try {
|
|
53
|
+
instrumentations.push(new instrumentation_fetch_1.FetchInstrumentation({
|
|
54
|
+
ignoreUrls,
|
|
55
|
+
propagateTraceHeaderCorsUrls,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
// FetchInstrumentation failed; XHR instrumentation continues unaffected.
|
|
60
|
+
api_1.diag.warn("[telemetry] FetchInstrumentation failed to initialize", String(err));
|
|
61
|
+
}
|
|
63
62
|
}
|
|
64
63
|
return instrumentations;
|
|
65
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentations.js","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"instrumentations.js","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA4DH,sEA+BC;AAeD,sEAIC;AA5GD,4CAAmD;AAEnD,gFAA4E;AAC5E,sGAAgG;AAChG,gEAAmE;AAEnE;;;;GAIG;AACH,MAAM,mBAAmB,GACvB,+EAA+E,CAAC;AA0BlF;;;;;;;;;;;;;;;;;;;GAmBG;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,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,gBAAgB,CAAC,IAAI,CACnB,IAAI,4CAAoB,CAAC;gBACvB,UAAU;gBACV,4BAA4B;aAC7B,CAAC,CACH,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,yEAAyE;YACzE,UAAI,CAAC,IAAI,CACP,uDAAuD,EACvD,MAAM,CAAC,GAAG,CAAC,CACZ,CAAC;QACJ,CAAC;IACH,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"}
|
|
@@ -21,15 +21,21 @@ export interface BrowserInstrumentationConfig {
|
|
|
21
21
|
* Defaults to common static asset extensions.
|
|
22
22
|
*/
|
|
23
23
|
ignoreUrls?: RegExp[];
|
|
24
|
+
/**
|
|
25
|
+
* Set to true to skip FetchInstrumentation entirely.
|
|
26
|
+
* Acts as an escape valve if the Fetch instrumentation regresses in production
|
|
27
|
+
* without requiring a full revert.
|
|
28
|
+
* Defaults to false.
|
|
29
|
+
*/
|
|
30
|
+
disableFetch?: boolean;
|
|
24
31
|
}
|
|
25
32
|
/**
|
|
26
33
|
* Create auto-instrumentations for browser telemetry.
|
|
27
34
|
*
|
|
28
|
-
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
29
|
-
* FetchInstrumentation
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* downloads, and propagate trace context only to URLs matching propagateTraceUrls.
|
|
35
|
+
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
36
|
+
* FetchInstrumentation. Both instrumentations use the provided ignoreUrls to
|
|
37
|
+
* filter out asset downloads, and propagate trace context only to URLs
|
|
38
|
+
* matching propagateTraceUrls.
|
|
33
39
|
*
|
|
34
40
|
* @param config - Optional instrumentation configuration
|
|
35
41
|
* @returns Array of configured Instrumentation instances
|
|
@@ -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;
|
|
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;AAatE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,4BAA4B,GACpC,eAAe,EAAE,CA6BnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
|
|
@@ -5,22 +5,23 @@
|
|
|
5
5
|
* Handles XHR and Fetch requests with configurable URL filtering and
|
|
6
6
|
* trace context propagation.
|
|
7
7
|
*/
|
|
8
|
-
import { context } from "@opentelemetry/api";
|
|
8
|
+
import { context, diag } from "@opentelemetry/api";
|
|
9
|
+
import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
|
|
9
10
|
import { XMLHttpRequestInstrumentation } from "@opentelemetry/instrumentation-xml-http-request";
|
|
10
11
|
import { StackContextManager } from "@opentelemetry/sdk-trace-web";
|
|
11
12
|
/**
|
|
12
13
|
* Default regex for ignoring static asset URLs.
|
|
14
|
+
* Uses ([?#]|$) to also match cache-busted URLs (e.g. app.js?v=abc123).
|
|
13
15
|
* These requests are not worth tracing and would create noise.
|
|
14
16
|
*/
|
|
15
|
-
const DEFAULT_IGNORE_URLS = /\.(js|css|png|jpg|jpeg|svg|gif|woff|woff2|ttf|eot|ico)
|
|
17
|
+
const DEFAULT_IGNORE_URLS = /\.(js|css|map|png|jpg|jpeg|svg|gif|webp|avif|woff|woff2|ttf|eot|ico)([?#]|$)/i;
|
|
16
18
|
/**
|
|
17
19
|
* Create auto-instrumentations for browser telemetry.
|
|
18
20
|
*
|
|
19
|
-
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
20
|
-
* FetchInstrumentation
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* downloads, and propagate trace context only to URLs matching propagateTraceUrls.
|
|
21
|
+
* Returns an array containing XMLHttpRequestInstrumentation and
|
|
22
|
+
* FetchInstrumentation. Both instrumentations use the provided ignoreUrls to
|
|
23
|
+
* filter out asset downloads, and propagate trace context only to URLs
|
|
24
|
+
* matching propagateTraceUrls.
|
|
24
25
|
*
|
|
25
26
|
* @param config - Optional instrumentation configuration
|
|
26
27
|
* @returns Array of configured Instrumentation instances
|
|
@@ -43,19 +44,17 @@ export function createBrowserInstrumentations(config) {
|
|
|
43
44
|
propagateTraceHeaderCorsUrls,
|
|
44
45
|
}),
|
|
45
46
|
];
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
catch {
|
|
58
|
-
// FetchInstrumentation is not available; XHR instrumentation will be used alone.
|
|
47
|
+
if (!config?.disableFetch) {
|
|
48
|
+
try {
|
|
49
|
+
instrumentations.push(new FetchInstrumentation({
|
|
50
|
+
ignoreUrls,
|
|
51
|
+
propagateTraceHeaderCorsUrls,
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
// FetchInstrumentation failed; XHR instrumentation continues unaffected.
|
|
56
|
+
diag.warn("[telemetry] FetchInstrumentation failed to initialize", String(err));
|
|
57
|
+
}
|
|
59
58
|
}
|
|
60
59
|
return instrumentations;
|
|
61
60
|
}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"instrumentations.js","sourceRoot":"","sources":["../../src/browser/instrumentations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MA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": "2.0.
|
|
3
|
+
"version": "2.0.116-next.1",
|
|
4
4
|
"description": "Superblocks Telemetry - Canonical OTEL bootstrap with tier-aware policy enforcement",
|
|
5
5
|
"license": "Superblocks Community Software License",
|
|
6
6
|
"repository": {
|
|
@@ -45,18 +45,19 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@opentelemetry/api": "^1.9.1",
|
|
48
|
-
"@opentelemetry/api-logs": "^0.
|
|
48
|
+
"@opentelemetry/api-logs": "^0.214.0",
|
|
49
49
|
"@opentelemetry/context-async-hooks": "^2.0.1",
|
|
50
50
|
"@opentelemetry/core": "^2.0.1",
|
|
51
|
-
"@opentelemetry/exporter-logs-otlp-http": "^0.
|
|
52
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.
|
|
53
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
54
|
-
"@opentelemetry/instrumentation": "^0.
|
|
55
|
-
"@opentelemetry/instrumentation-
|
|
51
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.214.0",
|
|
52
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.214.0",
|
|
53
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.214.0",
|
|
54
|
+
"@opentelemetry/instrumentation": "^0.214.0",
|
|
55
|
+
"@opentelemetry/instrumentation-fetch": "^0.214.0",
|
|
56
|
+
"@opentelemetry/instrumentation-xml-http-request": "^0.214.0",
|
|
56
57
|
"@opentelemetry/resources": "^2.0.1",
|
|
57
|
-
"@opentelemetry/sdk-logs": "^0.
|
|
58
|
+
"@opentelemetry/sdk-logs": "^0.214.0",
|
|
58
59
|
"@opentelemetry/sdk-metrics": "^2.0.1",
|
|
59
|
-
"@opentelemetry/sdk-node": "^0.
|
|
60
|
+
"@opentelemetry/sdk-node": "^0.214.0",
|
|
60
61
|
"@opentelemetry/sdk-trace-base": "^2.0.1",
|
|
61
62
|
"@opentelemetry/sdk-trace-node": "^2.0.1",
|
|
62
63
|
"@opentelemetry/sdk-trace-web": "^2.0.1",
|
|
@@ -75,10 +76,10 @@
|
|
|
75
76
|
"typescript": "^5.9.3",
|
|
76
77
|
"typescript-eslint": "^8.47.0",
|
|
77
78
|
"vitest": "^2.0.0",
|
|
78
|
-
"@superblocksteam/shared": "0.
|
|
79
|
+
"@superblocksteam/shared": "0.9586.0"
|
|
79
80
|
},
|
|
80
81
|
"peerDependencies": {
|
|
81
|
-
"@superblocksteam/shared": "0.
|
|
82
|
+
"@superblocksteam/shared": "0.9586.0"
|
|
82
83
|
},
|
|
83
84
|
"engines": {
|
|
84
85
|
"node": ">=24"
|