@noego/telemetry 0.0.3 → 0.0.5

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.
Files changed (48) hide show
  1. package/dist/browser/index.cjs +21 -0
  2. package/dist/browser/index.cjs.map +1 -1
  3. package/dist/browser/index.d.cts +3 -3
  4. package/dist/browser/index.d.ts +3 -3
  5. package/dist/browser/index.js +21 -0
  6. package/dist/browser/index.js.map +1 -1
  7. package/dist/{browser_telemetry_client-BzBPQm4m.d.cts → browser_telemetry_client-BSAMZ8Qb.d.cts} +1 -1
  8. package/dist/{browser_telemetry_client-Ch_VzwEa.d.ts → browser_telemetry_client-DPBU6NGw.d.ts} +1 -1
  9. package/dist/{client_defaults-C9LnSX4j.d.cts → client_defaults-Dk0MMzvx.d.cts} +1 -1
  10. package/dist/{client_defaults-B5tC-TgG.d.ts → client_defaults-ShVYQYmn.d.ts} +1 -1
  11. package/dist/core/index.cjs +21 -0
  12. package/dist/core/index.cjs.map +1 -1
  13. package/dist/core/index.d.cts +3 -3
  14. package/dist/core/index.d.ts +3 -3
  15. package/dist/core/index.js +21 -0
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/electron/index.cjs +21 -0
  18. package/dist/electron/index.cjs.map +1 -1
  19. package/dist/electron/index.d.cts +2 -2
  20. package/dist/electron/index.d.ts +2 -2
  21. package/dist/electron/index.js +21 -0
  22. package/dist/electron/index.js.map +1 -1
  23. package/dist/index.cjs +21 -0
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +21 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/node/index.cjs +33 -1
  30. package/dist/node/index.cjs.map +1 -1
  31. package/dist/node/index.d.cts +53 -3
  32. package/dist/node/index.d.ts +53 -3
  33. package/dist/node/index.js +32 -1
  34. package/dist/node/index.js.map +1 -1
  35. package/dist/node/producer/index.cjs +21 -0
  36. package/dist/node/producer/index.cjs.map +1 -1
  37. package/dist/node/producer/index.d.cts +2 -2
  38. package/dist/node/producer/index.d.ts +2 -2
  39. package/dist/node/producer/index.js +21 -0
  40. package/dist/node/producer/index.js.map +1 -1
  41. package/dist/{telemetry_client-CYaPYfOl.d.cts → telemetry_client-BO5Pjp41.d.cts} +9 -1
  42. package/dist/{telemetry_client-BXw8WH_F.d.ts → telemetry_client-D8uZ-mTL.d.ts} +9 -1
  43. package/dist/trace-adapter/index.d.cts +1 -1
  44. package/dist/trace-adapter/index.d.ts +1 -1
  45. package/migrations/1786100000000_animation_artifacts.down.sql +5 -0
  46. package/migrations/1786100000000_animation_artifacts.up.sql +41 -0
  47. package/native/noego_telemetry_native.node +0 -0
  48. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { T as TelemetryAdmissionPolicy, M as MetadataSnapshotLimits, a as TelemetryClient } from '../telemetry_client-CYaPYfOl.cjs';
1
+ import { T as TelemetryAdmissionPolicy, M as MetadataSnapshotLimits, a as TelemetryClient } from '../telemetry_client-BO5Pjp41.cjs';
2
2
  import { T as TelemetrySinkPlugin, c as MaintenanceLifecycleEvent, e as TelemetryCollectorRuntime, f as TelemetryCollectorStatus } from '../maintenance_coordinator.types-C4ULi4A4.cjs';
3
3
  import { S as SqliteTargetConfiguration, M as MetricDefinition } from '../query.types-DuYWbFFe.cjs';
4
4
  import { T as TelemetryStorageTransport, e as TelemetryStorageTarget, a as TelemetryStorageCapabilities } from '../storage.types-Bji_pWqr.cjs';
@@ -7,7 +7,7 @@ import { NodeTelemetryProducerOptions } from './producer/index.cjs';
7
7
  export { NodeTelemetryProducerHost } from './producer/index.cjs';
8
8
  export { SQLiteTelemetryTransport } from '../sqlite/index.cjs';
