wardx 0.1.1 → 0.1.2
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 +47 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ function completeMatch(wardx, mode) {
|
|
|
111
111
|
}
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
To detect abnormal grants, pair this counter with a histogram and a rare anomaly event. See use case
|
|
114
|
+
To detect abnormal grants, pair this counter with a histogram and a rare anomaly event. See use case 8.
|
|
115
115
|
|
|
116
116
|
### Procedure
|
|
117
117
|
|
|
@@ -257,7 +257,47 @@ An event is one row in the frame. A counter is a window sum. Use both when you n
|
|
|
257
257
|
|
|
258
258
|
If the event buffer is full, the SDK discards the new event and increments `wardx.internal.events_dropped`.
|
|
259
259
|
|
|
260
|
-
## Use case 7:
|
|
260
|
+
## Use case 7: Measure a volume funnel
|
|
261
|
+
|
|
262
|
+
**When:** You need drop-off between screens or steps in a client, for example onboarding or checkout.
|
|
263
|
+
|
|
264
|
+
**Objective:** Emit one named event and one counter per step. Compare those counts. Do not reconstruct a per-user path.
|
|
265
|
+
|
|
266
|
+
Wardx does not store a user journey. Delivery is at-most-once. Production discards envelopes after ingest (`sink: "null"`). The aggregator counts events by name and role. Event attrs do not split that count. `sessionId` identifies the envelope. It is not a join key. There are no unique users, no ordered sequences, and no time between steps.
|
|
267
|
+
|
|
268
|
+
Give each step its own name. Do not reuse `screen.view` with a `surface` attr as the funnel. Use `surface` only as a counter dimension when you also need a breakdown of one step.
|
|
269
|
+
|
|
270
|
+
```js
|
|
271
|
+
function onOnboardingStart(wardx, channel) {
|
|
272
|
+
wardx.event('onboarding.start', { channel });
|
|
273
|
+
wardx.counter('onboarding.start', { channel }).inc();
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function onOnboardingProfile(wardx) {
|
|
277
|
+
wardx.event('onboarding.profile');
|
|
278
|
+
wardx.counter('onboarding.profile').inc();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function onOnboardingDone(wardx, userId) {
|
|
282
|
+
wardx.event('onboarding.done');
|
|
283
|
+
wardx.counter('onboarding.done').inc();
|
|
284
|
+
wardx.experiment.goal('onboarding.done', { subjectId: userId });
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Procedure
|
|
289
|
+
|
|
290
|
+
1. Pick a prefix and a name per step: `onboarding.start`, `onboarding.profile`, `onboarding.done`.
|
|
291
|
+
2. On the client path for that step, call `event` and `counter` with the same name.
|
|
292
|
+
3. Put only low-cardinality attrs on the event. Put the breakdown you need to compare (`channel`, `mode`) on the counter dimensions.
|
|
293
|
+
4. If the last step is an experiment conversion, also call `experiment.goal` with `subjectId`. That is one conversion, not an N-step funnel.
|
|
294
|
+
5. From MCP, call `get_aggregates` with those names. Compare counter totals, or `eventNames` counts, in the same window. The drop from start to done is the volume funnel.
|
|
295
|
+
|
|
296
|
+
On a backend that serves many users, increment the counters in process. Do not `event()` once per user action.
|
|
297
|
+
|
|
298
|
+
Do not put `userId` on a counter dimension. Do not expect Mixpanel-style unique-user funnels from Wardx.
|
|
299
|
+
|
|
300
|
+
## Use case 8: Detect abnormal point accumulation
|
|
261
301
|
|
|
262
302
|
**When:** A game grants points, coins, or XP. You need to see whether the economy is consistent, or whether grants jumped outside the normal range.
|
|
263
303
|
|
|
@@ -298,7 +338,7 @@ Do not put `userId` on a counter or histogram dimension. The SDK and the server
|
|
|
298
338
|
|
|
299
339
|
If histogram max stays at the legal cap and `coins.awarded` tracks completed matches times the known reward, the economy is consistent at fleet scale. A specific player still requires the database audit log.
|
|
300
340
|
|
|
301
|
-
## Use case
|
|
341
|
+
## Use case 9: Get Remote Config for a user
|
|
302
342
|
|
|
303
343
|
**When:** The server has a config snapshot. You need a value in the application.
|
|
304
344
|
|
|
@@ -318,7 +358,7 @@ const delayMs = wardx.config.get('message.delayMs', 1000, { subjectId: req.userI
|
|
|
318
358
|
|
|
319
359
|
The SDK updates the snapshot when a sync response contains a newer `configVersion`. Until that sync, `config.get` returns the fallback or the last snapshot.
|
|
320
360
|
|
|
321
|
-
## Use case
|
|
361
|
+
## Use case 10: Run an A/B experiment and record a goal
|
|
322
362
|
|
|
323
363
|
**When:** A Remote Config key is in an experiment. You need a variant for a user. You need a goal event.
|
|
324
364
|
|
|
@@ -350,7 +390,7 @@ The payload does not contain the raw `subjectId`.
|
|
|
350
390
|
|
|
351
391
|
The assignment is local and deterministic. The same subject, experiment, and salt always get the same variant.
|
|
352
392
|
|
|
353
|
-
## Use case
|
|
393
|
+
## Use case 11: Continue when the ingest server is down
|
|
354
394
|
|
|
355
395
|
**When:** The network fails, or the ingest server is not available.
|
|
356
396
|
|
|
@@ -374,7 +414,7 @@ The SDK still records in memory. A failed sync increments `wardx.internal.frames
|
|
|
374
414
|
|
|
375
415
|
Do not use this SDK if you must not lose events. This SDK is best-effort.
|
|
376
416
|
|
|
377
|
-
## Use case
|
|
417
|
+
## Use case 12: Stop the SDK in a graceful shutdown
|
|
378
418
|
|
|
379
419
|
**When:** The process receives `SIGTERM` or you stop a test.
|
|
380
420
|
|
|
@@ -403,7 +443,7 @@ process.on('SIGINT', onStop);
|
|
|
403
443
|
|
|
404
444
|
`flush` sends the current pending frames and does not stop the timers. Use `shutdown` when the process stops.
|
|
405
445
|
|
|
406
|
-
## Use case
|
|
446
|
+
## Use case 13: Trace measure calls while instrumenting
|
|
407
447
|
|
|
408
448
|
**When:** You are adding counters, events, and logs and you want to see each call and each sync on stderr.
|
|
409
449
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wardx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Node.js SDK for Wardx telemetry, Remote Config, and experiments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wardx",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@wardx/core": "0.1.
|
|
35
|
+
"@wardx/core": "0.1.2"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|