wardx 0.2.2 → 0.4.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 CHANGED
@@ -83,6 +83,7 @@ wardx.event('match.started', { mode: 'ranked', country: 'AR' });
83
83
  wardx.counter('match.completed', { mode: 'ranked' }).inc();
84
84
  wardx.gauge('players.online').set(12);
85
85
  wardx.histogram('request.duration', { buckets: [10, 25, 50, 100, 250] }).observe(42);
86
+ wardx.distinct('shot.traffic.hids', { result: 'violating' }).add(hid);
86
87
 
87
88
  const end = wardx.timer('matchmaking.duration');
88
89
  end({ result: 'success' });
@@ -277,7 +278,7 @@ If the event buffer is full, the SDK discards the new event and increments `ward
277
278
 
278
279
  **Objective:** Emit one named event and one counter per step. Compare those counts. Do not reconstruct a per-user path.
279
280
 
280
- 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.
281
+ 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. `distinct` can estimate unique identifiers per named aggregate, but it does not provide ordered sequences or time between steps.
281
282
 
282
283
  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.
283
284
 
@@ -309,7 +310,10 @@ function onOnboardingDone(wardx, userId) {
309
310
 
310
311
  On a backend that serves many users, increment the counters in process. Do not `event()` once per user action.
311
312
 
312
- Do not put `userId` on a counter dimension. Do not expect Mixpanel-style unique-user funnels from Wardx.
313
+ Do not put `userId` on a counter dimension. For an approximate unique count at
314
+ one step, use `distinct(stepName, dims).add(userId)`. It hashes with the required
315
+ local `privacySalt` and sends only a 512-register HLL sketch (`p=9`, about 4.6%
316
+ standard error). This still does not create a Mixpanel-style per-user funnel.
313
317
 
314
318
  ## Use case 8: Detect abnormal point accumulation
315
319
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wardx",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "Node.js SDK for Wardx telemetry, Remote Config, and experiments.",
5
5
  "keywords": [
6
6
  "wardx",
@@ -37,6 +37,6 @@
37
37
  "src"
38
38
  ],
39
39
  "dependencies": {
40
- "@wardx/core": "0.2.2"
40
+ "@wardx/core": "0.4.0"
41
41
  }
42
42
  }
package/src/WardxNode.js CHANGED
@@ -59,6 +59,10 @@ export class WardxNode {
59
59
  return this._core.histogram(name, a, b);
60
60
  }
61
61
 
62
+ distinct(name, dims) {
63
+ return this._core.distinct(name, dims);
64
+ }
65
+
62
66
  timer(name, dims) {
63
67
  return this._core.timer(name, dims);
64
68
  }
package/src/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import type {
7
7
  CreateWardxOptions,
8
8
  DimensionValue,
9
9
  Dimensions,
10
+ DistinctHandle,
10
11
  EventTraceRecord,
11
12
  Experiment,
12
13
  ExperimentGoalContext,
@@ -36,6 +37,7 @@ export type {
36
37
  CreateWardxOptions,
37
38
  DimensionValue,
38
39
  Dimensions,
40
+ DistinctHandle,
39
41
  EventTraceRecord,
40
42
  Experiment,
41
43
  ExperimentGoalContext,
@@ -78,6 +80,7 @@ export class WardxNode {
78
80
  counter(name: string, dims?: Dimensions | null): CounterHandle;
79
81
  gauge(name: string, dims?: Dimensions | null): GaugeHandle;
80
82
  histogram(name: string, a?: HistogramOptions | null, b?: HistogramOptions | null): HistogramHandle;
83
+ distinct(name: string, dims?: Dimensions | null): DistinctHandle;
81
84
  timer(name: string, dims?: Dimensions | null): StopTimer;
82
85
  event(name: string, attrs?: Attrs | null): void;
83
86
  flush(): Promise<void>;