9
9
  export { a as NodeTelemetryConfigurationParseOptions, N as NodeTelemetryConfigurationParser, T as TelemetryConfigurationError, b as TelemetryDurationParser } from '../telemetry_configuration_parser-CgSN7R6A.cjs';
10
- export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY } from '../client_defaults-C9LnSX4j.cjs';
10
+ export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY } from '../client_defaults-Dk0MMzvx.cjs';
11
11
  import '../envelope.types-rOLpWXRC.cjs';
12
12
  import '../result.types-171Huujb.cjs';
13
13
  import '../metric_definition_contract-DfhhmTZ1.cjs';
@@ -36,6 +36,47 @@ type NodeCombinedTelemetryOptions = Readonly<{
36
36
  batchValidation?: Partial<TelemetryBatchValidationLimits>;
37
37
  observeMaintenance?: (event: MaintenanceLifecycleEvent) => void;
38
38
  }>;
39
+ type AnimationRun = Readonly<{
40
+ runUuid: string;
41
+ runCode: number;
42
+ elementCode: number;
43
+ animationCode: number;
44
+ startedUs: number;
45
+ endedUs: number;
46
+ frameCount: number;
47
+ outcome: string;
48
+ maxDrift: number;
49
+ maxResidual: number;
50
+ }>;
51
+ type AnimationDictionaryEntry = Readonly<{
52
+ kind: string;
53
+ code: number;
54
+ identity: string;
55
+ digest: string | null;
56
+ }>;
57
+ type AnimationArtifactManifest = Readonly<{
58
+ artifactId: string;
59
+ records: number;
60
+ startedUs: number;
61
+ endedUs: number;
62
+ reason: string;
63
+ sha256: string;
64
+ sequence: number;
65
+ drops: number;
66
+ overruns: number;
67
+ byteCount: number;
68
+ persistedAt: number;
69
+ conversationId: string | null;
70
+ runs: readonly AnimationRun[];
71
+ dictionary: readonly AnimationDictionaryEntry[];
72
+ }>;
73
+ type AnimationArtifactMetadata = Omit<AnimationArtifactManifest, 'runs' | 'dictionary'>;
74
+ type AnimationArtifactError = Readonly<{
75
+ ok: false;
76
+ error: Readonly<{
77
+ code: string;
78
+ }>;
79
+ }>;
39
80
 
40
81
  declare class NodeTelemetryHost {
41
82
  readonly client: TelemetryClient | null;
@@ -68,7 +109,16 @@ declare class NativeTelemetryHost {
68
109
  stop(deadlineMs: number): Promise<void>;
69
110
  status(): Promise<unknown>;
70
111
  collectorStatus(): TelemetryCollectorStatus;
112
+ storeAnimationArtifact(manifest: AnimationArtifactManifest, payload: Buffer): Promise<{
113
+ ok: true;
114
+ artifactId: string;
115
+ } | AnimationArtifactError>;
116
+ getAnimationArtifact(artifactId: string): Promise<Buffer | AnimationArtifactError>;
117
+ listAnimationArtifacts(): Promise<{
118
+ ok: true;
119
+ artifacts: readonly AnimationArtifactMetadata[];
120
+ } | AnimationArtifactError>;
71
121
  maintenance(): Promise<unknown>;
72
122
  }
73
123
 
74
- export { NativeTelemetryHost, type NodeCombinedTelemetryOptions, type NodeLocalTelemetryProducerOptions, type NodeTelemetryCollectorOptions, NodeTelemetryHost, NodeTelemetryProducerOptions };
124
+ export { type AnimationArtifactError, type AnimationArtifactManifest, type AnimationArtifactMetadata, type AnimationDictionaryEntry, type AnimationRun, NativeTelemetryHost, type NodeCombinedTelemetryOptions, type NodeLocalTelemetryProducerOptions, type NodeTelemetryCollectorOptions, NodeTelemetryHost, NodeTelemetryProducerOptions };
@@ -1,4 +1,4 @@
1
- import { T as TelemetryAdmissionPolicy, M as MetadataSnapshotLimits, a as TelemetryClient } from '../telemetry_client-BXw8WH_F.js';
1
+ import { T as TelemetryAdmissionPolicy, M as MetadataSnapshotLimits, a as TelemetryClient } from '../telemetry_client-D8uZ-mTL.js';
2
2
  import { T as TelemetrySinkPlugin, c as MaintenanceLifecycleEvent, e as TelemetryCollectorRuntime, f as TelemetryCollectorStatus } from '../maintenance_coordinator.types-ikUrRXmO.js';
3
3
  import { S as SqliteTargetConfiguration, M as MetricDefinition } from '../query.types-DU5v7vM0.js';
4
4
  import { T as TelemetryStorageTransport, e as TelemetryStorageTarget, a as TelemetryStorageCapabilities } from '../storage.types-k7oElEB3.js';
@@ -7,7 +7,7 @@ import { NodeTelemetryProducerOptions } from './producer/index.js';
7
7
  export { NodeTelemetryProducerHost } from './producer/index.js';
8
8
  export { SQLiteTelemetryTransport } from '../sqlite/index.js';
9
9
  export { a as NodeTelemetryConfigurationParseOptions, N as NodeTelemetryConfigurationParser, T as TelemetryConfigurationError, b as TelemetryDurationParser } from '../telemetry_configuration_parser-BZ8Nvnle.js';
10
- export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY } from '../client_defaults-B5tC-TgG.js';
10
+ export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY } from '../client_defaults-ShVYQYmn.js';
11
11
  import '../envelope.types-rOLpWXRC.js';
