@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
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { BoundedMetadataSnapshotter, MetricExtractor, TelemetryAcknowledgementContract, TelemetryBatchContract, TelemetryBatchRouter, TelemetryStorageRouter } from './core/index.cjs';
2
2
  export { M as MetricDefinitionContract } from './metric_definition_contract-DfhhmTZ1.cjs';
3
- export { c as MetadataRedactionRule, d as MetadataSnapshot, M as MetadataSnapshotLimits, e as MetadataSnapshotStats, T as TelemetryAdmissionPolicy, f as TelemetryAdmissionPriority, b as TelemetryAdmissionResult, a as TelemetryClient, g as TelemetryClientOptions, h as TelemetryClientStatus } from './telemetry_client-CYaPYfOl.cjs';
4
- export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY, b as DEFAULT_TELEMETRY_BATCH_VALIDATION_LIMITS } from './client_defaults-C9LnSX4j.cjs';
3
+ export { c as MetadataRedactionRule, d as MetadataSnapshot, M as MetadataSnapshotLimits, e as MetadataSnapshotStats, T as TelemetryAdmissionPolicy, f as TelemetryAdmissionPriority, b as TelemetryAdmissionResult, a as TelemetryClient, g as TelemetryClientOptions, h as TelemetryClientStatus, i as TelemetryMinimumLevel } from './telemetry_client-BO5Pjp41.cjs';
4
+ export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY, b as DEFAULT_TELEMETRY_BATCH_VALIDATION_LIMITS } from './client_defaults-Dk0MMzvx.cjs';
5
5
  import { f as MetricExtraction } from './query.types-DuYWbFFe.cjs';
6
6
  export { E as ExtractedMetricSample, g as MetricAggregate, h as MetricBucket, i as MetricCardinalityRule, M as MetricDefinition, a as MetricExtractionFailure, j as MetricMeasurement, k as MetricOverflowPolicy, d as MetricQuery, l as MetricQueryGap, e as MetricQueryResponse, m as MetricQuerySegment, n as MetricRollupValues, R as ResolvedTelemetryConfiguration, o as SqliteMaintenanceConfiguration, p as SqliteRetentionConfiguration, q as SqliteSchemaConfiguration, r as SqliteTableOverrides, S as SqliteTargetConfiguration, c as TelemetryQueryError, s as TelemetryRole, t as TimelineGap, T as TimelineQuery, b as TimelineQueryResponse } from './query.types-DuYWbFFe.cjs';
7
7
  export { a as TelemetryAdmitInput, b as TelemetryEmitInput, T as TelemetryEnvelope, c as TelemetryJsonObject, d as TelemetryJsonPrimitive, e as TelemetryJsonValue, f as TelemetryLevel } from './envelope.types-rOLpWXRC.cjs';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { BoundedMetadataSnapshotter, MetricExtractor, TelemetryAcknowledgementContract, TelemetryBatchContract, TelemetryBatchRouter, TelemetryStorageRouter } from './core/index.js';
2
2
  export { M as MetricDefinitionContract } from './metric_definition_contract-BYtnODhu.js';
3
- export { c as MetadataRedactionRule, d as MetadataSnapshot, M as MetadataSnapshotLimits, e as MetadataSnapshotStats, T as TelemetryAdmissionPolicy, f as TelemetryAdmissionPriority, b as TelemetryAdmissionResult, a as TelemetryClient, g as TelemetryClientOptions, h as TelemetryClientStatus } from './telemetry_client-BXw8WH_F.js';
4
- export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY, b as DEFAULT_TELEMETRY_BATCH_VALIDATION_LIMITS } from './client_defaults-B5tC-TgG.js';
3
+ export { c as MetadataRedactionRule, d as MetadataSnapshot, M as MetadataSnapshotLimits, e as MetadataSnapshotStats, T as TelemetryAdmissionPolicy, f as TelemetryAdmissionPriority, b as TelemetryAdmissionResult, a as TelemetryClient, g as TelemetryClientOptions, h as TelemetryClientStatus, i as TelemetryMinimumLevel } from './telemetry_client-D8uZ-mTL.js';
4
+ export { D as DEFAULT_METADATA_SNAPSHOT_LIMITS, a as DEFAULT_TELEMETRY_ADMISSION_POLICY, b as DEFAULT_TELEMETRY_BATCH_VALIDATION_LIMITS } from './client_defaults-ShVYQYmn.js';
5
5
  import { f as MetricExtraction } from './query.types-DU5v7vM0.js';
