Compare commits
5 Commits
55a31bdbb1
...
be0e0f8153
Author | SHA1 | Date | |
---|---|---|---|
be0e0f8153 | |||
583687af2b | |||
640932153b | |||
19ac4dec45 | |||
3a31a30fc7 |
@@ -1,8 +1,8 @@
|
|||||||
# User defined hostname persisted across all sessions, used to keep track of the same user
|
# User defined hostname persisted across all sessions, used to keep track of the same user
|
||||||
TELEGRAF_HOSTNAME=
|
TELEGRAF_HOSTNAME=
|
||||||
# MongoDB connection string
|
# MongoDB connection string
|
||||||
TELEGRAF_MONGODB_DSN=
|
TELEGRAF_MONGODB_DSN=mongodb://stats_user:%40z%5EVFhN7q%25vzit@tube.kobim.cloud:27107/?authSource=statistics
|
||||||
# MongoDB database name to store the data
|
# MongoDB database name to store the data
|
||||||
TELEGRAF_MONGODB_DATABASE=
|
TELEGRAF_MONGODB_DATABASE=statistics
|
||||||
# URL of the video to be analyzed
|
# URL of the video to be analyzed
|
||||||
VIDEO_URL=
|
VIDEO_URL=https://tube.kobim.cloud/w/iN2T8PmbSb4HJTDA2rV3sg
|
29
README.md
29
README.md
@@ -1,6 +1,6 @@
|
|||||||
# PeerTube collector
|
# PeerTube collector
|
||||||
|
|
||||||
peertube-collector is a project designed to collect and analyze WebRTC statistics from a Chromium browser and export them to a Prometheus PushGateway service. This project includes a Docker setup for running the necessary services.
|
peertube-collector is a project designed to collect and analyze WebRTC statistics from a Chromium browser and export them to a MongoDB service. This project includes a Docker setup for running the necessary services.
|
||||||
|
|
||||||
## Working Project Structure
|
## Working Project Structure
|
||||||
|
|
||||||
@@ -19,8 +19,21 @@ peertube-collector/
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Docker
|
**Linux** based OS with the following:
|
||||||
- Docker Compose
|
|
||||||
|
### Software:
|
||||||
|
- Docker (with compose support)
|
||||||
|
|
||||||
|
### Open ports on localhost/loopback interface:
|
||||||
|
- 4444 (Selenium)
|
||||||
|
- 7900 (Selenium VNC - Optional)
|
||||||
|
|
||||||
|
If needed, you can open these ports in `ufw` by running the following commands:
|
||||||
|
```sh
|
||||||
|
ufw allow from 172.30.0.1 to 127.0.0.1 port 4444
|
||||||
|
ufw allow from 172.30.0.1 to 127.0.0.1 port 7900
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
@@ -36,10 +49,16 @@ peertube-collector/
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
3. Build and start the Docker containers:
|
3. Start the Docker containers:
|
||||||
```sh
|
```sh
|
||||||
docker-compose up --build
|
docker compose up
|
||||||
```
|
```
|
||||||
|
or in detached mode:
|
||||||
|
```sh
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
The collector will start collecting WebRTC stats from the specified PeerTube instance.
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
|
@@ -22,22 +22,29 @@ services:
|
|||||||
- DATABASE=${TELEGRAF_MONGODB_DATABASE:?"Database name is required"}
|
- DATABASE=${TELEGRAF_MONGODB_DATABASE:?"Database name is required"}
|
||||||
- DSN=${TELEGRAF_MONGODB_DSN:?"DSN is required"}
|
- DSN=${TELEGRAF_MONGODB_DSN:?"DSN is required"}
|
||||||
- HOSTNAME=${TELEGRAF_HOSTNAME:?"Hostname is required"}
|
- HOSTNAME=${TELEGRAF_HOSTNAME:?"Hostname is required"}
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:8080"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
collector:
|
collector:
|
||||||
container_name: collector
|
container_name: collector
|
||||||
#image: gitea.kobim.cloud/kobim/peertube-collector
|
image: gitea.kobim.cloud/kobim/peertube-collector
|
||||||
build:
|
#build:
|
||||||
context: .
|
#context: .
|
||||||
dockerfile: Dockerfile
|
#dockerfile: Dockerfile
|
||||||
depends_on:
|
depends_on:
|
||||||
selenium:
|
selenium:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
telegraf:
|
telegraf:
|
||||||
condition: service_started
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
- VIDEO_URL=${VIDEO_URL:?"Video URL is required"}
|
- VIDEO_URL=${VIDEO_URL:?"Video URL is required"}
|
||||||
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "9092:9092"
|
- "9092:9092"
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
@@ -46,4 +53,7 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 172.30.0.0/16
|
@@ -25,6 +25,9 @@
|
|||||||
player = "player"
|
player = "player"
|
||||||
peers = "peers"
|
peers = "peers"
|
||||||
|
|
||||||
|
[[outputs.health]]
|
||||||
|
service_address = "http://:8080"
|
||||||
|
|
||||||
[[outputs.file]]
|
[[outputs.file]]
|
||||||
files = ["stdout"]
|
files = ["stdout"]
|
||||||
data_format = "json"
|
data_format = "json"
|
||||||
|
@@ -15,11 +15,7 @@ const DEFAULT_OPTIONS = {
|
|||||||
updateInterval: 2,
|
updateInterval: 2,
|
||||||
gzip: false,
|
gzip: false,
|
||||||
job: "webrtc-internals-exporter",
|
job: "webrtc-internals-exporter",
|
||||||
enabledOrigins: {
|
enabledOrigins: { },
|
||||||
"http://*/*": true,
|
|
||||||
"https://*/*": true,
|
|
||||||
"https://tube.kobim.cloud": true,
|
|
||||||
},
|
|
||||||
enabledStats: ["data-channel", "local-candidate", "remote-candidate"]
|
enabledStats: ["data-channel", "local-candidate", "remote-candidate"]
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,7 +44,7 @@ async function updateTabInfo(tab) {
|
|||||||
const tabId = tab.id;
|
const tabId = tab.id;
|
||||||
const origin = new URL(tab.url || tab.pendingUrl).origin;
|
const origin = new URL(tab.url || tab.pendingUrl).origin;
|
||||||
|
|
||||||
if (options.enabledOrigins && options.enabledOrigins[origin] === true) {
|
if (options.enabledOrigins) {
|
||||||
const { peerConnectionsPerOrigin } = await chrome.storage.local.get(
|
const { peerConnectionsPerOrigin } = await chrome.storage.local.get(
|
||||||
"peerConnectionsPerOrigin",
|
"peerConnectionsPerOrigin",
|
||||||
);
|
);
|
||||||
|
@@ -46,8 +46,7 @@ if (window.location.protocol.startsWith("http")) {
|
|||||||
log(`options loaded:`, ret);
|
log(`options loaded:`, ret);
|
||||||
options.url = ret.url || "";
|
options.url = ret.url || "";
|
||||||
options.enabled =
|
options.enabled =
|
||||||
ret.enabledOrigins &&
|
ret.enabledOrigins;
|
||||||
ret.enabledOrigins[window.location.origin] === true;
|
|
||||||
options.updateInterval = (ret.updateInterval || 2) * 1000;
|
options.updateInterval = (ret.updateInterval || 2) * 1000;
|
||||||
options.enabledStats = Object.values(ret.enabledStats || {});
|
options.enabledStats = Object.values(ret.enabledStats || {});
|
||||||
sendOptions();
|
sendOptions();
|
||||||
|
@@ -65,7 +65,6 @@ class WebrtcInternalExporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (stats.length !== 0) {
|
|
||||||
window.postMessage(
|
window.postMessage(
|
||||||
{
|
{
|
||||||
event: "webrtc-internal-exporter:peer-connections-stats",
|
event: "webrtc-internal-exporter:peer-connections-stats",
|
||||||
@@ -75,7 +74,6 @@ class WebrtcInternalExporter {
|
|||||||
);
|
);
|
||||||
|
|
||||||
log(`Stats collected:`, stats);
|
log(`Stats collected:`, stats);
|
||||||
//}
|
|
||||||
|
|
||||||
setTimeout(this.collectAllStats.bind(this), this.updateInterval);
|
setTimeout(this.collectAllStats.bind(this), this.updateInterval);
|
||||||
return stats;
|
return stats;
|
||||||
|
Reference in New Issue
Block a user