Add domain traffic metrics and Grafana dashboard
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user