12
12
  import '../result.types-171Huujb.js';
13
13
  import '../metric_definition_contract-BYtnODhu.js';
@@ -36,6 +36,47 @@ type NodeCombinedTelemetryOptions = Readonly<{
36
36
  batchValidation?: Partial<TelemetryBatchValidationLimits>;
37
37
  observeMaintenance?: (event: MaintenanceLifecycleEvent) => void;
38
38
  }>;
39
+ type AnimationRun = Readonly<{
40
+ runUuid: string;
41
+ runCode: number;
42
+ elementCode: number;
43
+ animationCode: number;
44
+ startedUs: number;
45
+ endedUs: number;
46
+ frameCount: number;
47
+ outcome: string;
48
+ maxDrift: number;
49
+ maxResidual: number;
50
+ }>;
51
+ type AnimationDictionaryEntry = Readonly<{
52
+ kind: string;
53
+ code: number;
54
+ identity: string;
55
+ digest: string | null;
56
+ }>;
57
+ type AnimationArtifactManifest = Readonly<{
58
+ artifactId: string;
59
+ records: number;
60
+ startedUs: number;
61
+ endedUs: number;
62
+ reason: string;
63
+ sha256: string;
64
+ sequence: number;
65
+ drops: number;
66
+ overruns: number;
67
+ byteCount: number;
68
+ persistedAt: number;
69
+ conversationId: string | null;
70
+ runs: readonly AnimationRun[];
71
+ dictionary: readonly AnimationDictionaryEntry[];
72
+ }>;
73
+ type AnimationArtifactMetadata = Omit<AnimationArtifactManifest, 'runs' | 'dictionary'>;
74
+ type AnimationArtifactError = Readonly<{
75
+ ok: false;
76
+ error: Readonly<{
77
+ code: string;
78
+ }>;
79
+ }>;
39
80
 
