@redthreadlabs/tracelog-schema 0.1.0 → 0.3.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/dist/sidecar.d.ts CHANGED
@@ -28,8 +28,8 @@ export interface SidecarMeta {
28
28
  }
29
29
  /** The sidecar key for a log object key. */
30
30
  export declare function sidecarKey(logKey: string): string;
31
- /** epoch-ms → UTC hour-bucket label 'YYYY-MM-DDTHH'. */
32
- export declare function hourBucket(ms: number): string;
31
+ /** epoch-ms → UTC hour-interval label 'YYYY-MM-DDTHH'. */
32
+ export declare function hourInterval(ms: number): string;
33
33
  /**
34
34
  * Derives a log file's sidecar histogram by parsing its NDJSON lines. The file
35
35
  * on disk is the source of truth: counts come from the exact bytes uploaded,
package/dist/sidecar.js CHANGED
@@ -6,7 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.MetaAccumulator = exports.SIDECAR_SUFFIX = exports.SIDECAR_VERSION = void 0;
8
8
  exports.sidecarKey = sidecarKey;
9
- exports.hourBucket = hourBucket;
9
+ exports.hourInterval = hourInterval;
10
10
  const kinds_1 = require("./kinds");
11
11
  /**
12
12
  * The metadata sidecar: a tiny JSON object written alongside each log object
@@ -28,8 +28,8 @@ function sidecarKey(logKey) {
28
28
  function pad2(n) {
29
29
  return String(n).padStart(2, '0');
30
30
  }
31
- /** epoch-ms → UTC hour-bucket label 'YYYY-MM-DDTHH'. */
32
- function hourBucket(ms) {
31
+ /** epoch-ms → UTC hour-interval label 'YYYY-MM-DDTHH'. */
32
+ function hourInterval(ms) {
33
33
  const d = new Date(ms);
34
34
  return (`${d.getUTCFullYear()}-${pad2(d.getUTCMonth() + 1)}-${pad2(d.getUTCDate())}` +
35
35
  `T${pad2(d.getUTCHours())}`);
@@ -101,8 +101,8 @@ class MetaAccumulator {
101
101
  this.malformed++;
102
102
  return;
103
103
  }
104
- const bucket = hourBucket(tsUs / 1000); // serialized timestamps are epoch-µs
105
- const byKind = this.intervals[bucket] || (this.intervals[bucket] = Object.create(null));
104
+ const interval = hourInterval(tsUs / 1000); // serialized timestamps are epoch-µs
105
+ const byKind = this.intervals[interval] || (this.intervals[interval] = Object.create(null));
106
106
  byKind[kind] = (byKind[kind] || 0) + 1;
107
107
  }
108
108
  /**
package/dist/wire.d.ts CHANGED
@@ -14,7 +14,7 @@ export interface LogBatch {
14
14
  session_ref?: string;
15
15
  device_id?: string;
16
16
  events: LogEventItem[];
17
- timers: TimerItem[];
17
+ perfs: LogPerfItem[];
18
18
  }
19
19
  export interface LogEventItem {
20
20
  /** Event category, e.g. 'auth', 'billing', 'startup'. Default: 'client-log' */
@@ -42,18 +42,18 @@ export interface LogEventItem {
42
42
  */
43
43
  tz_offset?: number;
44
44
  }
45
- export interface TimerItem {
45
+ export interface LogPerfItem {
46
46
  /** 16-char hex ID, generated client-side */
47
47
  id: string;
48
48
  /** 32-char hex trace ID, shared by parent + children */
49
49
  trace_id: string;
50
- /** ID of the root timer in this trace */
50
+ /** ID of the root perf in this trace */
51
51
  root_id: string;
52
- /** 16-char hex ID of parent timer (absent for root timers) */
52
+ /** 16-char hex ID of parent perf (absent for root perfs) */
53
53
  parent_id?: string;
54
54
  /** Operation name, e.g. 'content-store-startup' */
55
55
  name: string;
56
- /** Timer category. Default: 'client-perf' */
56
+ /** Perf category. Default: 'client-perf' */
57
57
  type: string;
58
58
  /** Start time, epoch milliseconds */
59
59
  timestamp: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redthreadlabs/tracelog-schema",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Shared contract for the tracelog suite: record kinds, S3 key layout, metadata sidecar, and the /logs wire format",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",