@owlpane/browser 0.1.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.
@@ -0,0 +1,45 @@
1
+ import type { Env } from "./env.js";
2
+ import { RandomBytes } from "./ids.js";
3
+ import type { Attrs, SpanData, SpanEvent } from "./otlp.js";
4
+ export declare const VERSION = "0.1.0";
5
+ export type ResolvedOptions = {
6
+ endpoint: string;
7
+ projectKey: string;
8
+ serviceName: string;
9
+ environment?: string;
10
+ release?: string;
11
+ sampleRate: number;
12
+ propagateTraceTo: (string | RegExp)[];
13
+ keepQuery: boolean;
14
+ maxErrorsPerPage: number;
15
+ };
16
+ export type ActiveSpan = {
17
+ traceId: string;
18
+ spanId: string;
19
+ sampled: boolean;
20
+ end(o?: {
21
+ status?: SpanData["status"];
22
+ attributes?: Attrs;
23
+ events?: SpanEvent[];
24
+ endMs?: number;
25
+ }): void;
26
+ };
27
+ /** Creates spans, stamps the attributes every RUM span carries, and hands finished spans to `emit`. */
28
+ export type Tracer = ReturnType<typeof createTracer>;
29
+ export declare function createTracer(env: Env, opts: ResolvedOptions, emit: (s: SpanData) => void, sessionId: string, pageUrl: () => {
30
+ url: string;
31
+ path: string;
32
+ }): {
33
+ start: (name: string, kind: 1 | 3, o?: {
34
+ traceId?: string;
35
+ parentSpanId?: string;
36
+ sampled?: boolean;
37
+ startMs?: number;
38
+ attributes?: Attrs;
39
+ }) => ActiveSpan;
40
+ sample: () => boolean;
41
+ common: () => Attrs;
42
+ rand: RandomBytes;
43
+ newTraceId: () => string;
44
+ newSpanId: () => string;
45
+ };
package/dist/tracer.js ADDED
@@ -0,0 +1,61 @@
1
+ import { defaultRandomBytes, newSpanId, newTraceId } from "./ids.js";
2
+ export const VERSION = "0.1.0";
3
+ export function createTracer(env, opts, emit, sessionId, pageUrl) {
4
+ const rand = env.randomBytes ?? defaultRandomBytes();
5
+ const nav = env.navigator;
6
+ function common() {
7
+ const p = pageUrl();
8
+ return {
9
+ "owlpane.rum": "true",
10
+ "session.id": sessionId,
11
+ "browser.page.url": p.url,
12
+ "browser.page.path": p.path,
13
+ "user_agent.original": nav?.userAgent,
14
+ "browser.language": nav?.language,
15
+ "browser.platform": nav?.userAgentData?.platform ?? nav?.platform,
16
+ "browser.mobile": nav?.userAgentData?.mobile,
17
+ };
18
+ }
19
+ function sample() {
20
+ return opts.sampleRate >= 1 ? true : opts.sampleRate <= 0 ? false : env.random() < opts.sampleRate;
21
+ }
22
+ function start(name, kind, o = {}) {
23
+ const traceId = o.traceId ?? newTraceId(rand);
24
+ const spanId = newSpanId(rand);
25
+ const sampled = o.sampled ?? sample();
26
+ const startMs = o.startMs ?? env.now();
27
+ const startAttrs = o.attributes ?? {};
28
+ let done = false;
29
+ return {
30
+ traceId,
31
+ spanId,
32
+ sampled,
33
+ end(e = {}) {
34
+ if (done)
35
+ return;
36
+ done = true;
37
+ if (!sampled)
38
+ return;
39
+ try {
40
+ emit({
41
+ traceId,
42
+ spanId,
43
+ parentSpanId: o.parentSpanId,
44
+ name,
45
+ kind,
46
+ startMs,
47
+ endMs: e.endMs ?? env.now(),
48
+ attributes: { ...common(), ...startAttrs, ...e.attributes },
49
+ events: e.events,
50
+ status: e.status,
51
+ });
52
+ }
53
+ catch {
54
+ /* never throw into the host app */
55
+ }
56
+ },
57
+ };
58
+ }
59
+ return { start, sample, common, rand, newTraceId: () => newTraceId(rand), newSpanId: () => newSpanId(rand) };
60
+ }
61
+ //# sourceMappingURL=tracer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer.js","sourceRoot":"","sources":["../src/tracer.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,kBAAkB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGlF,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAwB/B,MAAM,UAAU,YAAY,CAAC,GAAQ,EAAE,IAAqB,EAAE,IAA2B,EAAE,SAAiB,EAAE,OAA4C;IACxJ,M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AAO;YACP,MAAM;YACN,OAAO;YACP,GAAG,CAAC,CAAC,GAAG,EAAE;gBACR,IAAI,IAAI;oBAAE,OAAO;gBACjB,IAAI,GAAG,IAAI,CAAC;gBACZ,IAAI,CAAC,OAAO;oBAAE,OAAO;gBACrB,IAAI,CAAC;oBACH,IAAI,CAAC;wBACH,OAAO;wBACP,MAAM;wBACN,YAAY,EAAE,CAAC,CAAC,YAAY;wBAC5B,IAAI;wBACJ,IAAI;wBACJ,OAAO;wBACP,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE;wBAC3B,UAAU,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,CAAC,CAAC,UAAU,EAAE;wBAC3D,MAAM,EAAE,CAAC,CAAC,MAAM;wBAChB,MAAM,EAAE,CAAC,CAAC,MAAM;qBACjB,CAAC,CAAC;gBACL,CAAC;gBAAC,MAAM,CAAC;oBACP,mCAAmC;gBACrC,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAC/G,CAAC"}
package/dist/url.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /** Removes credentials, and query/hash unless `keepQuery`. Relative URLs resolve against `base`. */
2
+ export declare function sanitizeUrl(raw: string, base: string | undefined, keepQuery?: boolean): string;
3
+ export declare function urlPath(raw: string, base: string | undefined): string;
4
+ export declare function urlOrigin(raw: string, base: string | undefined): string | null;
5
+ export type AllowEntry = string | RegExp;
6
+ /**
7
+ * Decides whether a request URL may receive a traceparent header.
8
+ * Same-origin is always allowed. String entries match as a prefix of the absolute URL
9
+ * (so "https://api.example.com" covers the whole origin); RegExp entries are tested against the absolute URL.
10
+ */
11
+ export declare function shouldPropagate(raw: string, base: string | undefined, allow?: readonly AllowEntry[]): boolean;
package/dist/url.js ADDED
@@ -0,0 +1,68 @@
1
+ /** Removes credentials, and query/hash unless `keepQuery`. Relative URLs resolve against `base`. */
2
+ export function sanitizeUrl(raw, base, keepQuery = false) {
3
+ try {
4
+ const u = new URL(raw, base);
5
+ u.username = "";
6
+ u.password = "";
7
+ if (!keepQuery) {
8
+ u.search = "";
9
+ u.hash = "";
10
+ }
11
+ else {
12
+ u.hash = "";
13
+ }
14
+ return u.toString();
15
+ }
16
+ catch {
17
+ return keepQuery ? raw.split("#")[0] : raw.split(/[?#]/)[0];
18
+ }
19
+ }
20
+ export function urlPath(raw, base) {
21
+ try {
22
+ return new URL(raw, base).pathname;
23
+ }
24
+ catch {
25
+ return raw.split(/[?#]/)[0];
26
+ }
27
+ }
28
+ export function urlOrigin(raw, base) {
29
+ try {
30
+ const o = new URL(raw, base).origin;
31
+ return o === "null" ? null : o;
32
+ }
33
+ catch {
34
+ return null;
35
+ }
36
+ }
37
+ /**
38
+ * Decides whether a request URL may receive a traceparent header.
39
+ * Same-origin is always allowed. String entries match as a prefix of the absolute URL
40
+ * (so "https://api.example.com" covers the whole origin); RegExp entries are tested against the absolute URL.
41
+ */
42
+ export function shouldPropagate(raw, base, allow = []) {
43
+ let abs;
44
+ try {
45
+ abs = new URL(raw, base).toString();
46
+ }
47
+ catch {
48
+ return false;
49
+ }
50
+ if (base) {
51
+ const a = urlOrigin(abs, undefined);
52
+ if (a && a === urlOrigin(base, undefined))
53
+ return true;
54
+ }
55
+ for (const e of allow) {
56
+ if (typeof e === "string") {
57
+ if (abs.startsWith(e))
58
+ return true;
59
+ }
60
+ else {
61
+ e.lastIndex = 0;
62
+ if (e.test(abs))
63
+ return true;
64
+ }
65
+ }
66
+ return false;
67
+ }
68
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../src/url.ts"],"names":[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C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAID;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,IAAwB,EAAE,QAA+B,EAAE;IACtG,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC;IACzD,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;YAChB,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,32 @@
1
+ export type Rating = "good" | "needs-improvement" | "poor";
2
+ export declare function rate(name: "LCP" | "CLS" | "INP", value: number): Rating;
3
+ /**
4
+ * CLS = largest "session window" of layout shifts: a window closes after a 1s gap
5
+ * since the previous shift or when it reaches 5s. Shifts right after user input are ignored.
6
+ */
7
+ export declare class ClsTracker {
8
+ value: number;
9
+ private windowValue;
10
+ private windowStart;
11
+ private lastShift;
12
+ private open;
13
+ add(shift: {
14
+ value: number;
15
+ startTime: number;
16
+ hadRecentInput?: boolean;
17
+ }): void;
18
+ }
19
+ /**
20
+ * INP: the worst interaction latency, ignoring one outlier per 50 interactions (approximates p98).
21
+ * Events sharing an interactionId are one interaction; its latency is the longest event duration.
22
+ */
23
+ export declare class InpTracker {
24
+ private byId;
25
+ add(entry: {
26
+ interactionId?: number;
27
+ duration: number;
28
+ }): void;
29
+ get count(): number;
30
+ /** Returns undefined when no interaction was observed. */
31
+ get value(): number | undefined;
32
+ }
package/dist/vitals.js ADDED
@@ -0,0 +1,54 @@
1
+ const THRESHOLDS = { LCP: [2500, 4000], CLS: [0.1, 0.25], INP: [200, 500] };
2
+ export function rate(name, value) {
3
+ const [good, poor] = THRESHOLDS[name];
4
+ return value <= good ? "good" : value <= poor ? "needs-improvement" : "poor";
5
+ }
6
+ /**
7
+ * CLS = largest "session window" of layout shifts: a window closes after a 1s gap
8
+ * since the previous shift or when it reaches 5s. Shifts right after user input are ignored.
9
+ */
10
+ export class ClsTracker {
11
+ value = 0;
12
+ windowValue = 0;
13
+ windowStart = 0;
14
+ lastShift = 0;
15
+ open = false;
16
+ add(shift) {
17
+ if (shift.hadRecentInput)
18
+ return;
19
+ if (!this.open || shift.startTime - this.lastShift > 1000 || shift.startTime - this.windowStart > 5000) {
20
+ this.open = true;
21
+ this.windowValue = 0;
22
+ this.windowStart = shift.startTime;
23
+ }
24
+ this.windowValue += shift.value;
25
+ this.lastShift = shift.startTime;
26
+ if (this.windowValue > this.value)
27
+ this.value = this.windowValue;
28
+ }
29
+ }
30
+ /**
31
+ * INP: the worst interaction latency, ignoring one outlier per 50 interactions (approximates p98).
32
+ * Events sharing an interactionId are one interaction; its latency is the longest event duration.
33
+ */
34
+ export class InpTracker {
35
+ byId = new Map();
36
+ add(entry) {
37
+ if (!entry.interactionId)
38
+ return; // not a discrete interaction (e.g. hover)
39
+ const prev = this.byId.get(entry.interactionId) ?? 0;
40
+ if (entry.duration > prev)
41
+ this.byId.set(entry.interactionId, entry.duration);
42
+ }
43
+ get count() {
44
+ return this.byId.size;
45
+ }
46
+ /** Returns undefined when no interaction was observed. */
47
+ get value() {
48
+ const all = [...this.byId.values()].sort((a, b) => b - a);
49
+ if (!all.length)
50
+ return undefined;
51
+ return all[Math.min(all.length - 1, Math.floor(all.length / 50))];
52
+ }
53
+ }
54
+ //# sourceMappingURL=vitals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitals.js","sourceRoot":"","sources":["../src/vitals.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAqC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;AAE9G,MAAM,UAAU,IAAI,CAAC,IAA2B,EAAE,KAAa;IAC7D,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,UAAU;IACrB,KAAK,GAAG,CAAC,CAAC;IACF,WAAW,GAAG,CAAC,CAAC;IAChB,WAAW,GAAG,CAAC,CAAC;IAChB,SAAS,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,KAAK,CAAC;IAErB,GAAG,CAAC,KAAqE;QACvE,IAAI,KAAK,CAAC,cAAc;YAAE,OAAO;QACjC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,EAAE,CAAC;YACvG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IA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AAC,CAAC,CAAC,CAAC;IACpE,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@owlpane/browser",
3
+ "version": "0.1.1",
4
+ "description": "Owlpane real-user-monitoring SDK for browsers: page load, Web Vitals, JS errors, fetch/XHR spans, optional rrweb DOM replay, and W3C trace propagation over OTLP/HTTP JSON.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/balaji-singh/owlpane-sdk.git",
9
+ "directory": "packages/browser"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "dist/index.js",
16
+ "module": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "LICENSE"
27
+ ],
28
+ "sideEffects": false,
29
+ "scripts": {
30
+ "build": "tsc -p tsconfig.json",
31
+ "build:iife": "esbuild src/index.ts --bundle --format=iife --global-name=OwlpaneBrowser --target=es2020 --minify --outfile=dist/owlpane-browser.iife.js",
32
+ "typecheck": "tsc -p tsconfig.json --noEmit",
33
+ "test": "node --test --import tsx $(ls test/*.test.ts)"
34
+ },
35
+ "dependencies": {
36
+ "rrweb": "^2.0.0-alpha.4"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20.19.0",
40
+ "tsx": "^4.20.6",
41
+ "typescript": "^5.9.3"
42
+ }
43
+ }