40
81
  declare class NodeTelemetryHost {
41
82
  readonly client: TelemetryClient | null;
@@ -68,7 +109,16 @@ declare class NativeTelemetryHost {
68
109
  stop(deadlineMs: number): Promise<void>;
69
110
  status(): Promise<unknown>;
70
111
  collectorStatus(): TelemetryCollectorStatus;
112
+ storeAnimationArtifact(manifest: AnimationArtifactManifest, payload: Buffer): Promise<{
113
+ ok: true;
114
+ artifactId: string;
115
+ } | AnimationArtifactError>;
116
+ getAnimationArtifact(artifactId: string): Promise<Buffer | AnimationArtifactError>;
117
+ listAnimationArtifacts(): Promise<{
118
+ ok: true;
119
+ artifacts: readonly AnimationArtifactMetadata[];
120
+ } | AnimationArtifactError>;
71
121
  maintenance(): Promise<unknown>;
72
122
  }
73
123
 
74
- export { NativeTelemetryHost, type NodeCombinedTelemetryOptions, type NodeLocalTelemetryProducerOptions, type NodeTelemetryCollectorOptions, NodeTelemetryHost, NodeTelemetryProducerOptions };
124
+ export { type AnimationArtifactError, type AnimationArtifactManifest, type AnimationArtifactMetadata, type AnimationDictionaryEntry, type AnimationRun, NativeTelemetryHost, type NodeCombinedTelemetryOptions, type NodeLocalTelemetryProducerOptions, type NodeTelemetryCollectorOptions, NodeTelemetryHost, NodeTelemetryProducerOptions };
@@ -5692,6 +5692,14 @@ var BoundedMetadataSnapshotter = class {
5692
5692
  };
5693
5693
 
5694
5694
  // src/core/telemetry_client.ts
5695
+ var TELEMETRY_LEVEL_RANKS = Object.freeze({
5696
+ trace: 0,
5697
+ debug: 1,
5698
+ info: 2,
5699
+ warn: 3,
5700
+ error: 4,
5701
+ fatal: 5
5702
+ });
5695
5703
  var TelemetryClient = class {
5696
5704
  constructor(options) {
5697
5705
  this.options = options;
@@ -5754,6 +5762,10 @@ var TelemetryClient = class {
5754
5762
  return { kind: "dropped", producerId: this.options.producerId, sequence, reason: "invalid-label" };
5755
5763
  }
5756
5764
  const priority = this.priorityFor(input.level);
5765
+ if (!this.meetsMinimumLevel(input.level)) {
5766
+ this.incrementDrop("sampled", priority);
5767
+ return { kind: "dropped", producerId: this.options.producerId, sequence, reason: "below-minimum-level" };
5768
+ }
5757
5769
  if (!this.isSampled(priority)) {
5758
5770
  this.incrementDrop("sampled", priority);
5759
5771
  return { kind: "dropped", producerId: this.options.producerId, sequence, reason: "sampled" };
@@ -6134,6 +6146,15 @@ var TelemetryClient = class {
6134
6146
  const sampleRate = this.options.admission.sampleRates[priority];
6135
6147
  return sampleRate >= 1 || this.options.random() < sampleRate;
6136
6148
  }
6149
+ meetsMinimumLevel(level) {
6150
+ const minimum = this.options.admission.minimumLevel;
6151
+ if (minimum === void 0) {
6152
+ return true;
6153
+ }
6154
+ const normalized = level.trim().toLowerCase();
6155
+ const rank = TELEMETRY_LEVEL_RANKS[normalized] ?? TELEMETRY_LEVEL_RANKS.info;
6156
+ return rank >= TELEMETRY_LEVEL_RANKS[minimum];
6157
+ }
6137
6158
  isValidLabel(label) {
6138
6159
  return /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/.test(label) && label.length <= 256;
6139
6160
  }
@@ -6446,6 +6467,16 @@ var NativeTelemetryHost = class _NativeTelemetryHost {
6446
6467
  collectorStatus() {
6447
6468
  return this.transport.status();
6448
6469
  }
6470
+ async storeAnimationArtifact(manifest, payload) {
6471
+ return JSON.parse(await this.native.storeAnimationArtifact(JSON.stringify(manifest), payload));
6472
+ }
6473
+ async getAnimationArtifact(artifactId) {
6474
+ const result = await this.native.getAnimationArtifact(artifactId);
6475
+ return Buffer.isBuffer(result) ? result : JSON.parse(result);
6476
+ }
6477
+ async listAnimationArtifacts() {
6478
+ return JSON.parse(await this.native.listAnimationArtifacts());
6479
+ }
6449
6480
  async maintenance() {
6450
6481
  return JSON.parse(await this.native.maintenance());
6451
6482
  }
@@ -6550,7 +6581,7 @@ var NativeTelemetryTransport = class {
6550
6581
  }
6551
6582
  };
6552
6583
  function loadNativeModule() {
6553
- const require2 = createRequire(resolve3(process.cwd(), "package.json"));
6584
+ const require2 = createRequire(typeof __filename === "string" ? __filename : import.meta.url);
6554
6585
  const packageRoot = dirname2(require2.resolve("@noego/telemetry/package.json"));
6555
6586
  const modulePath = resolve3(packageRoot, "native", "noego_telemetry_native.node");
6556
6587
  const loaded = require2(modulePath);