From f579000a96c871535ac5a4599c2d89aee39bb796 Mon Sep 17 00:00:00 2001 From: Mirko Milovanovic Date: Thu, 13 Feb 2025 16:41:09 +0100 Subject: [PATCH] docs: simplify Docker commands in README and enhance logging in WebRTC stats exporter --- README.md | 8 +++----- docker-compose.yml | 5 ++++- webrtc-internals-exporter/override.js | 11 +++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4cf51ad..e89a4b6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ peertube-collector is a project designed to collect and analyze WebRTC statistic Ports can be opened in the host machine's firewall with: ```sh -ufw allow from 172.30.0.0/16 to any port 4444 +ufw allow from 172.100.0.0/16 to any port 4444 ``` #### External (OPTIONAL): @@ -48,13 +48,11 @@ ufw allow 27107/tcp 4. Start the Docker containers: ```sh - docker compose up \ - --pull always \ - --abort-on-container-exit + docker compose up --abort-on-container-exit ``` or in detached mode: ```sh - docker compose up --pull always -d + docker compose up -d ``` The collector will start gathering WebRTC stats from the Selenium container and sending them to the Telegraf service. diff --git a/docker-compose.yml b/docker-compose.yml index 27699b0..1b47373 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: interval: 5s timeout: 10s retries: 5 + pull_policy: always network_mode: host telegraf: @@ -30,6 +31,7 @@ services: interval: 5s timeout: 10s retries: 5 + pull_policy: always networks: - backend @@ -50,6 +52,7 @@ services: - "9092:9092" extra_hosts: - "host.docker.internal:host-gateway" + pull_policy: always networks: - backend @@ -57,4 +60,4 @@ networks: backend: ipam: config: - - subnet: 172.30.0.0/16 + - subnet: 172.100.0.0/16 diff --git a/webrtc-internals-exporter/override.js b/webrtc-internals-exporter/override.js index 186b443..9139446 100644 --- a/webrtc-internals-exporter/override.js +++ b/webrtc-internals-exporter/override.js @@ -92,10 +92,12 @@ class WebrtcInternalExporter { window.postMessage( { event: "webrtc-internal-exporter:peer-connection-stats", - stats + stats: [stats] }, - stats + [stats] ); + + log(`Single stat collected:`, [stats]); } async collectAllStats() { @@ -112,11 +114,12 @@ class WebrtcInternalExporter { window.postMessage( { event: "webrtc-internal-exporter:peer-connections-stats", - data: JSON.parse(JSON.stringify(stats)), + data: stats }, + stats ); - log(`Stats collected:`, JSON.parse(JSON.stringify(stats))); + log(`Stats collected:`, stats); setTimeout(this.collectAllStats.bind(this), this.updateInterval); return stats;