feat: add player and webrtc statistics aggregation scripts, update subproject reference, and include latency images
Some checks failed
Build LaTeX Document / build_latex (push) Has been cancelled
Some checks failed
Build LaTeX Document / build_latex (push) Has been cancelled
This commit is contained in:
103
peertube/datavis/CRUD/player-statistics.js
Normal file
103
peertube/datavis/CRUD/player-statistics.js
Normal file
@@ -0,0 +1,103 @@
|
||||
/* global use, db */
|
||||
// MongoDB Playground
|
||||
// To disable this template go to Settings | MongoDB | Use Default Template For Playground.
|
||||
// Make sure you are connected to enable completions and to be able to run a playground.
|
||||
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.
|
||||
// The result of the last command run in a playground is shown on the results panel.
|
||||
// By default the first 20 documents will be returned with a cursor.
|
||||
// Use 'console.log()' to print to the debug output.
|
||||
// For more documentation on playgrounds please refer to
|
||||
// https://www.mongodb.com/docs/mongodb-vscode/playgrounds/
|
||||
|
||||
// Select the database to use.
|
||||
use('statistics');
|
||||
|
||||
// Insert a few documents into the sales collection.
|
||||
db.getCollection('peertube_hetzner_high_latency').aggregate(
|
||||
[
|
||||
{
|
||||
$group: {
|
||||
_id: "$tags.session",
|
||||
maxDownPeers: {
|
||||
$max: "$player.Download Breakdown.Peers"
|
||||
},
|
||||
maxDownServer: {
|
||||
$max: "$player.Download Breakdown.Server"
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: null,
|
||||
totalDownPeers: {
|
||||
$sum: "$maxDownPeers"
|
||||
},
|
||||
totalDownServer: {
|
||||
$sum: "$maxDownServer"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
_id: 0,
|
||||
totalDownPeers: 1,
|
||||
totalDownServer: 1,
|
||||
totalComputedDown: {
|
||||
$sum: [
|
||||
"$totalDownPeers",
|
||||
"$totalDownServer"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
totalDownPeers: 1,
|
||||
totalDownServer: 1,
|
||||
totalComputedDown: 1,
|
||||
percentageOfTotalPeers: {
|
||||
$round: {
|
||||
$multiply: [
|
||||
{
|
||||
$divide: [
|
||||
"$totalDownPeers",
|
||||
"$totalComputedDown"
|
||||
]
|
||||
},
|
||||
100
|
||||
]
|
||||
}
|
||||
},
|
||||
percentageOfTotalServer: {
|
||||
$round: {
|
||||
$multiply: [
|
||||
{
|
||||
$divide: [
|
||||
"$totalDownServer",
|
||||
"$totalComputedDown"
|
||||
]
|
||||
},
|
||||
100
|
||||
]
|
||||
}
|
||||
},
|
||||
ratio: {
|
||||
$round: {
|
||||
$divide: [
|
||||
"$totalDownPeers",
|
||||
"$totalDownServer"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
$sort: {
|
||||
ratio: -1
|
||||
}
|
||||
},
|
||||
{
|
||||
$limit: 10
|
||||
}
|
||||
]
|
||||
)
|
Reference in New Issue
Block a user