@owlpane/browser 0.1.6 → 0.1.8
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 +16 -2
- package/dist/events.d.ts +13 -0
- package/dist/events.js +37 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/log-otlp.js +1 -1
- package/dist/tracer.d.ts +1 -1
- package/dist/tracer.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Zero-dependency real-user-monitoring SDK for browsers. Sends OTLP/HTTP JSON traces to the Owlpane ingest gateway.
|
|
4
4
|
|
|
5
|
+
**Status:** GA on [npm](https://www.npmjs.com/package/@owlpane/browser). Long-form guide: [`api/docs/guides/browser-rum.md`](../../../api/docs/guides/browser-rum.md).
|
|
6
|
+
|
|
5
7
|
## Install and use
|
|
6
8
|
|
|
7
9
|
```ts
|
|
@@ -20,9 +22,9 @@ init({
|
|
|
20
22
|
|
|
21
23
|
Script tag: `npm run build:iife -w @owlpane/browser` produces `dist/owlpane-browser.iife.js` (global `OwlpaneBrowser`). It uses `esbuild`, which is not a dependency of this package; it must be present in the workspace `node_modules`.
|
|
22
24
|
|
|
23
|
-
`init()` never throws, is a no-op if called twice, and returns `{ sessionId, flush(), shutdown(), captureException(err), setExperiment(id), setFeatureFlag(key) }`.
|
|
25
|
+
`init()` never throws, is a no-op if called twice, and returns `{ sessionId, flush(), shutdown(), captureException(err), setExperiment(id), setFeatureFlag(key), track(name, properties) }`.
|
|
24
26
|
|
|
25
|
-
`setExperiment("checkout", "b")` stamps `owlpane.experiment.id` on spans that end afterwards (Experiments). `setFeatureFlag("new-nav", "on")` stamps `feature_flag.key` (Feature flags). A browser page is not a mobile app: this SDK does not set `os.name` to iOS or Android.
|
|
27
|
+
`setExperiment("checkout", "b")` stamps `owlpane.experiment.id` on spans that end afterwards (Experiments). `setFeatureFlag("new-nav", "on")` stamps `feature_flag.key` (Feature flags). `track("signup", { plan: "team" })` records a business event on the session (name: a letter then letters, digits and `_ . : -`, 64 at most; up to ten properties with lower-case keys and string, number or boolean values, strings cut at 100 characters; a property that does not fit is dropped, an unusable name ignores the event). Owlpane counts events, breaks them down by property, and accepts `event:signup` as a funnel or journey step. Record only what you are happy to store: nothing is read from the page for you. A browser page is not a mobile app: this SDK does not set `os.name` to iOS or Android.
|
|
26
28
|
|
|
27
29
|
## What it captures
|
|
28
30
|
|
|
@@ -64,6 +66,18 @@ Query strings, hashes and URL credentials are stripped from recorded URLs. `keep
|
|
|
64
66
|
- XHR instrumentation patches `XMLHttpRequest.prototype`; it does not capture `sendBeacon`, WebSocket or resource-loading errors.
|
|
65
67
|
- SPA route changes are not tracked as separate page views; `browser.page.path` reflects the path at span end.
|
|
66
68
|
|
|
69
|
+
## DOM replay (optional)
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
init({ /* … */ recordDomReplay: true });
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Requires server-side DOM replay enabled. Replay appears under session tooling in the console when retention allows.
|
|
76
|
+
|
|
77
|
+
## Console
|
|
78
|
+
|
|
79
|
+
After ingest, open **Observability → Frontend** for vitals and errors, **Traces** for span detail. Use a dedicated browser ingest key (visible in page source).
|
|
80
|
+
|
|
67
81
|
## Tests
|
|
68
82
|
|
|
69
83
|
`npm test -w @owlpane/browser` (node:test + tsx, no DOM library; browser globals are injected fakes).
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Attrs } from "./otlp.js";
|
|
2
|
+
/** Business events (checkout, signup) recorded on the session, so they can be counted and used as funnel steps. */
|
|
3
|
+
export declare const EVENT_SPAN = "owlpane.event";
|
|
4
|
+
export declare const MAX_EVENT_PROPERTIES = 10;
|
|
5
|
+
export declare const MAX_PROPERTY_VALUE = 100;
|
|
6
|
+
export type EventProperties = Record<string, string | number | boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* The attributes for one event, or null when the name is not usable. The name is `owlpane.event.name`; each property becomes
|
|
9
|
+
* `owlpane.event.prop.<key>`. A property with a bad key, or a value that is not a string, finite number or boolean, is dropped
|
|
10
|
+
* rather than the event: a typo in one property must not lose the signup. At most ten are kept, in the order given, and a string
|
|
11
|
+
* is cut at 100 characters. Nothing is read from the page: what is recorded is exactly what the caller passed.
|
|
12
|
+
*/
|
|
13
|
+
export declare function eventAttributes(name: unknown, properties?: unknown): Attrs | null;
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Business events (checkout, signup) recorded on the session, so they can be counted and used as funnel steps. */
|
|
2
|
+
export const EVENT_SPAN = "owlpane.event";
|
|
3
|
+
const NAME = /^[A-Za-z][A-Za-z0-9_.:-]{0,63}$/;
|
|
4
|
+
const KEY = /^[a-z][a-z0-9_]{0,31}$/;
|
|
5
|
+
export const MAX_EVENT_PROPERTIES = 10;
|
|
6
|
+
export const MAX_PROPERTY_VALUE = 100;
|
|
7
|
+
/**
|
|
8
|
+
* The attributes for one event, or null when the name is not usable. The name is `owlpane.event.name`; each property becomes
|
|
9
|
+
* `owlpane.event.prop.<key>`. A property with a bad key, or a value that is not a string, finite number or boolean, is dropped
|
|
10
|
+
* rather than the event: a typo in one property must not lose the signup. At most ten are kept, in the order given, and a string
|
|
11
|
+
* is cut at 100 characters. Nothing is read from the page: what is recorded is exactly what the caller passed.
|
|
12
|
+
*/
|
|
13
|
+
export function eventAttributes(name, properties) {
|
|
14
|
+
if (typeof name !== "string" || !NAME.test(name))
|
|
15
|
+
return null;
|
|
16
|
+
const out = { "owlpane.event.name": name };
|
|
17
|
+
if (properties && typeof properties === "object" && !Array.isArray(properties)) {
|
|
18
|
+
let kept = 0;
|
|
19
|
+
for (const [k, v] of Object.entries(properties)) {
|
|
20
|
+
if (kept >= MAX_EVENT_PROPERTIES)
|
|
21
|
+
break;
|
|
22
|
+
if (!KEY.test(k))
|
|
23
|
+
continue;
|
|
24
|
+
if (typeof v === "string")
|
|
25
|
+
out[`owlpane.event.prop.${k}`] = v.slice(0, MAX_PROPERTY_VALUE);
|
|
26
|
+
else if (typeof v === "number" && Number.isFinite(v))
|
|
27
|
+
out[`owlpane.event.prop.${k}`] = v;
|
|
28
|
+
else if (typeof v === "boolean")
|
|
29
|
+
out[`owlpane.event.prop.${k}`] = v;
|
|
30
|
+
else
|
|
31
|
+
continue;
|
|
32
|
+
kept++;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAEA,mHAAmH;AAEnH,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;AAC1C,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,GAAG,GAAG,wBAAwB,CAAC;AACrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAItC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa,EAAE,UAAoB;IACjE,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9D,MAAM,GAAG,GAAU,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IAClD,IAAI,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/E,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAqC,CAAC,EAAE,CAAC;YAC3E,IAAI,IAAI,IAAI,oBAAoB;gBAAE,MAAM;YACxC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;gBAAE,SAAS;YAC3B,IAAI,OAAO,CAAC,KAAK,QAAQ;gBAAE,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;iBACtF,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAAE,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;iBACpF,IAAI,OAAO,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;;gBAC/D,SAAS;YACd,IAAI,EAAE,CAAC;QACT,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Env } from "./env.js";
|
|
2
2
|
import { newSpanId, newTraceId } from "./ids.js";
|
|
3
|
+
import { type EventProperties } from "./events.js";
|
|
3
4
|
export type OwlpaneBrowserOptions = {
|
|
4
5
|
/** Ingest base URL, e.g. 'https://ingest.example.com'. `/v1/traces` is appended. */
|
|
5
6
|
endpoint?: string;
|
|
@@ -30,6 +31,12 @@ export type OwlpaneBrowser = {
|
|
|
30
31
|
setExperiment(id: string, variant?: string): void;
|
|
31
32
|
/** Stamps `feature_flag.key` on spans that end after this call. */
|
|
32
33
|
setFeatureFlag(key: string, variant?: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Records a business event on this session, for example `track("signup", { plan: "team" })`. The name starts with a letter and
|
|
36
|
+
* uses letters, digits and `_ . : -` (64 at most); up to ten properties with lower-case keys and string, number or boolean
|
|
37
|
+
* values are kept. An event with an unusable name is ignored.
|
|
38
|
+
*/
|
|
39
|
+
track(name: string, properties?: EventProperties): void;
|
|
33
40
|
};
|
|
34
41
|
export declare const DEFAULT_ENDPOINT = "https://ingest.owlpane.com";
|
|
35
42
|
/** Starts RUM collection. Safe to call once per page; never throws. */
|
|
@@ -38,3 +45,4 @@ export { newSpanId, newTraceId };
|
|
|
38
45
|
export { formatTraceparent, parseTraceparent } from "./ids.js";
|
|
39
46
|
export { sanitizeUrl, shouldPropagate } from "./url.js";
|
|
40
47
|
export { startDomReplay } from "./dom-replay.js";
|
|
48
|
+
export type { EventProperties } from "./events.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { browserEnv } from "./env.js";
|
|
2
2
|
import { createExporter } from "./exporter.js";
|
|
3
3
|
import { defaultRandomBytes, newSpanId, newTraceId } from "./ids.js";
|
|
4
|
+
import { EVENT_SPAN, eventAttributes } from "./events.js";
|
|
4
5
|
import { instrumentFetch, instrumentXhr } from "./instrument-http.js";
|
|
5
6
|
import { captureDocumentLoad, captureErrors, captureVitals, createErrorReporter } from "./observers.js";
|
|
6
7
|
import { startDomReplay } from "./dom-replay.js";
|
|
@@ -15,6 +16,7 @@ const NOOP = {
|
|
|
15
16
|
captureException: () => undefined,
|
|
16
17
|
setExperiment: () => undefined,
|
|
17
18
|
setFeatureFlag: () => undefined,
|
|
19
|
+
track: () => undefined,
|
|
18
20
|
};
|
|
19
21
|
function sessionIdFor(env, rand) {
|
|
20
22
|
const K = "owlpane.sid";
|
|
@@ -134,6 +136,18 @@ export function init(options) {
|
|
|
134
136
|
if (variant?.trim())
|
|
135
137
|
pageAttrs["feature_flag.result.variant"] = variant.trim();
|
|
136
138
|
},
|
|
139
|
+
track(name, properties) {
|
|
140
|
+
try {
|
|
141
|
+
const attributes = eventAttributes(name, properties);
|
|
142
|
+
if (!attributes)
|
|
143
|
+
return;
|
|
144
|
+
const now = env.now();
|
|
145
|
+
tracer.start(EVENT_SPAN, 1, { traceId: page.traceId, parentSpanId: page.spanId, sampled: page.sampled, startMs: now, attributes }).end({ endMs: now });
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
/* never throws into the page */
|
|
149
|
+
}
|
|
150
|
+
},
|
|
137
151
|
async shutdown() {
|
|
138
152
|
stopDomReplay?.();
|
|
139
153
|
undo.forEach((u) => u());
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAmB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAwB,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gB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AC;YACH,CAAC;YACD,KAAK,CAAC,QAAQ;gBACZ,aAAa,EAAE,EAAE,CAAC;gBAClB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;gBACzB,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAChB,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACvB,MAAM,GAAG,SAAS,CAAC;YACrB,CAAC;SACF,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/log-otlp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeAttrs, unixNano } from "./otlp.js";
|
|
2
|
-
const REPLAY_SCOPE = { name: "@owlpane/browser-replay", version: "0.1.
|
|
2
|
+
const REPLAY_SCOPE = { name: "@owlpane/browser-replay", version: "0.1.8" };
|
|
3
3
|
export function buildLogsRequestBody(resourceAttrs, records) {
|
|
4
4
|
const resource = JSON.stringify({ attributes: encodeAttrs(resourceAttrs) });
|
|
5
5
|
const logs = records.map((r) => JSON.stringify({
|
package/dist/tracer.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Env } from "./env.js";
|
|
2
2
|
import { RandomBytes } from "./ids.js";
|
|
3
3
|
import type { Attrs, SpanData, SpanEvent } from "./otlp.js";
|
|
4
|
-
export declare const VERSION = "0.1.
|
|
4
|
+
export declare const VERSION = "0.1.8";
|
|
5
5
|
export type ResolvedOptions = {
|
|
6
6
|
endpoint: string;
|
|
7
7
|
projectKey: string;
|
package/dist/tracer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultRandomBytes, newSpanId, newTraceId } from "./ids.js";
|
|
2
|
-
export const VERSION = "0.1.
|
|
2
|
+
export const VERSION = "0.1.8";
|
|
3
3
|
export function createTracer(env, opts, emit, sessionId, pageUrl, pageAttrs = {}) {
|
|
4
4
|
const rand = env.randomBytes ?? defaultRandomBytes();
|
|
5
5
|
const nav = env.navigator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlpane/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
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
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|