6
6
  export { E as ExtractedMetricSample, g as MetricAggregate, h as MetricBucket, i as MetricCardinalityRule, M as MetricDefinition, a as MetricExtractionFailure, j as MetricMeasurement, k as MetricOverflowPolicy, d as MetricQuery, l as MetricQueryGap, e as MetricQueryResponse, m as MetricQuerySegment, n as MetricRollupValues, R as ResolvedTelemetryConfiguration, o as SqliteMaintenanceConfiguration, p as SqliteRetentionConfiguration, q as SqliteSchemaConfiguration, r as SqliteTableOverrides, S as SqliteTargetConfiguration, c as TelemetryQueryError, s as TelemetryRole, t as TimelineGap, T as TimelineQuery, b as TimelineQueryResponse } from './query.types-DU5v7vM0.js';
7
7
  export { a as TelemetryAdmitInput, b as TelemetryEmitInput, T as TelemetryEnvelope, c as TelemetryJsonObject, d as TelemetryJsonPrimitive, e as TelemetryJsonValue, f as TelemetryLevel } from './envelope.types-rOLpWXRC.js';
package/dist/index.js CHANGED
@@ -1346,6 +1346,14 @@ var TelemetryBatchRouter = class {
1346
1346
  };
1347
1347
 
1348
1348
  // src/core/telemetry_client.ts
1349
+ var TELEMETRY_LEVEL_RANKS = Object.freeze({
1350
+ trace: 0,
1351
+ debug: 1,
1352
+ info: 2,
1353
+ warn: 3,
1354
+ error: 4,
1355
+ fatal: 5
1356
+ });
1349
1357
  var TelemetryClient = class {
1350
1358
  constructor(options) {
1351
1359
  this.options = options;
@@ -1408,6 +1416,10 @@ var TelemetryClient = class {
1408
1416
  return { kind: "dropped", producerId: this.options.producerId, sequence, reason: "invalid-label" };
1409
1417
  }
1410
1418
  const priority = this.priorityFor(input.level);
1419
+ if (!this.meetsMinimumLevel(input.level)) {
1420
+ this.incrementDrop("sampled", priority);
1421
+ return { kind: "dropped", producerId: this.options.producerId, sequence, reason: "below-minimum-level" };
1422
+ }
1411
1423
  if (!this.isSampled(priority)) {
1412
1424
  this.incrementDrop("sampled", priority);
1413
1425
  return { kind: "dropped", producerId: this.options.producerId, sequence, reason: "sampled" };
@@ -1788,6 +1800,15 @@ var TelemetryClient = class {
1788
1800
  const sampleRate = this.options.admission.sampleRates[priority];
1789
1801
  return sampleRate >= 1 || this.options.random() < sampleRate;
1790
1802
  }
1803
+ meetsMinimumLevel(level) {
1804
+ const minimum = this.options.admission.minimumLevel;
1805
+ if (minimum === void 0) {
1806
+ return true;
1807
+ }
1808
+ const normalized = level.trim().toLowerCase();
1809
+ const rank = TELEMETRY_LEVEL_RANKS[normalized] ?? TELEMETRY_LEVEL_RANKS.info;
1810
+ return rank >= TELEMETRY_LEVEL_RANKS[minimum];
1811
+ }
1791
1812
  isValidLabel(label) {
1792
1813
  return /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/.test(label) && label.length <= 256;
1793
1814
  }