Add domain traffic metrics and Grafana dashboard
Build and Deploy Gateway / build-and-push (push) Successful in 14s
Build and Deploy Gateway / deploy (push) Successful in 13s

This commit is contained in:
2026-08-08 01:57:00 +03:00
parent 10888ac012
commit ca53b671ee
20 changed files with 612 additions and 17 deletions
+16
View File
@@ -848,3 +848,19 @@ test('malformed proxy totals are backed up and an expired recovery marker is cle
assert.deepEqual(store.read().traffic.proxy.rebaselineMacs, []);
assert.equal(snapshot.source.traffic.proxy.error, null);
});
test('an old dataplane without domain traffic keeps inventory refresh and existing metrics available', async (t) => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'harbor-domain-compat-'));
t.after(() => fs.rmSync(directory, { recursive: true, force: true }));
const store = createJsonStore({ filePath: path.join(directory, 'devices.json'), defaultValue: {} });
const service = createDeviceInventoryService({
store,
observe: () => ({ observedAt: '2026-08-08T10:00:00.000Z', observations: [], error: null }),
observeDomainTraffic: () => { throw new Error('Dataplane HTTP 404'); },
});
const snapshot = await service.refresh();
assert.equal(snapshot.devices.length, 0);
assert.equal(service.metricsSnapshot().domainTraffic.source.error, 'Dataplane HTTP 404');
assert.equal(service.metricsSnapshot().traffic.totalBytes, '0');
});