How to use the systeminformation.dockerContainerStats function in systeminformation

To help you get started, we’ve selected a few systeminformation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / caliper / packages / caliper-core / lib / master / monitor / monitor-docker.js View on Github external
async readContainerStats() {
        // Prevent overlapping read of stats
        if (this.isReading) {
            return;
        } else {
            this.isReading = true;
            let startPromises = [];
            try {
                for (let i = 0; i < this.containers.length; i++) {
                    if (this.containers[i].remote === null) {
                        // local
                        startPromises.push(SystemInformation.dockerContainerStats(this.containers[i].id));
                    } else {
                        // remote
                        startPromises.push(this.containers[i].remote.stats({ stream: false }));
                    }
                }

                const results = await Promise.all(startPromises);
                this.stats.time.push(Date.now() / 1000);
                for (let i = 0; i < results.length; i++) {
                    let stat = results[i];
                    let id = stat.id;
                    if (this.containers.length <= i) {
                        break;
                    }
                    if (id !== this.containers[i].id) {
                        Logger.warn('inconsistent id within statistics gathering');