@flareapp/js 2.6.0 → 2.8.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/README.md +17 -0
- package/dist/browser.cjs +45 -8
- package/dist/browser.d.cts +4 -3
- package/dist/browser.d.mts +4 -3
- package/dist/browser.mjs +19 -3
- package/dist/componentProfiler-C6qY96Bt.cjs +2497 -0
- package/dist/componentProfiler-CoH2m13n.mjs +2342 -0
- package/dist/index.cjs +21 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +3 -3
- package/dist/spanTypes-CjF1_Uqi.d.mts +161 -0
- package/dist/spanTypes-iA1RdfLw.d.cts +161 -0
- package/package.json +3 -2
- package/dist/BrowserFlushScheduler-CR7L8-z6.d.cts +0 -43
- package/dist/BrowserFlushScheduler-CZiDvxtf.d.mts +0 -43
- package/dist/catchWindowErrors-DaCqd2yC.mjs +0 -124
- package/dist/catchWindowErrors-_IlVo06V.cjs +0 -153
package/README.md
CHANGED
|
@@ -51,6 +51,23 @@ flare.logger.info('Checkout started', { cartId: cart.id, total: cart.total });
|
|
|
51
51
|
Logs are buffered and batched, and flushed when the tab is hidden so buffered logs survive a page unload. The optional
|
|
52
52
|
second argument is structured, searchable attributes.
|
|
53
53
|
|
|
54
|
+
## What happens when someone leaves the page
|
|
55
|
+
|
|
56
|
+
Logs and spans are batched, so there's usually something unsent when a visitor leaves. The client flushes it when
|
|
57
|
+
the tab is hidden or the page closes.
|
|
58
|
+
|
|
59
|
+
Browsers cap what you can send at that moment: roughly 64KB across every request still in flight. The client stays
|
|
60
|
+
under 60KB, and logs and spans share that budget.
|
|
61
|
+
|
|
62
|
+
Switching tabs is safe. Hiding a tab triggers the same flush, and whatever didn't fit goes out when the visitor
|
|
63
|
+
comes back.
|
|
64
|
+
|
|
65
|
+
If nothing fits, the batch is still sent, as a normal request instead of a keepalive one. That usually lands, but
|
|
66
|
+
it can be cancelled if the page closes right then.
|
|
67
|
+
|
|
68
|
+
You'll only hit the limit on pages that produce a lot of telemetry before the visitor leaves. Log less on those
|
|
69
|
+
pages rather than raising the limits.
|
|
70
|
+
|
|
54
71
|
## Documentation
|
|
55
72
|
|
|
56
73
|
Full documentation on configuration, hooks, context, breadcrumbs, solution providers, and more is available
|
package/dist/browser.cjs
CHANGED
|
@@ -1,21 +1,58 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_componentProfiler = require('./componentProfiler-C6qY96Bt.cjs');
|
|
3
3
|
let _flareapp_core = require("@flareapp/core");
|
|
4
4
|
|
|
5
5
|
//#region src/browser.ts
|
|
6
6
|
var Flare = class extends _flareapp_core.Flare {
|
|
7
|
-
constructor(api = new _flareapp_core.Api(), contextCollector =
|
|
8
|
-
super(api, contextCollector, fileReader, scopeProvider, new
|
|
7
|
+
constructor(api = new _flareapp_core.Api(), contextCollector = require_componentProfiler.collectBrowser, fileReader = new require_componentProfiler.FetchFileReader(), scopeProvider = new _flareapp_core.GlobalScopeProvider()) {
|
|
8
|
+
super(api, contextCollector, fileReader, scopeProvider, new require_componentProfiler.BrowserFlushScheduler());
|
|
9
9
|
this.setSdkInfo({
|
|
10
10
|
name: "@flareapp/js",
|
|
11
|
-
version:
|
|
11
|
+
version: require_componentProfiler.CLIENT_VERSION
|
|
12
12
|
});
|
|
13
|
+
this.setFramework({ name: _flareapp_core.FrameworkName.Js });
|
|
14
|
+
}
|
|
15
|
+
configure(config) {
|
|
16
|
+
const wasTracing = this.config.enableTracing;
|
|
17
|
+
super.configure(config);
|
|
18
|
+
const nowTracing = this.config.enableTracing;
|
|
19
|
+
if (!wasTracing && nowTracing) {
|
|
20
|
+
require_componentProfiler.instrumentFetch(this);
|
|
21
|
+
require_componentProfiler.instrumentXHR(this);
|
|
22
|
+
require_componentProfiler.startBrowserTracing(this);
|
|
23
|
+
} else if (wasTracing && !nowTracing) {
|
|
24
|
+
require_componentProfiler.stopBrowserTracing();
|
|
25
|
+
require_componentProfiler.unpatchFetch();
|
|
26
|
+
require_componentProfiler.unpatchXHR();
|
|
27
|
+
}
|
|
28
|
+
return this;
|
|
13
29
|
}
|
|
14
30
|
};
|
|
15
31
|
|
|
16
32
|
//#endregion
|
|
17
|
-
exports.BrowserFlushScheduler =
|
|
18
|
-
exports
|
|
33
|
+
exports.BrowserFlushScheduler = require_componentProfiler.BrowserFlushScheduler;
|
|
34
|
+
Object.defineProperty(exports, 'BrowserSpanType', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _flareapp_core.BrowserSpanType;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports.FetchFileReader = require_componentProfiler.FetchFileReader;
|
|
19
41
|
exports.Flare = Flare;
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
42
|
+
exports.absoluteHref = require_componentProfiler.absoluteHref;
|
|
43
|
+
exports.absoluteUrl = require_componentProfiler.absoluteUrl;
|
|
44
|
+
exports.activeComponentRoot = require_componentProfiler.activeComponentRoot;
|
|
45
|
+
exports.catchWindowErrors = require_componentProfiler.catchWindowErrors;
|
|
46
|
+
exports.collectBrowser = require_componentProfiler.collectBrowser;
|
|
47
|
+
exports.createFlareResolver = require_componentProfiler.createFlareResolver;
|
|
48
|
+
exports.currentPath = require_componentProfiler.currentPath;
|
|
49
|
+
exports.instrumentOnce = require_componentProfiler.instrumentOnce;
|
|
50
|
+
exports.insulate = require_componentProfiler.insulate;
|
|
51
|
+
exports.nowNano = require_componentProfiler.nowNano;
|
|
52
|
+
exports.recordComponentSpan = require_componentProfiler.recordComponentSpan;
|
|
53
|
+
exports.registerNavigationSource = require_componentProfiler.registerNavigationSource;
|
|
54
|
+
exports.reserveSpanId = require_componentProfiler.reserveSpanId;
|
|
55
|
+
exports.resolveComponentParent = require_componentProfiler.resolveComponentParent;
|
|
56
|
+
exports.resolveHref = require_componentProfiler.resolveHref;
|
|
57
|
+
exports.routeName = require_componentProfiler.routeName;
|
|
58
|
+
exports.safeInvoke = require_componentProfiler.safeInvoke;
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import { Api, ContextCollector, FileReader, Flare as Flare$1, ScopeProvider } from "@flareapp/core";
|
|
1
|
+
import { C as collectBrowser, S as FetchFileReader, T as createFlareResolver, _ as RouteName, a as nowNano, b as routeName, c as resolveComponentParent, d as TrackTeardown, f as instrumentOnce, g as NavigationSource, h as registerNavigationSource, i as activeComponentRoot, l as absoluteHref, m as safeInvoke, n as ComponentSpanRecord, o as recordComponentSpan, p as insulate, r as ComponentTraceContext, s as reserveSpanId, t as BrowserSpanType, u as absoluteUrl, v as currentPath, w as catchWindowErrors, x as BrowserFlushScheduler, y as resolveHref } from "./spanTypes-iA1RdfLw.cjs";
|
|
2
|
+
import { Api, Config, ContextCollector, FileReader, Flare as Flare$1, ScopeProvider } from "@flareapp/core";
|
|
3
3
|
|
|
4
4
|
//#region src/browser.d.ts
|
|
5
5
|
declare class Flare extends Flare$1 {
|
|
6
6
|
constructor(api?: Api, contextCollector?: ContextCollector, fileReader?: FileReader, scopeProvider?: ScopeProvider);
|
|
7
|
+
configure(config: Partial<Config>): this;
|
|
7
8
|
}
|
|
8
9
|
//#endregion
|
|
9
|
-
export { BrowserFlushScheduler, FetchFileReader, Flare, catchWindowErrors, collectBrowser };
|
|
10
|
+
export { BrowserFlushScheduler, BrowserSpanType, type ComponentSpanRecord, type ComponentTraceContext, FetchFileReader, Flare, type NavigationSource, type RouteName, type TrackTeardown, absoluteHref, absoluteUrl, activeComponentRoot, catchWindowErrors, collectBrowser, createFlareResolver, currentPath, instrumentOnce, insulate, nowNano, recordComponentSpan, registerNavigationSource, reserveSpanId, resolveComponentParent, resolveHref, routeName, safeInvoke };
|
package/dist/browser.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import { Api, ContextCollector, FileReader, Flare as Flare$1, ScopeProvider } from "@flareapp/core";
|
|
1
|
+
import { C as collectBrowser, S as FetchFileReader, T as createFlareResolver, _ as RouteName, a as nowNano, b as routeName, c as resolveComponentParent, d as TrackTeardown, f as instrumentOnce, g as NavigationSource, h as registerNavigationSource, i as activeComponentRoot, l as absoluteHref, m as safeInvoke, n as ComponentSpanRecord, o as recordComponentSpan, p as insulate, r as ComponentTraceContext, s as reserveSpanId, t as BrowserSpanType, u as absoluteUrl, v as currentPath, w as catchWindowErrors, x as BrowserFlushScheduler, y as resolveHref } from "./spanTypes-CjF1_Uqi.mjs";
|
|
2
|
+
import { Api, Config, ContextCollector, FileReader, Flare as Flare$1, ScopeProvider } from "@flareapp/core";
|
|
3
3
|
|
|
4
4
|
//#region src/browser.d.ts
|
|
5
5
|
declare class Flare extends Flare$1 {
|
|
6
6
|
constructor(api?: Api, contextCollector?: ContextCollector, fileReader?: FileReader, scopeProvider?: ScopeProvider);
|
|
7
|
+
configure(config: Partial<Config>): this;
|
|
7
8
|
}
|
|
8
9
|
//#endregion
|
|
9
|
-
export { BrowserFlushScheduler, FetchFileReader, Flare, catchWindowErrors, collectBrowser };
|
|
10
|
+
export { BrowserFlushScheduler, BrowserSpanType, type ComponentSpanRecord, type ComponentTraceContext, FetchFileReader, Flare, type NavigationSource, type RouteName, type TrackTeardown, absoluteHref, absoluteUrl, activeComponentRoot, catchWindowErrors, collectBrowser, createFlareResolver, currentPath, instrumentOnce, insulate, nowNano, recordComponentSpan, registerNavigationSource, reserveSpanId, resolveComponentParent, resolveHref, routeName, safeInvoke };
|
package/dist/browser.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Api, Flare as Flare$1, GlobalScopeProvider } from "@flareapp/core";
|
|
1
|
+
import { C as safeInvoke, D as BrowserFlushScheduler, E as collectBrowser, S as insulate, T as FetchFileReader, _ as unpatchXHR, a as resolveComponentParent, b as BrowserSpanType, c as registerNavigationSource, d as currentPath, f as resolveHref, g as instrumentXHR, h as absoluteUrl, i as reserveSpanId, l as startBrowserTracing, m as absoluteHref, n as nowNano, o as catchWindowErrors, p as routeName, r as recordComponentSpan, s as createFlareResolver, t as activeComponentRoot, u as stopBrowserTracing, v as instrumentFetch, w as CLIENT_VERSION, x as instrumentOnce, y as unpatchFetch } from "./componentProfiler-CoH2m13n.mjs";
|
|
2
|
+
import { Api, Flare as Flare$1, FrameworkName, GlobalScopeProvider } from "@flareapp/core";
|
|
3
3
|
|
|
4
4
|
//#region src/browser.ts
|
|
5
5
|
var Flare = class extends Flare$1 {
|
|
@@ -9,8 +9,24 @@ var Flare = class extends Flare$1 {
|
|
|
9
9
|
name: "@flareapp/js",
|
|
10
10
|
version: CLIENT_VERSION
|
|
11
11
|
});
|
|
12
|
+
this.setFramework({ name: FrameworkName.Js });
|
|
13
|
+
}
|
|
14
|
+
configure(config) {
|
|
15
|
+
const wasTracing = this.config.enableTracing;
|
|
16
|
+
super.configure(config);
|
|
17
|
+
const nowTracing = this.config.enableTracing;
|
|
18
|
+
if (!wasTracing && nowTracing) {
|
|
19
|
+
instrumentFetch(this);
|
|
20
|
+
instrumentXHR(this);
|
|
21
|
+
startBrowserTracing(this);
|
|
22
|
+
} else if (wasTracing && !nowTracing) {
|
|
23
|
+
stopBrowserTracing();
|
|
24
|
+
unpatchFetch();
|
|
25
|
+
unpatchXHR();
|
|
26
|
+
}
|
|
27
|
+
return this;
|
|
12
28
|
}
|
|
13
29
|
};
|
|
14
30
|
|
|
15
31
|
//#endregion
|
|
16
|
-
export { BrowserFlushScheduler, FetchFileReader, Flare, catchWindowErrors, collectBrowser };
|
|
32
|
+
export { BrowserFlushScheduler, BrowserSpanType, FetchFileReader, Flare, absoluteHref, absoluteUrl, activeComponentRoot, catchWindowErrors, collectBrowser, createFlareResolver, currentPath, instrumentOnce, insulate, nowNano, recordComponentSpan, registerNavigationSource, reserveSpanId, resolveComponentParent, resolveHref, routeName, safeInvoke };
|