@noego/telemetry 0.0.1 → 0.0.2
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/cli/telemetry_bin.cjs +57 -57
- package/dist/cli/telemetry_bin.cjs.map +1 -1
- package/dist/cli/telemetry_bin.js +57 -57
- package/dist/cli/telemetry_bin.js.map +1 -1
- package/dist/cli/telemetry_cli.cjs +57 -57
- package/dist/cli/telemetry_cli.cjs.map +1 -1
- package/dist/cli/telemetry_cli.d.cts +3 -3
- package/dist/cli/telemetry_cli.d.ts +3 -3
- package/dist/cli/telemetry_cli.js +57 -57
- package/dist/cli/telemetry_cli.js.map +1 -1
- package/dist/core/index.d.cts +5 -5
- package/dist/core/index.d.ts +5 -5
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/{maintenance_coordinator.types-B-bZUNvw.d.cts → maintenance_coordinator.types-C4ULi4A4.d.cts} +2 -2
- package/dist/{maintenance_coordinator.types-CBA5y74b.d.ts → maintenance_coordinator.types-ikUrRXmO.d.ts} +2 -2
- package/dist/{metric_definition_contract-l4i4SaAp.d.ts → metric_definition_contract-BYtnODhu.d.ts} +1 -1
- package/dist/{metric_definition_contract-BR6a_GzF.d.cts → metric_definition_contract-DfhhmTZ1.d.cts} +1 -1
- package/dist/node/index.cjs +57 -57
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +5 -5
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.js +57 -57
- package/dist/node/index.js.map +1 -1
- package/dist/{query.types-DySoqYop.d.ts → query.types-DU5v7vM0.d.ts} +7 -0
- package/dist/{query.types-Bntwh6KF.d.cts → query.types-DuYWbFFe.d.cts} +7 -0
- package/dist/sqlite/index.cjs +34 -57
- package/dist/sqlite/index.cjs.map +1 -1
- package/dist/sqlite/index.d.cts +3 -3
- package/dist/sqlite/index.d.ts +3 -3
- package/dist/sqlite/index.js +34 -57
- package/dist/sqlite/index.js.map +1 -1
- package/dist/{storage.types-DjuUMinz.d.cts → storage.types-Bji_pWqr.d.cts} +1 -1
- package/dist/{storage.types-BTCGVxOM.d.ts → storage.types-k7oElEB3.d.ts} +1 -1
- package/dist/{telemetry_configuration_parser-C7Et_gwG.d.ts → telemetry_configuration_parser-BZ8Nvnle.d.ts} +3 -2
- package/dist/{telemetry_configuration_parser-R-niZQRZ.d.cts → telemetry_configuration_parser-CgSN7R6A.d.cts} +3 -2
- package/dist/testing/index.d.cts +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/migrations/1785073006031_raw_events_level_index.down.sql +1 -0
- package/migrations/1785073006031_raw_events_level_index.up.sql +5 -0
- package/native/noego_telemetry_native.node +0 -0
- package/package.json +1 -1
package/dist/sqlite/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as SqliteTargetConfiguration, M as MetricDefinition, T as TimelineQuery, b as TimelineQueryResponse, c as TelemetryQueryError, d as MetricQuery, e as MetricQueryResponse } from '../query.types-
|
|
2
|
-
export { o as SqliteMaintenanceConfiguration, p as SqliteRetentionConfiguration, q as SqliteSchemaConfiguration, r as SqliteTableOverrides } from '../query.types-
|
|
1
|
+
import { S as SqliteTargetConfiguration, M as MetricDefinition, T as TimelineQuery, b as TimelineQueryResponse, c as TelemetryQueryError, d as MetricQuery, e as MetricQueryResponse } from '../query.types-DuYWbFFe.cjs';
|
|
2
|
+
export { o as SqliteMaintenanceConfiguration, p as SqliteRetentionConfiguration, q as SqliteSchemaConfiguration, r as SqliteTableOverrides } from '../query.types-DuYWbFFe.cjs';
|
|
3
3
|
import { T as TelemetryResult } from '../result.types-171Huujb.cjs';
|
|
4
|
-
import { T as TelemetryStorageTransport, a as TelemetryStorageCapabilities, S as StoragePersistRequest, M as MaintenanceStageResult, c as MaintenanceRunRecord, b as StorageTargetStatus } from '../storage.types-
|
|
4
|
+
import { T as TelemetryStorageTransport, a as TelemetryStorageCapabilities, S as StoragePersistRequest, M as MaintenanceStageResult, c as MaintenanceRunRecord, b as StorageTargetStatus } from '../storage.types-Bji_pWqr.cjs';
|
|
5
5
|
import { e as TelemetryAcknowledgement } from '../transport.types-BAl_TRtU.cjs';
|
|
6
6
|
import '../envelope.types-rOLpWXRC.cjs';
|
|
7
7
|
|
package/dist/sqlite/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as SqliteTargetConfiguration, M as MetricDefinition, T as TimelineQuery, b as TimelineQueryResponse, c as TelemetryQueryError, d as MetricQuery, e as MetricQueryResponse } from '../query.types-
|
|
2
|
-
export { o as SqliteMaintenanceConfiguration, p as SqliteRetentionConfiguration, q as SqliteSchemaConfiguration, r as SqliteTableOverrides } from '../query.types-
|
|
1
|
+
import { S as SqliteTargetConfiguration, M as MetricDefinition, T as TimelineQuery, b as TimelineQueryResponse, c as TelemetryQueryError, d as MetricQuery, e as MetricQueryResponse } from '../query.types-DU5v7vM0.js';
|
|
2
|
+
export { o as SqliteMaintenanceConfiguration, p as SqliteRetentionConfiguration, q as SqliteSchemaConfiguration, r as SqliteTableOverrides } from '../query.types-DU5v7vM0.js';
|
|
3
3
|
import { T as TelemetryResult } from '../result.types-171Huujb.js';
|
|
4
|
-
import { T as TelemetryStorageTransport, a as TelemetryStorageCapabilities, S as StoragePersistRequest, M as MaintenanceStageResult, c as MaintenanceRunRecord, b as StorageTargetStatus } from '../storage.types-
|
|
4
|
+
import { T as TelemetryStorageTransport, a as TelemetryStorageCapabilities, S as StoragePersistRequest, M as MaintenanceStageResult, c as MaintenanceRunRecord, b as StorageTargetStatus } from '../storage.types-k7oElEB3.js';
|
|
5
5
|
import { e as TelemetryAcknowledgement } from '../transport.types-DDnZoKWi.js';
|
|
6
6
|
import '../envelope.types-rOLpWXRC.js';
|
|
7
7
|
|
package/dist/sqlite/index.js
CHANGED
|
@@ -1806,73 +1806,49 @@ var TelemetryRepository = class {
|
|
|
1806
1806
|
lastSequence: sample.sequence
|
|
1807
1807
|
};
|
|
1808
1808
|
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Raw retention is purely time-based, matching the native collector: every
|
|
1811
|
+
* expired row goes in one set-based statement per level band. No page size,
|
|
1812
|
+
* no row cap, and no rollup-completion gate — metric samples are extracted at
|
|
1813
|
+
* ingest and retained on their own clock, so dropping a raw row costs no
|
|
1814
|
+
* metric fidelity, and no row can outlive its window waiting on a rollup.
|
|
1815
|
+
*/
|
|
1809
1816
|
createRawEventRetentionStep(nowMs) {
|
|
1810
|
-
const cutoffMs = nowMs - this.options.retention.rawMs;
|
|
1811
1817
|
const table = this.options.tableMap.quoted("rawEvents");
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
WHERE target_id = ? AND occurred_at_ms < ?
|
|
1818
|
-
ORDER BY occurred_at_ms ASC, producer_id ASC, sequence ASC
|
|
1819
|
-
LIMIT ${RETENTION_PAGE_SIZE}`
|
|
1820
|
-
);
|
|
1821
|
-
const readNextPage = this.options.connection.prepare(
|
|
1822
|
-
`SELECT producer_id, sequence, event_id, occurred_at_ms, monotonic_ns,
|
|
1823
|
-
source, process_kind, level, label, conversation_id,
|
|
1824
|
-
conversation_id_kind, correlation_id, metadata_json, schema_version
|
|
1825
|
-
FROM ${table}
|
|
1826
|
-
WHERE target_id = ? AND occurred_at_ms < ?
|
|
1827
|
-
AND (occurred_at_ms, producer_id, sequence) > (?, ?, ?)
|
|
1828
|
-
ORDER BY occurred_at_ms ASC, producer_id ASC, sequence ASC
|
|
1829
|
-
LIMIT ${RETENTION_PAGE_SIZE}`
|
|
1818
|
+
const levelMs = this.options.retention.levelMs ?? {};
|
|
1819
|
+
const levels = Object.keys(levelMs);
|
|
1820
|
+
const removeByLevel = this.options.connection.prepare(
|
|
1821
|
+
`DELETE FROM ${table}
|
|
1822
|
+
WHERE target_id = ? AND lower(coalesce(level, '')) = ? AND occurred_at_ms < ?`
|
|
1830
1823
|
);
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1824
|
+
const fallbackPlaceholders = levels.map(() => "?").join(", ");
|
|
1825
|
+
const removeFallback = this.options.connection.prepare(
|
|
1826
|
+
`DELETE FROM ${table}
|
|
1827
|
+
WHERE target_id = ? AND occurred_at_ms < ?` + (levels.length === 0 ? "" : ` AND lower(coalesce(level, '')) NOT IN (${fallbackPlaceholders})`)
|
|
1833
1828
|
);
|
|
1834
|
-
let
|
|
1829
|
+
let done = false;
|
|
1835
1830
|
return () => {
|
|
1836
|
-
|
|
1837
|
-
this.options.targetId,
|
|
1838
|
-
cutoffMs,
|
|
1839
|
-
cursor.occurredAtMs,
|
|
1840
|
-
cursor.producerId,
|
|
1841
|
-
cursor.sequence
|
|
1842
|
-
);
|
|
1843
|
-
if (rows.length === 0) {
|
|
1831
|
+
if (done) {
|
|
1844
1832
|
return { deleted: 0, done: true };
|
|
1845
1833
|
}
|
|
1846
|
-
|
|
1847
|
-
const parsed = this.rowParser.parseRawEnvelope(row);
|
|
1848
|
-
if (!parsed.ok) {
|
|
1849
|
-
throw new Error(parsed.error);
|
|
1850
|
-
}
|
|
1851
|
-
return parsed.value;
|
|
1852
|
-
});
|
|
1853
|
-
const eligible = scanned.filter((envelope) => this.rawEventHasRequiredRollups(envelope));
|
|
1834
|
+
done = true;
|
|
1854
1835
|
const transaction = this.options.connection.transaction(() => {
|
|
1855
|
-
let
|
|
1856
|
-
for (const
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
).changes;
|
|
1836
|
+
let deleted = 0;
|
|
1837
|
+
for (const level of levels) {
|
|
1838
|
+
const retainMs = levelMs[level];
|
|
1839
|
+
if (retainMs === void 0) {
|
|
1840
|
+
continue;
|
|
1841
|
+
}
|
|
1842
|
+
deleted += removeByLevel.run(this.options.targetId, level, nowMs - retainMs).changes;
|
|
1862
1843
|
}
|
|
1863
|
-
|
|
1844
|
+
deleted += removeFallback.run(
|
|
1845
|
+
this.options.targetId,
|
|
1846
|
+
nowMs - this.options.retention.rawMs,
|
|
1847
|
+
...levels
|
|
1848
|
+
).changes;
|
|
1849
|
+
return deleted;
|
|
1864
1850
|
});
|
|
1865
|
-
|
|
1866
|
-
const last = scanned[scanned.length - 1];
|
|
1867
|
-
if (last === void 0 || rows.length < RETENTION_PAGE_SIZE) {
|
|
1868
|
-
return { deleted, done: true };
|
|
1869
|
-
}
|
|
1870
|
-
cursor = {
|
|
1871
|
-
occurredAtMs: last.occurredAtMs,
|
|
1872
|
-
producerId: last.producerId,
|
|
1873
|
-
sequence: last.sequence
|
|
1874
|
-
};
|
|
1875
|
-
return { deleted, done: false };
|
|
1851
|
+
return { deleted: transaction(), done: true };
|
|
1876
1852
|
};
|
|
1877
1853
|
}
|
|
1878
1854
|
rawEventHasRequiredRollups(envelope) {
|
|
@@ -2613,6 +2589,7 @@ var TelemetryTableMap = class _TelemetryTableMap {
|
|
|
2613
2589
|
rawEventsOccurredIndex: this.indexName(mapping.rawEvents, "occurred"),
|
|
2614
2590
|
rawEventsConversationIndex: this.indexName(mapping.rawEvents, "conversation"),
|
|
2615
2591
|
rawEventsLabelIndex: this.indexName(mapping.rawEvents, "label"),
|
|
2592
|
+
rawEventsLevelIndex: this.indexName(mapping.rawEvents, "level"),
|
|
2616
2593
|
metricSamplesTimeIndex: this.indexName(mapping.metricSamples, "time"),
|
|
2617
2594
|
metricSamplesEventIndex: this.indexName(mapping.metricSamples, "event"),
|
|
2618
2595
|
metricRollupsTimeIndex: this.indexName(mapping.metricRollups, "time")
|