metrics: can safely throw now
This commit is contained in:
@@ -380,8 +380,7 @@ async function pipeContainerToMap(name, statsMap) {
|
||||
assert.ok(statsMap instanceof Map);
|
||||
|
||||
// we used to poll before instead of a stream. but docker caches metrics internally and rate logic has to handle dups
|
||||
const [error, statsStream] = await safe(docker.getStats(name, { stream: true }));
|
||||
if (error) return null; // container stopped or missing, silently ignore
|
||||
const statsStream = await docker.getStats(name, { stream: true });
|
||||
|
||||
statsStream.on('error', (error) => debug(error));
|
||||
statsStream.on('data', (data) => {
|
||||
@@ -425,9 +424,7 @@ async function pipeContainerToMap(name, statsMap) {
|
||||
async function pipeSystemToMap(statsMap) {
|
||||
assert.ok(statsMap instanceof Map);
|
||||
|
||||
const [error, metrics] = await safe(readSystemMetrics());
|
||||
if (error) return; // silently ignore error
|
||||
|
||||
const metrics = await readSystemMetrics();
|
||||
const oldMetrics = statsMap.get('system')?.raw || null;
|
||||
|
||||
const gap = oldMetrics ? (metrics.ts - oldMetrics.ts) : null;
|
||||
@@ -479,7 +476,7 @@ async function getStream(options) {
|
||||
|
||||
const INTERVAL_MSECS = 1000;
|
||||
intervalId = setInterval(async () => {
|
||||
if (options.system) await pipeSystemToMap(statsMap);
|
||||
if (options.system) await safe(pipeSystemToMap(statsMap), { debug });
|
||||
|
||||
const result = {};
|
||||
const nowSecs = Date.now() / 1000; // to match graphite return value
|
||||
|
||||
Reference in New Issue
Block a user