@goliapkg/sentori-react-native 1.2.0 → 2.0.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 +63 -3
- package/lib/compat/sentry.d.ts +112 -0
- package/lib/compat/sentry.d.ts.map +1 -0
- package/lib/compat/sentry.js +326 -0
- package/lib/compat/sentry.js.map +1 -0
- package/lib/config.d.ts +5 -0
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/feedback.d.ts +2 -0
- package/lib/feedback.d.ts.map +1 -0
- package/lib/feedback.js +17 -0
- package/lib/feedback.js.map +1 -0
- package/lib/init.d.ts +18 -0
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +10 -3
- package/lib/init.js.map +1 -1
- package/lib/metrics.d.ts +2 -4
- package/lib/metrics.d.ts.map +1 -1
- package/lib/metrics.js.map +1 -1
- package/lib/track.d.ts.map +1 -1
- package/lib/track.js +9 -0
- package/lib/track.js.map +1 -1
- package/package.json +19 -3
- package/src/compat/sentry.ts +482 -0
- package/src/config.ts +5 -0
- package/src/feedback.ts +21 -0
- package/src/init.ts +28 -3
- package/src/metrics.ts +3 -1
- package/src/track.ts +9 -0
package/src/init.ts
CHANGED
|
@@ -73,6 +73,14 @@ export type InitOptions = {
|
|
|
73
73
|
* the buffer is sealed and uploaded as a `sessionTrail`
|
|
74
74
|
* attachment. Defaults to false. */
|
|
75
75
|
sessionTrail?: boolean;
|
|
76
|
+
/** v2.0 W3 — when `true`, every `sentori.track(name, props)`
|
|
77
|
+
* also pushes a `{ type: 'track', data: { name, props } }`
|
|
78
|
+
* breadcrumb so a subsequent `captureException` /
|
|
79
|
+
* `captureMessage` carries the customer journey leading up to
|
|
80
|
+
* the failure. Defaults to `false` to preserve v1 customer
|
|
81
|
+
* breadcrumb shape on upgrade; recommended `true` for new
|
|
82
|
+
* integrations. See `docs/recipes/track-and-metrics.md`. */
|
|
83
|
+
trackAutoBreadcrumb?: boolean;
|
|
76
84
|
/** v0.9.1 +S4 — pre-crash sentinel. Subscribes to JS-thread
|
|
77
85
|
* frame timing; when ≥ 50% of a 60-frame window misses the
|
|
78
86
|
* budget (default 32 ms / < 30 fps), emits a `kind: nearCrash`
|
|
@@ -130,6 +138,16 @@ export type InitOptions = {
|
|
|
130
138
|
* via `sentori.captureMessage()`. `null` / absent → keep all. */
|
|
131
139
|
messages?: null | number;
|
|
132
140
|
};
|
|
141
|
+
/** v2.3 — canonical sampling field (renamed from `sampling`).
|
|
142
|
+
* Same shape; if both are passed, `sample` wins. The older
|
|
143
|
+
* `sampling` stays accepted indefinitely as a back-compat alias —
|
|
144
|
+
* this is the kind of rename that's only worth doing if it's
|
|
145
|
+
* also zero-cost for existing callers. */
|
|
146
|
+
sample?: {
|
|
147
|
+
errors?: null | number;
|
|
148
|
+
traces?: null | number;
|
|
149
|
+
messages?: null | number;
|
|
150
|
+
};
|
|
133
151
|
/** v2.3 — Sentori SDK's own console output gate. Default `'warn'`:
|
|
134
152
|
* SDK is silent unless something is genuinely broken (transport
|
|
135
153
|
* sustained failure, native module not found, internal SDK
|
|
@@ -181,10 +199,17 @@ export const init = (options: InitOptions): void => {
|
|
|
181
199
|
ingestUrl: options.ingestUrl ?? DEFAULT_INGEST_URL,
|
|
182
200
|
enabled: true,
|
|
183
201
|
screenshotsEnabled: options.capture?.screenshot === true,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
202
|
+
// v2.3 — `sample` is the canonical name; `sampling` is the
|
|
203
|
+
// back-compat alias. If both are supplied, `sample` wins.
|
|
204
|
+
errorSampleRate: options.sample?.errors ?? options.sampling?.errors ?? null,
|
|
205
|
+
traceSampleRate: options.sample?.traces ?? options.sampling?.traces ?? null,
|
|
206
|
+
messageSampleRate: options.sample?.messages ?? options.sampling?.messages ?? null,
|
|
187
207
|
sessionTrailEnabled: options.capture?.sessionTrail === true,
|
|
208
|
+
// v2.0 W3 — when true, every `track()` also pushes a
|
|
209
|
+
// `type: 'track'` breadcrumb so a subsequent captureException
|
|
210
|
+
// carries the customer journey. Defaults false to preserve v1
|
|
211
|
+
// breadcrumb shape on upgrade.
|
|
212
|
+
trackAutoBreadcrumb: options.capture?.trackAutoBreadcrumb === true,
|
|
188
213
|
});
|
|
189
214
|
|
|
190
215
|
// Tell the native crash handler about the config so the JSON it writes
|
package/src/metrics.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// outgoing connection pool. Batching makes the SDK safe to use as a
|
|
12
12
|
// cheap counter primitive.
|
|
13
13
|
|
|
14
|
+
import type { SpanContextLike } from '@goliapkg/sentori-core';
|
|
15
|
+
|
|
14
16
|
import { getConfig, isInitialized } from './config';
|
|
15
17
|
import { sendMetricsBatch } from './transport';
|
|
16
18
|
|
|
@@ -43,7 +45,7 @@ export function recordMetric(
|
|
|
43
45
|
name: string,
|
|
44
46
|
value: number,
|
|
45
47
|
tags?: Record<string, string>,
|
|
46
|
-
opts?: { parent?:
|
|
48
|
+
opts?: { parent?: SpanContextLike },
|
|
47
49
|
): void {
|
|
48
50
|
if (!isInitialized()) return;
|
|
49
51
|
if (typeof name !== 'string' || name.length === 0 || name.length > 200) return;
|
package/src/track.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// Hosts that don't use react-navigation can call
|
|
18
18
|
// `sentori.track('$pageview', { route: 'Cart' })` themselves.
|
|
19
19
|
|
|
20
|
+
import { addInternalBreadcrumb } from './breadcrumbs';
|
|
20
21
|
import { getCurrentUserId } from './capture';
|
|
21
22
|
import { getConfig, isInitialized } from './config';
|
|
22
23
|
import { sendTrackBatch } from './transport';
|
|
@@ -74,6 +75,14 @@ export function track(name: string, props?: TrackProps, route?: string): void {
|
|
|
74
75
|
userId: getCurrentUserId(),
|
|
75
76
|
};
|
|
76
77
|
_buf.push(ev);
|
|
78
|
+
// v2.0 W3 — auto-breadcrumb. When `init.capture.trackAutoBreadcrumb`
|
|
79
|
+
// is `true`, push a `{ type: 'track', data: { name, props } }`
|
|
80
|
+
// breadcrumb so the customer journey leading up to a later
|
|
81
|
+
// `captureException` / `captureMessage` is visible in the dashboard.
|
|
82
|
+
// Defaults off — see Config.trackAutoBreadcrumb docstring.
|
|
83
|
+
if (config?.trackAutoBreadcrumb === true) {
|
|
84
|
+
addInternalBreadcrumb('track', props ? { name, props } : { name });
|
|
85
|
+
}
|
|
77
86
|
if (_buf.length >= MAX_BUFFER) {
|
|
78
87
|
void flushTrack();
|
|
79
88
|
}
|