@redthreadlabs/tracelog-schema 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redthreadlabs/tracelog-schema",
3
- "version": "0.1.0",
3
+ "version": "0.2.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/",